PColour3i.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 
18 PAPILLON_BEGIN_NAMESPACE
19 
25 class PAPILLON_API_CORE PColour3i : public PObject
26 {
27 public:
28 
33  explicit PColour3i(papillon::uint32 colorRGB24);
34 
39  explicit PColour3i(papillon::int32 r = 0, papillon::int32 g = 0, papillon::int32 b = 0);
40 
47  explicit PColour3i(float r, float g, float b);
48 
62  explicit PColour3i(const PString& name);
63 
67  virtual ~PColour3i();
68 
72  papillon::int32 GetR() const;
73 
77  papillon::int32 GetG() const;
78 
82  papillon::int32 GetB() const;
83 
87  void Set(papillon::int32 r, papillon::int32 g, papillon::int32 b);
88 
92  papillon::int32 ToGrey() const;
93 
97  void SwapRGB();
98 
102  void Clamp();
103 
107  PString ToStringHTML() const;
108 
109  static const PColour3i& Aqua () { static const PColour3i C(papillon::uint32(0x00FFFF)); return C; }
110  static const PColour3i& Black () { static const PColour3i C(papillon::uint32(0x000000)); return C; }
111  static const PColour3i& Blue () { static const PColour3i C(papillon::uint32(0x0000FF)); return C; }
112  static const PColour3i& Brown () { static const PColour3i C(papillon::uint32(0xA52A2A)); return C; }
113  static const PColour3i& Coral () { static const PColour3i C(papillon::uint32(0xFF7F50)); return C; }
114  static const PColour3i& Darkgray () { static const PColour3i C(papillon::uint32(0x404040)); return C; }
115  static const PColour3i& Fuschia () { static const PColour3i C(papillon::uint32(0xFF00FF)); return C; }
116  static const PColour3i& Gray () { static const PColour3i C(papillon::uint32(0x808080)); return C; }
117  static const PColour3i& Green () { static const PColour3i C(papillon::uint32(0x008000)); return C; }
118  static const PColour3i& Lightgray() { static const PColour3i C(papillon::uint32(0xD3D3D3)); return C; }
119  static const PColour3i& Lime () { static const PColour3i C(papillon::uint32(0x00FF00)); return C; }
120  static const PColour3i& Maroon () { static const PColour3i C(papillon::uint32(0x800000)); return C; }
121  static const PColour3i& Navy () { static const PColour3i C(papillon::uint32(0x000080)); return C; }
122  static const PColour3i& Olive () { static const PColour3i C(papillon::uint32(0x808000)); return C; }
123  static const PColour3i& Orange () { static const PColour3i C(papillon::uint32(0xFFA500)); return C; }
124  static const PColour3i& Pink () { static const PColour3i C(papillon::uint32(0xFF5189)); return C; }
125  static const PColour3i& Purple () { static const PColour3i C(papillon::uint32(0x800080)); return C; }
126  static const PColour3i& Red () { static const PColour3i C(papillon::uint32(0xFF0000)); return C; }
127  static const PColour3i& Silver () { static const PColour3i C(papillon::uint32(0xC0C0C0)); return C; }
128  static const PColour3i& Skyblue () { static const PColour3i C(papillon::uint32(0x87CEEB)); return C; }
129  static const PColour3i& Tan () { static const PColour3i C(papillon::uint32(0xD2B48C)); return C; }
130  static const PColour3i& Teal () { static const PColour3i C(papillon::uint32(0x008080)); return C; }
131  static const PColour3i& White () { static const PColour3i C(papillon::uint32(0xFFFFFF)); return C; }
132  static const PColour3i& Yellow () { static const PColour3i C(papillon::uint32(0xFFFF00)); return C; }
133 
134  // Table of all colours except the black one.
135  static const PColour3i C_COLOUR_TABLE[23];
136 };
137 
138 PAPILLON_END_NAMESPACE
139 
static const PColour3i & Silver()
Definition: PColour3i.h:127
static const PColour3i & Lime()
Definition: PColour3i.h:119
static const PColour3i & Blue()
Definition: PColour3i.h:111
The PString class provides an Unicode character strings.
Definition: PString.h:37
static const PColour3i & Pink()
Definition: PColour3i.h:124
static const PColour3i & Skyblue()
Definition: PColour3i.h:128
static const PColour3i & Teal()
Definition: PColour3i.h:130
static const PColour3i & Green()
Definition: PColour3i.h:117
static const PColour3i & Red()
Definition: PColour3i.h:126
static const PColour3i & Gray()
Definition: PColour3i.h:116
static const PColour3i & Fuschia()
Definition: PColour3i.h:115
static const PColour3i & Yellow()
Definition: PColour3i.h:132
static const PColour3i & Black()
Definition: PColour3i.h:110
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
static const PColour3i & Olive()
Definition: PColour3i.h:122
static const PColour3i & Purple()
Definition: PColour3i.h:125
static const PColour3i & Coral()
Definition: PColour3i.h:113
The PColour3i class represents a Red-Green-Blue color (RGB), each channel encoded with one 32-bit int...
Definition: PColour3i.h:25
static const PColour3i & White()
Definition: PColour3i.h:131
static const PColour3i & Navy()
Definition: PColour3i.h:121
Class PObject: the root class of all Papillon classes.
static const PColour3i & Orange()
Definition: PColour3i.h:123
static const PColour3i & Lightgray()
Definition: PColour3i.h:118
static const PColour3i & Tan()
Definition: PColour3i.h:129
static const PColour3i & Darkgray()
Definition: PColour3i.h:114
static const PColour3i & Brown()
Definition: PColour3i.h:112
static const PColour3i & Aqua()
Definition: PColour3i.h:109
static const PColour3i & Maroon()
Definition: PColour3i.h:120