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

Rgb

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:19, 22 April 2007 (edit)
Woody (Talk | contribs)

← Previous diff
Revision as of 00:49, 23 April 2007 (edit) (undo)
Sandman (Talk | contribs)

Next diff →
Line 4: Line 4:
==Definition== ==Definition==
-'''INT''' rgb ( <'''INT''' red> , <'''INT''' green> , <'''INT''' blue> )+'''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.+
 +Finds the single [[color]] in the current color mode closest to the combined red, green, and blue values specified.
== Parameters == == Parameters ==
{| {|
-| '''INT''' red || - Level of red in the desired color from 0 to 255.+| '''BYTE''' red || - Level of red in the desired color from 0 to 255.
|- |-
-| '''INT''' green || - Level of green in the desired color from 0 to 255.+| '''BYTE''' green || - Level of green in the desired color from 0 to 255.
|- |-
-| '''INT''' blue || - Level of blue in the desired color from 0 to 255.+| '''BYTE''' blue || - Level of blue in the desired color from 0 to 255.
|} |}
 +== Returns ==
-== Returns ==+'''WORD''' : Returns the best matched color code.
-'''INT''' : Returns the best matched color.+== 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 == == Example ==
Line 36: Line 37:
Begin Begin
- set_text_color(rgb(red,green,blue)); // rgb finds the color closest to pure green and passes it to set_text_color+ 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 write(0,1,1,0,"Mijn potlood is bruin"); //this text will be green as an Irishman's ejecta

Revision as of 00:49, 23 April 2007


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