This wiki is out of date, use the continuation of this wiki instead

Rgb

From FenixWiki

Revision as of 00:49, 23 April 2007 by Sandman (Talk | contribs)
Jump to: navigation, search


Contents

Definition

WORD rgb ( <BYTE red> , <BYTE green> , <BYTE blue> )

Finds the single color in the current color mode closest to the combined red, green, and blue values specified.

Parameters

BYTE red - Level of red in the desired color from 0 to 255.
BYTE green - Level of green in the desired color from 0 to 255.
BYTE blue - Level of blue in the desired color from 0 to 255.

Returns

WORD : Returns the best matched color code.

Notes

Different color depths have different color codes, this is why rgb() is useful: it returns the appropriate code, based on the current color depth. When in 8bit mode, this code is 0..255 and when in 16bit mode 0..655535.

Example

Program awesome;
Global
    red=0;
    green=255;
    blue=0;

Begin
    
    set_text_color(rgb(red,green,blue)); // rgb finds the color closest to pure green and
                                         // passes it to set_text_color

    write(0,1,1,0,"Mijn potlood is bruin"); //this text will be green as an Irishman's ejecta
        
    Loop
  
        frame;
    End
End
Personal tools