BRender Technical Reference Manual:4 Data Structures (Alphabetical Reference):br_colour
Next|Prev|Up
The Integral Type
Arithmetic
Comparison
Conversion
Copy/Assign

br_colour


The Integral Type

BRender's native 32 bit colour representation. Red, Green and Blue each have 8 bits, leaving a further 8 bits for an optional alpha value (typically representing opacity).

Blue occupies bits 0 to 7, Green occupies bits 8 to 15, Red occupies bits 16 to 23, and Alpha occupies bits 24 to 31.

Note that in some situations, a colour of zero is considered transparent (See br_material151 and br_pixelmap272).

The typedef

(See colour.h for precise declaration and ordering)

unsigned long int br_colour Packed RGBA values

Arithmetic

Binary operations (And &, Or |, Not ~, XOr ^) may sometimes be useful. However, all operands should still be colours, and if necessary, constructed using BR_COLOUR_RGB().

Comparison

Only equality comparisons are valid between colours.

Conversion

From individual component values

BR_COLOUR_RGB(r,g,b)
Returns a br_colour111 given three 8-bit colour components.

BR_COLOUR_RGBA(r,g,b,a)
Returns a br_colour111 given three 8-bit colour components and an 8-bit alpha component.

To component values

BR_RED(c)
Returns the Red component of a colour (0..255).

BR_GRN(c)
Returns the Green component of a colour (0..255).

BR_BLU(c)
Returns the Blue component of a colour (0..255).

BR_ALPHA(c)
Returns the Alpha component of a colour (0..255).

Copy/Assign

Only assign colours.


Generated with
CERN WebMaker