Lightweight Graphics

GGetPixel

Get the color of a pixel

Syntax

Signature
int GGetPixel( int y, int x );

Arguments

y, x give the pixel position, vertical coordinate first.

Return value

The color as 0xRRGGBB, or 0 outside the drawing area. Black also has the value 0.

Description

Reads a pixel from the window. It can read a pixel inside the window even when a clipping rectangle limits drawing to another region.

Example

ggetpixel.c
#include "xdev-wtui.h"

int main( void )
{
   GPutPixel( 10, 10, GMakeColor( 255, 0, 0 ) );
   QOutF( "Color: %06X", ( unsigned int )GGetPixel( 10, 10 ) );

   Inkey( 0, NIL );

   return 0;
}

See also