This function returns a pointer to the pixel data stored for a pixel.
Declaration:
Copy Code | |
---|---|
LPAT_VOID ACCUAPI IG_pixel_data_pointer_get(HIGPIXEL hPixel); |
Arguments:
Name | Type | Description |
hPixel | HIGPIXEL | Handle of pixel object. |
Return Value:
N/A
Supported Raster Image Formats:
All pixel formats supported by ImageGear Professional.
Sample:
None
Example:
Copy Code | |
---|---|
AT_ERRCOUNT nErrcount; /* Number of errors on stack */ HIGEAR hImage; /* Handle of image */ HIGPIXEL hPix; /* Handle of pixel */ AT_INT ChannelCount; /* Number of channels in image */ AT_INT BitsPerChannel; /* Bits per channel in image */ LPAT_VOID lpPixData; /* Pixel data */ nErrcount = IG_load_file("test.jpg", &hImage); nErrcount = IG_image_channel_count_get(hImage, &ChannelCount); nErrcount = IG_image_bits_per_channel_get(hImage, &BitsPerChannel); /* Get the first pixel of an image */ nErrcount = IG_DIB_pix_get(hImage, 0, 0, &hPix); /* Set the bits in all of its channels to 1's */ lpPixData = IG_pixel_data_pointer_get(hPix); memset(lpPixData, 255, ChannelCount * (BitsPerChannel / 8)); /* Write the modified pixel data back to the image */ IG_DIB_pix_set(hImage, 0, 0, hPix); IG_pixel_delete(hPix); IG_image_delete(hImage); |
Remarks:
The number of accessible bytes can be calculated by multiplying the number of bits allocated per channel (8, 16, or 32) by the number of channels allocated, then dividing by 8.