int DrawingSurface.GetPixel(int x, int y)
Returns the AGS Colour Number of the pixel at (X,Y) on the surface.
NOTE: In high-colour games, the first 32 colour numbers have a special meaning
due to an AGS feature which maintains compatibility with 8-bit games. Therefore, if
you draw onto the surface using a blue colour number 0-31 you will get a different number
when you GetPixel -- and in fact the colour drawn may not be what you expect.
To get around this, add 1 Red or Green component to adjust the colour number out of this range.
NOTE: This command is relatively slow. Don't use it to try and process an entire image.
Example:
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
Display("The colour of the middle pixel is %d.", surface.GetPixel(160, 100));
surface.Release();
displays the pixel colour of the centre pixel on the screen.
Compatibility: Supported by AGS 3.0.1 and later versions.
See Also: DrawingSurface.DrawingColor,
DrawingSurface.DrawPixel,
DrawingSurface.UseHighResCoordinates
|