|
RGB | |||||
ColourValue = RGB(Red, Green, Blue) | |||||
Parameters: Red = The Amount of RED in this colour. (0 to 255) Green = The Amount of GREEN in this colour. (0 to 255) Blue = The Amount of BLUE in this colour. (0 to 255) |
|||||
Returns: ColourValue = The RGB's levels mixed into a packed RGB colour value |
|||||
The RGB Function takes the three 8bit colour channel components (R)ed, (G)reen) and (B)lue and blends them together into a single colour value. These colour values can be used to set ink colour of text or other graphics operations. You can think of RGB as way of mixing the three components together. Where each Red,Green or Blue component has a valid ranging from zero to 255. Where Zero represents that this channelt is not present and 255 means this component is fully present (bright). We create colours by bending the three levels together. Examples: RED = RGB(255,0,0) GREEN = RGB(0,255,0) BLUE = RGB(0,0,255) PURPLE = RGB(255,0,255) BLACK = RGB(0,0,0) FACTS: * RGB colour level values are packed together into a single 32bit integer in the following hexadecimal form $--RRGGBB. Throughout the examples you'll most likely find programs that use both methods, and even some that use decimal values. For example, the following statements are all functionally identical. They're all passing the CLS command the a bright blue colour.
* The values the RGB command returns are just integer numbers. So if you remember a particular colour value, you can use the value directly when setting the colour of a graphics operation. It's common to use hex$ numbers when doing this, as each pair of HEX digits represents a channel. Literals * If you wish to return the A, R, G, or B values from a colour value, use the RGBR, RGBG & RGBB functions. * RGB returns a 32bit colour with the alpha channel bits set to zero. If you need those, use the ARGB() function instead. Mini Tutorial #1: This example creates a bunch of Named constants we could use as a list of colours. Therefore each constant is assigned an RGB()colour value.
This example would output.
Mini Tutorial #2: Emulating RGB function This examples shows how the RGB function megres the Red,Green & Blue leveles through into a single integer.
This example would output.
|
Related Info: | ARGB | Literals | RGBA | RGBB | RGBFade | RGBG | RGBR | RndRGB : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |