WinXDraw_GetImageChannel


WinXDraw_GetImageChannel (hImage, channel, UBYTE @data[])

Retreives the channel data for an image channel

Parameter Description
hImage The handle to the image to get the channel data for
channel The id of the channel, see remarks for more info
UBYTE @data[] The array to store the channel data, this will be appropriately dimensioned by the function

Returns

$$TRUE on success or $$FALSE on fail

Remarks

The channel parameter can be any one of :

$$CHANNEL_RED
The red channel
$$CHANNEL_GREEN
The green channel
$$CHANNEL_BLUE
The blue channel
$$CHANNEL_ALPHA
The alpha (transparency) channel

Note that the data[] array is single dimensional, in row order, and with the last scanline at the top of the array. This orgainisation is a little wierd. It is to do with the way Windows stores and renders bitmaps.

Examples

'Declare the data array
UBYTE data[]

...

'invert the red channel
WinXDraw_GetImageChannel (hImage, $$CHANNEL_RED, @data[])
FOR i = 0 TO UBOUND(data[])
  data[i] = 255-data[i]
NEXT
WinXDraw_SetImageChannel (hImage, $$CHANNEL_RED, @data[])

Related Links

Images
WinXDraw_LoadImage
WinXDraw_SetImageChannel
WinXDraw_GetImageInfo