Data and characteristics of an image
typedef struct PhImage
{
int type;
ulong_t image_tag;
int bpl;
PhDim_t size;
ulong_t palette_tag;
int colors;
int xscale;
int yscale;
char format;
char flags;
char ghost_bpl;
char spare1;
char *ghost_bitmap;
int mask_bpl;
char *mask_bm;
PgColor_t *palette;
char *image;
} PhImage_t;
The PhImage_t structure describes the data
and characteristics of an image. When you give an image to a
PtLabel subclass widget, this is the
structure you must provide. To get a pointer to this
structure, use
PxLoadImage().
To free the allocated members of this structure, call
PhReleaseImage().
The structure contains at least the following members:
- int type
- The graphic type. For more info, see the discussion on the
type argument in PgDrawImage().
- ulong_t image_tag
- The image-data tag, a cyclic redundancy check (CRC)
that's used extensively by
phrelay
to cache images.
This tag is filled in automatically for images created in PhAB or
by PxLoadImage().
If you're creating an image in some other way, you should
fill in the tag by calling
PxCRC(),
passing it the image pixel data and the size of that data.
- int bpl
- The number of bytes in each line of the image.
- PhDim_t size
- The size of the image.
- ulong_t palette_tag
- The palette-data tag.
- int colors
- The number of colors in the image.
- int xscale
- The x scale factor for the image.
- int yscale
- The y scale factor for the image.
- char format
- Not used.
- char flags
- The image flags. The valid bits are:
- Ph_RELEASE_IMAGE-free the image data.
- Ph_RELEASE_PALETTE-free the palette data.
- Ph_RELEASE_TRANSPARENCY_MASK-free
the transparency mask bitmap.
- Ph_RELEASE_GHOST_BITMAP-free the bitmap
used for ghosting.
- Ph_RELEASE_IMAGE_ALL-free all the above.
The freeing is done automatically by widgets if these bits are set.
Calling
PhReleaseImage()
with an image frees any resources that
have the corresponding bit set in the image flags.
- char ghost_bpl
- The number of bytes per line for the ghosting bitmap.
- char *ghost_bitmap
- A pointer to the transparency mask for ghosting an image.
The leftmost pixel corresponds to the top bit of the first byte in the
mask.
- int mask_bpl
- The number of bytes per line for the transparency mask.
- char *mask_bm
- A pointer to the transparency mask.
The leftmost pixel corresponds to the top bit of the first byte in the
mask.
- PgColor_t *palette
- The image palette.
- char *image
- The image pixel data.
Photon
ApGetImageRes(),
PgDrawPhImagemx(),
PhMakeGhostBitmap(),
PhMakeTransBitmap(),
PhReleaseImage(),
PmMemCreateMC(),
PmMemFlush(),
PxLoadImage()