CK_Object
|
+----CK_Image
|
+----CK_StaticImage
This class represents a single, non-animated image loaded from a file. Factory methods exist to create an image from .pcx, .bmp, or .cim files. A .cim file is a serialized CK_StaticImage object.
CK_StaticImage objects cannot be drawn to the display. This is because the pixel data might not be stored in the same format (i.e. bits/pixel) as the display surface. The CK_Bitmap class represents a bitmap stored in the correct pixel format. A CK_Bitmap object can be created from a CK_StaticImage regardless of the display's pixel format, or the pixel format of the CK_StaticImage. As an example, if an application wanted to display an image stored in a .pcx file, it would first create a CK_StaticImage object from the .pcx file. It would then create a CK_Bitmap from the CK_StaticImage, effectively converting from the .pcx pixel depth, to the pixel depth of the display surface.
See CK_Image for more information.
This factory method is used to create a CK_StaticImage from an already opened file. It can only be used with serialized objects, and not with pre-opened .pcx or .bmp files. The file pointer will be left at the beginning of the next object in the file.
- Return Value
- Returns a pointer to the image created. Return 0 if the file pointer did not point to a serialized CK_StaticImage.
Parameters
- fp
- File pointer pointing to the beginning of a serialized image. The file pointer should be from a file opened in binary mode - such as 'fopen("x.cim","rb")'.
- com
- The name of a compression object to be used for decompressing the image data. If null, no decompression will occur. The compression object must be the same as that used when serializing the image.
Creates a CK_StaticImage object from a .pcx, .bmp, or .cim file. Files ending in .pcx or .bmp are created with no transparency. If the graphics file is 8 bits per pixel, then the CK_StaticImage will contain a palette set with one palette. Files ending in .cim are serialized static images.
- Return Value
- Returns a pointer to the CK_StaticImage object created. If the file was missing, could not be opened, or did not contain the correct image file format, a null pointer is returned.
Parameters
- fileName
- The name of a .pcx, .bmp, or .cim file.
- com
- The name of a compression object to be used with .cim files for decompressing the image data. If null, no decompression will occur. The compression object must be the same as that used when serializing the image.
Creates a non-transparent CK_StaticImage object from a .bmp file. If the graphics file is 8 bits per pixel, then the CK_StaticImage will contain a palette set with one palette.
- Return Value
- Returns a pointer to the CK_StaticImage object created. A null pointer is returned if bitmap resource does not exist and the image could not be created.
Parameters
- resourceID
- The integer ID of the bitmap resource.