Pixel property (Main Control)

Visual Basic example
Visual C++ 4.0 example

Visual J++ example

Syntax OLE_COLOR Pixel (float x, float y);

Overview:  Refer to Examining and Altering Bitmaps.

Remarks

Sets or gets the value of the specified pixel in the current bitmap.

The position is relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property, although the value is always that of a pixel.

The standard Windows values for COLORREF(OLE_COLOR) represent either red, green, and blue color values, or an index into the bitmap's palette. A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value. If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value.You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values. Please note that just because an image has a palette, that does not mean the value returned by this property is a palette index.

In the Document/Medical toolkits, the COLORREF value may represent a 16 bit grayscale value if the bBitmap is a 12 or 16-bit grayscale. So that the value is not confused with an RGB value, the COLORREF_GRAY16 mask (0x04000000) is set. In this case (0x0400YYYY), the lower 16 bits (0xYYYY) of the COLORREF value represent the 16-bit grayscale value. (0x0400FFFF is 16-bit white and 0x04000000is 16-bit black.) This is not a standard Windows value. Therefore, LEADTOOLS elements will recognize a COLORREF having this format, but Windows elements will not.

If a 12 or 16-bit grayscale bitmap contains a LUT (as is the case when loading a DICOM file), the Pixel property will get the corresponding LUT value. In this situation, the original 12 or 16-bit grayscale value can be obtained by using the PixelData property.

For information on converting from a 16-bit value, refer to Converting 16-bit Grayscale Values.

See Also

Topics:  Raster Images: Getting Current Information