spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * DrawingSurface functions and properties

GetPixel

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


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.