Name
GetImage -- get raw pixel image data (V5.0)
Synopsis
ULONG *raw = GetImage(APTR handle, struct LoadImageCtrl *ctrl);
Function
This function must return the image's raw pixel data and some information about it.

Note that the ULONG* return type is just for compatibility reasons. The actual format of the pixel data that GetImage() needs to return depends on whether the HWIMGFLAGS_LOADPALETTE flag was set when LoadImage() was called. If it was set, GetImage() needs to return 8-bit pen values (even if the bit depth of the image is less than 8-bit!). If HWIMGFLAGS_LOADPALETTE wasn't set, GetImage() needs to return 32-bit ARGB values.

If the image type is HWIMAGETYPE_VECTOR, GetImage() also needs to take possible transformations that have been applied via TransformImage() into account.

Furthermore, GetImage() has to provide some additional information in the struct LoadImageCtrl pointer that is passed as the second parameter. See LoadImage for details on this structure. The following information has to be provided by GetImage():

Width:
Must be set to the image width in pixels. If the image type is HWIMAGETYPE_VECTOR and TransformImage() has been called prior to GetImage(), this value must exactly match the width that has been passed to the last call of TransformImage().

Height:
Must be set to the image height in pixels. If the image type is HWIMAGETYPE_VECTOR and TransformImage() has been called prior to GetImage(), this value must exactly match the height that has been passed to the last call of TransformImage().

LineWidth:
Must be set to the image modulo width in pixels. This is often the same as the image width.

AlphaChannel:
Must be set to True or False, depending on whether or not this image has an alpha channel.

Depth:
Must be set to the image's bit depth. (V9.0)

Palette:
If HWIMGFLAGS_LOADPALETTE was set when LoadImage() was called, you need to set this member to a pointer to a palette, stored as a ULONG array of 256 RGB colors. Note that the ULONG array must always have 256 entries, even if the bit depth is less than 8. Initialize unused palette entries to 0. (V9.0)

The pointer that is returned by GetImage() must stay valid at least until the next call to GetImage() or FreeImage() on this handle.

Inputs
handle
image handle as returned by LoadImage()
ctrl
pointer to a struct LoadImageCtrl for storing information about the image
Results
raw
an array of raw pixel data

Show TOC