PColour3i Class Reference

Detailed Description

The PColour3i class represents a Red-Green-Blue color (RGB), each channel encoded with one 32-bit int.

Definition at line 25 of file PColour3i.h.

#include <PColour3i.h>

Constructor & Destructor Documentation

◆ PColour3i() [1/4]

PColour3i::PColour3i ( papillon::uint32  colorRGB24)
explicit

Constructs a 3-channels RGB color, each channel encoded on 1 byte.

Colour is encoded as follows: 0x00RRGGBB.

◆ PColour3i() [2/4]

PColour3i::PColour3i ( papillon::int32  r = 0,
papillon::int32  g = 0,
papillon::int32  b = 0 
)
explicit

Constructs a 3-channels RGB color, black by default.

Values are automatically clamped if outside the range [0,255].

◆ PColour3i() [3/4]

PColour3i::PColour3i ( float  r,
float  g,
float  b 
)
explicit

Constructs a 3-channels RGB color from 3 floating point values.

Expected values in the range [0,1]. Values are automatically clamped if outside the range [0,1], then converted to be in the range [0,255].

◆ PColour3i() [4/4]

PColour3i::PColour3i ( const PString name)
explicit

Constructs a 3-channels RGB color from name (see https://www.w3.org/TR/SVG/types.html#ColorKeywords or use "\#RRGGBB")

The name must be one of these formats:

  • A name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium, see https://www.w3.org/TR/SVG/types.html#ColorKeywords; for example, "steelblue" or "gainsboro".
  • #RGB (each of R, G, and B is a single hex digit)
  • #RRGGBB
  • #RRRGGGBBB
  • #RRRRGGGGBBBB

If the name cannot be parsed, then this colour will be set to black.

◆ ~PColour3i()

virtual PColour3i::~PColour3i ( )
virtual

Destroys this object.

Member Function Documentation

◆ Aqua()

static const PColour3i& PColour3i::Aqua ( )
inlinestatic

Definition at line 109 of file PColour3i.h.

◆ Black()

static const PColour3i& PColour3i::Black ( )
inlinestatic

Definition at line 110 of file PColour3i.h.

◆ Blue()

static const PColour3i& PColour3i::Blue ( )
inlinestatic

Definition at line 111 of file PColour3i.h.

◆ Brown()

static const PColour3i& PColour3i::Brown ( )
inlinestatic

Definition at line 112 of file PColour3i.h.

◆ Clamp()

void PColour3i::Clamp ( )

Clamps all channels to be in the range [0,255].

◆ Coral()

static const PColour3i& PColour3i::Coral ( )
inlinestatic

Definition at line 113 of file PColour3i.h.

◆ Darkgray()

static const PColour3i& PColour3i::Darkgray ( )
inlinestatic

Definition at line 114 of file PColour3i.h.

◆ Fuschia()

static const PColour3i& PColour3i::Fuschia ( )
inlinestatic

Definition at line 115 of file PColour3i.h.

◆ GetB()

papillon::int32 PColour3i::GetB ( ) const

Returns the value of the blue component.

◆ GetG()

papillon::int32 PColour3i::GetG ( ) const

Returns the value of the green component.

◆ GetR()

papillon::int32 PColour3i::GetR ( ) const

Returns the value of the red component.

◆ Gray()

static const PColour3i& PColour3i::Gray ( )
inlinestatic

Definition at line 116 of file PColour3i.h.

◆ Green()

static const PColour3i& PColour3i::Green ( )
inlinestatic

Definition at line 117 of file PColour3i.h.

◆ Lightgray()

static const PColour3i& PColour3i::Lightgray ( )
inlinestatic

Definition at line 118 of file PColour3i.h.

◆ Lime()

static const PColour3i& PColour3i::Lime ( )
inlinestatic

Definition at line 119 of file PColour3i.h.

◆ Maroon()

static const PColour3i& PColour3i::Maroon ( )
inlinestatic

Definition at line 120 of file PColour3i.h.

◆ Navy()

static const PColour3i& PColour3i::Navy ( )
inlinestatic

Definition at line 121 of file PColour3i.h.

◆ Olive()

static const PColour3i& PColour3i::Olive ( )
inlinestatic

Definition at line 122 of file PColour3i.h.

◆ Orange()

static const PColour3i& PColour3i::Orange ( )
inlinestatic

Definition at line 123 of file PColour3i.h.

◆ Pink()

static const PColour3i& PColour3i::Pink ( )
inlinestatic

Definition at line 124 of file PColour3i.h.

◆ Purple()

static const PColour3i& PColour3i::Purple ( )
inlinestatic

Definition at line 125 of file PColour3i.h.

◆ Red()

static const PColour3i& PColour3i::Red ( )
inlinestatic

Definition at line 126 of file PColour3i.h.

◆ Set()

void PColour3i::Set ( papillon::int32  r,
papillon::int32  g,
papillon::int32  b 
)

Sets the RGB values.

◆ Silver()

static const PColour3i& PColour3i::Silver ( )
inlinestatic

Definition at line 127 of file PColour3i.h.

◆ Skyblue()

static const PColour3i& PColour3i::Skyblue ( )
inlinestatic

Definition at line 128 of file PColour3i.h.

◆ SwapRGB()

void PColour3i::SwapRGB ( )

Swaps Red and Blue channels.

◆ Tan()

static const PColour3i& PColour3i::Tan ( )
inlinestatic

Definition at line 129 of file PColour3i.h.

◆ Teal()

static const PColour3i& PColour3i::Teal ( )
inlinestatic

Definition at line 130 of file PColour3i.h.

◆ ToGrey()

papillon::int32 PColour3i::ToGrey ( ) const

Converts RGB values to greyscale.

◆ ToStringHTML()

PString PColour3i::ToStringHTML ( ) const

Returns this colour to HTML format, ie.

#rrggbb with rr, gg, bb hexadecimal numbers.

◆ White()

static const PColour3i& PColour3i::White ( )
inlinestatic

Definition at line 131 of file PColour3i.h.

◆ Yellow()

static const PColour3i& PColour3i::Yellow ( )
inlinestatic

Definition at line 132 of file PColour3i.h.

Member Data Documentation

◆ C_COLOUR_TABLE

const PColour3i PColour3i::C_COLOUR_TABLE[23]
static

Definition at line 135 of file PColour3i.h.