int CanvasGetPixel (int panelHandle, int controlID, Point pixelPoint, int *pixelColor);
Obtains the color of a single pixel on a canvas control.
![]() |
Note The canvas control maintains an internal bitmap reflecting all of the drawing operations (except for drawing operations made while the ATTR_DRAW_POLICY attribute is VAL_DIRECT_TO_SCREEN). Sometimes the internal bitmap contains the result of recent drawing operations that have not yet been reflected on the screen. CanvasGetPixel obtains the pixel colors from the internal bitmap, not from the screen. |
Input | ||
Name | Type | Description |
panelHandle | integer | Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel. |
controlID | integer | The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl. |
pixelPoint | Point | Point structure that indicates the location of a pixel. The location is in terms of unscaled pixel coordinates. The origin (0,0) is the upper left corner of the canvas control. The Point structure is defined as follows. typedef struct { int x; int y; } Point; You can create a Point without having to declare a variable by using the following function: Point MakePoint (int x, int y); ExampleCanvasGetPixel (panelHandle, controlID, MakePoint (20, 30), &pixelColor); |
Output | ||
Name | Type | Description |
pixelColor | integer | RGB color value of the pixel at the specified point. |
Name | Type | Description | ||||
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
|