[Previous] [Contents] [Index] [Next]

PiGetPixel()

Retrieve the value of a pixel within an image

Synopsis:

int PiGetPixel( PhImage_t const *image,
                ushort_t x,
                ushort_t y,
                ulong_t *value );

Library:

ph

Description:

This function retrieves the value of a pixel within an image.

The image argument is a pointer to a PhImage_t structure that defines the image to be queried, while the x and y arguments specify the coordinates of the pixel to be examined.

The value argument points to an area of memory where the result of the query is stored. The meaning of this value depends on the type of the image, as follows:

Pg_IMAGE_DIRECT_444, Pg_IMAGE_DIRECT_555, Pg_IMAGE_DIRECT_565, Pg_IMAGE_DIRECT_888, Pg_IMAGE_DIRECT_8888
A PgColor_t representing the pixel's color.
Pg_IMAGE_PALETTE_BYTE, Pg_IMAGE_PALETTE_NIBBLE
An index into the image's palette (0 - 255 for BYTE palettes, 0 - 15 for NIBBLE palettes).
Pg_IMAGE_GRADIENT_BYTE, Pg_IMAGE_GRADIENT_NIBBLE
A number representing the pixel's intensity (0 - 255 for BYTE gradients, 0 - 15 for NIBBLE gradients).
Pg_BITMAP_BACKFILL, Pg_BITMAP_TRANSPARENT
0 or 1 representing the pixel's state.

Returns:

0
Success.
-1
An error occurred because the the pixel was out of bounds or the image type wasn't recognized.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PhImage_t, PiGetPixelFromData(), PiGetPixelRGB(), PiSetPixel(), PiSetPixelInData()

"Images" in the Raw Drawing and Animation chapter of the Photon Programmer's Guide


[Previous] [Contents] [Index] [Next]