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
    * Game / Global functions

GetColorFromRGB

(Formerly known as RawSetColorRGB, which is now obsolete)

static int Game.GetColorFromRGB(int red, int green, int blue)
Gets the AGS Colour Number for the specified RGB colour. The red, green and blue components are values from 0 to 255. This function gives you a run-time equivalent to the Colour Finder in the editor.

This command is slow in 256-colour games, since the palette has to be scanned to find the nearest matching colour.

NOTE: This is a static function, and thus need to be called with Game. in front of it. See the example below.

Example:

DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawingColor = Game.GetColorFromRGB(0, 255, 0);
surface.DrawLine(0, 0, 50, 50);
surface.Release();
will draw a bright green line onto the room background

See Also: DrawingSurface.DrawingColor


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