
Home |
|
PegGifConvert
|

Examples |

Index |
|
 |
|
|
 |
|
Overview |
Derived from class
PegImageConvert
|
 |
|
The PegBmpConvert class controls the conversion
of images from the Compuserve GIF87, GIF89 or GIF89a format
to the PegBitmap format used by KwikPeg.
The services provided by the PegImageConvert base class
are used for color reduction, run length encoding (RLE) compression and
transparency, if required.
The PegGifConvert class reads
a GIF source image and from it produces one or more PegBitmap
images. A matching set of GIF_IMAGE_INFO structures
which describe the bitmap images is also generated.
 |
To use the PegGifConvert class or its derivatives,
your KwikPeg configuration must have the following option enabled: |
| |
Images: GIF images |
To convert a GIF image, proceed as follows.
- Create a
PegGifConvert object to be used to
convert the images.
- Use it to convert one GIF image into one or more bitmap images.
- Retrieve the image count from the conversion object
using the
GetBitmapCount() function.
- Retrieve each of the
PegBitmap images
from the conversion object using the
GetBitmapPointer() function.
- Retrieve the array of
GIF_IMAGE_INFO structures
from the conversion object using the GetGifInfo() function.
- Delete the conversion object since it is no longer required.
- Use the bitmap images in your GUI.
- When you are finished with the array of
GIF_IMAGE_INFO
structures, free the memory using the Delete[] operator.
- When the images are no longer required, delete the
PegBitmap images using the
Screen()->DestroyBitmap(pMap) function.
 |
**WARNING**
KwikPeg uses the LZW decompression algorithm to read and decode GIF images.
The LZW algorithm is patented; the patent is owned by Unisys Corporation.
Usage of LZW requires that you obtain a usage license directly from Unisys.
As indicated in our legal notices,
provision of this GIF conversion class does NOT grant an LZW license
for its use.
For more information, see the Unisys website at
www.unisys.com.
|
|
|
 |
 |
|
PegBmpConvert
PegJpgConvert
PegPngConvert
PegQuant
Constructors:
 |
 |
PegGifConvert(WORD wId = 0)
|
This constructor creates an image conversion object to be used
to convert an image from GIF image format
to the KwikPeg PegBitmap format.
Public Functions:
 |
 |
GIF_HEADER *GetGifHeader(void)
|
This function returns a pointer to a structure which contains the
information derived from the GIF image header.
There is one GIF_HEADER structure assocated with a
PegGifConvert object. Its content is updated each time
a GIF source image is converted.
The GIF_HEADER structure is deleted
when the PegGifConvert object is destroyed.
The GIF_HEADER structure is defined as:
typedef struct {
WORD wWidth; // overall width
WORD wHeight; // overall height
WORD wColors; // number of colors
UCHAR uBackClrIndex; // transparent color index
COLORVAL cBackground; // background fill color
UCHAR uAspectRatio;
UCHAR IsGif89; // TRUE if image is GIF89a
} GIF_HEADER;
 |
 |
GIF_IMAGE_INFO *GetGifInfo(void)
|
This function returns a pointer to an array of structures
which describe each of the bitmap images generated from one
GIF source image.
The array of GIF_IMAGE_INFO structures is deleted
when the DestroyImages() member function is called
to delete the converted bitmap images.
If your application takes custody of the array of
GIF_IMAGE_INFO structures and then destroys the
PegImageConvert object used for the conversion,
you must delete the array when you have finished with it.
Use the Delete[] operator to free the memory
allocated for the array.
The GIF_IMAGE_INFO structure is defined as:
typedef struct {
SIGNED xOffset; // relative x offset
SIGNED yOffset; // relative y offset
WORD wWidth; // width in pixels
WORD wHeight; // height in pixels
WORD tDelay; // delay in hundredths of a second
UCHAR uHasTrans; // TRUE if image has transparency
UCHAR uTransColor; // transparent color index
UCHAR uInputFlag; // wait for user input?
UCHAR uDisposal; // image overwrite method
} GIF_IMAGE_INFO;
 |
 |
virtual BOOL ReadImage(
|
| |

SIGNED iCount = 10)
|
 |
virtual BOOL ReadImage(
|
| |

PegFile *pFile,
|
| |

SIGNED iCount = 10)
|
This function initiates the conversion process.
Review the description
provided for the PegImageConvert base class.
The iCount parameter specifies the upper limit on
the number of embedded images which will be converted
from the source GIF89a image.
If the data streaming method is used for image access,
only the first form of this function will be available.
If the file access method is used for image access,
only the second form of this function will be available.
An example which uses the image conversion classes to read and display
a collection of BMP, GIF and JPEG images is provided
in the KwikPeg installation directory KPGnnn\EXAMPLES\IMGBROWS.