Included in this project are project files and source code to build a variety 
of DLLs that support reading and writing a variety of bitmap files.  Projects 
have been built with BCB 5 and VC++ 6.0.  

BMGLib will either create a bitmap from the image file or return the raw data 
so that it can be used as a texture map in OpenGL.  It can also save a bitmap
or an image created with OpenGL to a file.  Further information can be found 
in Projects\BMGLib\BMGLib DLL\BMGLibAPI.txt.  BMGLib does not support 
animated GIFs.  It will only display the first image in an animated GIF.  The 
GIFLib classes (Projects\BMGLib\GIF\GIFLib.*) will support animated GIFs.  
Example applications and brief documentation can be found in that folder as 
well.  GeoTIFF images can be read and created with the BMGGeoTIFF project

BMGLib supports the image file formats listed below:

File Type	Read	Write	comments
-------------------------------------------------------------------------------
TIFF		yes	yes	No LZW compression (can read, but not write).  
                                Cannot read or write YCbCr or CIE variants
PNG		yes	yes
JPEG		yes	yes
BMP		yes	yes	Supports BI_RGB only.
RGB (SGI)	yes	yes	cannot write compressed files
TGA             yes     yes
GIF		yes	no	BMGLib does not support animated GIFs, but 
				GIFLib does.
CEL             yes     no	supports FLC and FLI formats
PSD		yes	no	does not support LAB or CMYK formats
IFF		yes	no	currently, only supports 8 BPP images
PCX             yes     no

this project contains the following folders:
tiff-v3.5.7		Source code for libTIFF library.  
JPEG			Source code for libJPEG library.  
libpng125 		Source code for libPNG library.
zlib114			Source code for the zlib compression library.
libgeotiff114   	Source code for the GeoTIFF library.
proj442         	Source code for the projection library used by GeoTIFF.
libungif_v4_1_0b1	Source code for the libUnGIF library.

BMGLib_DLL      	Source code and project file that builds the BMGLib DLL.  
			Project files for BCB 5 and VC++ 6 are included.  Project
                        files and source code for building stand-along versions
                        of the BMGLibTIFF, BMGLibPNG, and BMGLibJPEG classes can
                        be found in this folder as well.

BMGLib_DLL\BCB Demo	Projects and source that demonstrate using the 
			functions exported by BMGLib with the VCL. The IMAGE 
			project will read, write, and display all supported 
			image formats.  The TEXTURE project will convert images 
                        to OpenGL textures and saves OpenGL screens to a file.
			The LibPNGDemo, LibTIFFDemo, and LibJPEGDemo projects
			are very simple test programs that exercise the 
                        additional functions exported by the stand-alone DLLs.
BMGLib_DLL\MFC_Demo	Projects and source that demostrates using the 
                        functions exported from BMGLib with MFC.  The MFCDEMO
			project will read, write, and display all supported 
			image formats.  
BMGLib_DLL\MFC_Texture  Projects and source that demostrates using the 
                        functions exported from BMGLib with MFC.  The TEXTURE 
                        project will convert images to OpenGL textures and saves 
                        OpenGL screens to a file.

BMGGeoTIFF_DLL  	Source code and project file that builds the BMGGeoTIFF 
			DLL.  Project files for BCB 5 and VC++ 6 are included.

BMGGeoTIFF_DLL\BCB_GeoTIFF	Projects and source that demonstrate using the 
				functions exported by BMGGeoTIFF with the VCL.
BMGGeoTIFF_DLL\MFC_GeoTIFF	Projects and source that demonstrate using the 
				functions exported by BMGGeoTIFF with the MFC.

GIF		Source code for reading GIF files and displaying animated GIFs.

GIF\BCB         Source code and project file that demonstrates using the GIFlib 
                with the VCL.
GIF\MFC         Source code and project file that demonstrates using the GIFlib 
                with the MFC.

I removed several files and folders from the GeoTIFF, projection library, 
libTIFF, libJPEG, libPNG, libUnGIF, and zlib folders.  There was a lot of stuff 
for other operating systems as well as utilities that I was not interested in.  If 
you are interested in the missing files then you can obtain the original 
distributions from:

http://www.libtiff.org
ftp://ftp.uu.net/graphics/jpeg
http://www.libpng.org/pub/png/libpng.html
http://www.info-zip.org/pub/infozip/zlib
http://prtr-13.ucsc.edu/~badger/software/libungif/
http://www.remotesensing.org (Both the GeoTIFF and projection libraries used by 
			      GeoTIFF can be found there)

DO NOT OVERWRITE ANY CODE IN THIS PROJECT WITH FILES OBTAINED FROM THE ABOVE 
WEB SITES.  I made minor modifications to several files to make the code 
compile, link, and export functions.

The CDIBSectionLite class was blatantly stolen from www.codeguru.com.  See the 
source in the MFCDemo folder for Copyright information.  IMO, it is as easy to 
use as the VCL TBitmap class.

The MTOpenGLView and CriticalSection classes in the "BMGLib DLL\MFC Texture"
folder were stolen without remorse from Michael Kennedy's web site
(http://mkennedy.101main.com/software).

The extgl modules in "BMGLib_DLL\MFC Texture" and "BMGLib_DLL\BCB Demo" folders
were unjustly swiped from Lev Povalahev's web site.  These modules simplify
the detection and loading of OpenGL extensions.  Strongly recommended.
(http://www.levp.de/3d/)

The DLLs were written in straight C.  I intentionally did not use OWL, VCL, or 
MFC in the BMGLib DLL, so the code will compile with MS and Borland compilers.  
It should compile with minor tweaks using other compilers as well.  The code 
will only compile on Win32 operating systems since it uses Windows API calls.

The MFC and BCB Demos require BMGLib.  Build BMGLib.dll first, then copy the
DLL to the appropriate folder and build that project.  

Enjoy...
Scott
25 January 2004

Modifications:

25 January 2004  BMGLib 2.5

Added the PCX format as a read-only format.

Modified the TIFF library so that it could read 


25 March 2003 BMGLib 2.4

Updated the TIFFlib library to 3.5.7
Updated the zlib library to 1.1.4
Updated the PNGLib library to 1.2.5

Many OpenGL cards support the EXT_BGRA option.  This allows users to insert 
and extract pixels in Windows' BGR & BGRA formats.  A flag has been added 
to the GetUnpackedArray and SaveUnpackedArray functions that allow users to 
take advantage of the BGRA extension.  

BORLAND USERS: The PNG.H file in PNGLib 1.2.5 declared all exported functions 
to be 'external'.  This forced me to create a static library for PNGLib and
and link that library with the BMGLib and BMGLibPNG DLLs.  From now on, you 
will need to build the libPNGStat project before building those 2 DLLs.


29 Sep 2002  BMGLib 2.3

The errCorruptFile error term was added to the BMGErr enumeration.

The ReadCEL function was modified to read FLI and FLC formats (which 
appear to use the CEL file name extension).

Added PSD (Adobe Photoshop) and IFF formats to the list of read-only
formats.  These "obscure" formats were used in several 3DS files 
that I downloaded from the Internet.

Created a write function for TGA files (WriteTGA)

22 Sep 2001

Three new utility functions were added.  The ConvertPaletteToRGB function 
converts 1, 4, 8, and 16-BPP images to 24-BPP or 32-BPP images.  It 
simply copies 24-BPP and 32-BPP images. The GetDataFromFile function reads 
any one of the supported file formats and returns the data in a 
BMGImageStruct.  The CopyBMGImage function simply copies the contents of 1 
BMGImageStruct to another.

The alpha blending implementation was incorrect in previous versions of 
BMGLib.  This problem was corrected.  The SetBMGBackgroundColor function must
be called to specify the background color when alpha blending with bland 
(single color backgrounds) is requested.  

Furthermore, BMGLib can now blend a background image with a foreground image.
The SetBMGBackgroundBitmap and SetBMGBackgroundImage functions can be used to
specify the background images.

27 July 2001

Fixed a bug in CompressBMGImage which mangled 16 BPP images.

Error codes were implemented in all BMG functions.  The GetLastBMGError
and GetLastBMGErrorMessage were added to retreive the error codes.  Most BMGLib
functions return BMG_OK if no error occurrs; otherwise, they will return an 
error code.  Functions that return an HBITMAP will return a non-null handle
if no error occurs.  If NULL is returned, then the GetLastBMGError can be used
to determine what the error was.

Two functions were added to convert color images to grayscale and pseudo
grayscale images.

In previous versions, the HBITMAP passed into the SaveBitmapToFile and 
GetDataFromBitmap functions had to be handles to device independent bitmaps 
(DIB).  Version 2.1 allows you to pass HANDLES to DIBs and device dependent
bitmaps (DDB).  Thanks to Rene Pilon for pointing out this deficiency.

16 BPP HBITMAPS can now be saved in TIFF, PNG, and JPEG formats.

All GeoTIFF functions were removed from BMGLib.  A BMGGeoTIFF project was 
created and the GeoTIFF functionality was implemented in it.  I did this 
because I rarely needed to mix GeoTIFFs with other image formats.  It also 
reduced the size of the BMGLib.DLL.  See the 
"Projects\BMGlib\BMGGeoTIFF_DLL" folder for the project and examples.

Several people did not require all of the image formats that were included in 
BMGLib and would ask for a list of files required for specific formats.  I
have created projects that build stand-alone DLLs for JPEG (BMGLibJPEG), TIFF
(BMGLibTIFF), and PNG (BMGLibPNG).  The project files that build these 
stand-alone DLLs can be found in the "Projects\BMGlib\BMGlib_DLL" folder.

Version 2.0 of BMGLib used my GIFLib library.  I replaced this library with
Eric Raymond's libungif library.  I did this to remove the C++ code and
keep the entire project in C.  The C++ GIFLib class is still distributed with 
the project since it supports animated GIFs (BMGLib does not support animated 
GIFs).


18 Feb 2001

A complete rewrite of the BMG Library. 
developed BMGImageStruct to provide a consistent interface between the 
application and all BMG functions.
Added BMP (R/W), RGB (R/W), GIF (R), CEL (R), TGA (R) formats: (R = Read, 
W = Write)

3 Sept 2000

The libTIFF library was updated to version 3.5.5.  This version was 
obtained from www.libtiff.org.  That organization is now developing libTIFF.  
This version fixed the "save" bug in the VC++ generated DLL.  It also removes 
LZW compression from the library so that the UNISYS patent is not violated.  
libTIFF will still read LZW compressed files; however, it will not save LZW 
compressed files.

The OWL projects were removed.  Unfortunately, BC++ consistently hangs on my 
dual processor, win2K system.  Since Borland has abandoned OWL and will not 
upgrade the BC++ IDE I will no longer develop with BC++ or OWL.  SIGH!

Several unused folders/files were removed from this version.  This was done to 
reduce the size of the zip file.

11 August 2000

An indexing error was fixed in the GetBitmapFromTIFF function that caused VC++ 
projects to crash.

The output of the CreateBMI procedure was changed from a BITMAPINFOHEADER 
structure to a BITMAPINFO structure.  This removed some warnings that VC++ 
generated.
