|
PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
|
#include <PColor.h>
Public Member Functions | |
| PColor () | |
| Standard constructor of PColor. | |
| PColor (unsigned int color) | |
| Constructor. | |
| PColor (int red, int green, int blue, int alpha) | |
| Constructor. | |
| PColor (const std::string &colorname) | |
| Constructor. | |
| PColor (const PColor &pcolor) | |
| Constructor using RGBColorNames. | |
| virtual | ~PColor () |
| Copy constructor. | |
| virtual bool | SetProperty (std::string, Variant v) |
| Standard Destructor. | |
| virtual ObjectValidationError | ValidateProperty (std::string name, Variant v) const |
| virtual ObjectValidationError | ValidateProperty (std::string name) const |
| int | GetRed () const |
| int | GetGreen () const |
| int | GetBlue () const |
| int | GetAlpha () const |
| void | SetRed (int color) |
| void | SetGreen (int color) |
| void | SetBlue (int color) |
| void | SetAlpha (int color) |
| void | SetColorByRGBA (unsigned int color) |
| Sets color as a 32-bit unsigned int. | |
| void | SetColorByRGBA (int red, int green, int blue, int alpha) |
| Sets color as a 4 8-bit unsigned int. | |
| void | SetColorByName (const std::string &colorname) |
| Sets color as by its name. | |
| unsigned int | GetColor () const |
| Gets 32-bit unsigned int color. | |
| bool | HasChanged () const |
| Change detection for nested property modifications. | |
| void | ClearChanged () |
Public Member Functions inherited from PEBLObjectBase | |
| PEBLObjectBase () | |
| Standard Constructor. | |
| PEBLObjectBase (ComplexDataType cdt) | |
| Standard Constructor. | |
| PEBLObjectBase (const PEBLObjectBase &pob) | |
| virtual | ~PEBLObjectBase () |
| Standard Destructor. | |
| virtual bool | InitializeProperty (std::string name, Variant v) |
| Variant | GetProperty (std::string) const |
| ComplexDataType | GetType () |
| virtual std::ostream & | PrintProperties (std::ostream &out) |
| virtual Variant | GetPropertyList () |
Protected Member Functions | |
| virtual std::string | ObjectName () const |
| virtual std::ostream & | SendToStream (std::ostream &out) const |
| This sends the color descriptions to the specified stream. | |
Additional Inherited Members | |
Protected Attributes inherited from PEBLObjectBase | |
| ComplexDataType | mCDT |
| std::map< std::string, Variant > | mProperties |
This class represents color. Currently, only RGBA color is accessible. Access through other color spaces could be added.
| PColor::PColor | ( | ) |
Standard constructor of PColor.
Definition at line 44 of file PColor.cpp.
References GetAlpha(), GetBlue(), GetGreen(), GetRed(), and PEBLObjectBase::InitializeProperty().
| PColor::PColor | ( | unsigned int | color | ) |
Constructor.
Definition at line 62 of file PColor.cpp.
References SetColorByRGBA().
| PColor::PColor | ( | int | red, |
| int | green, | ||
| int | blue, | ||
| int | alpha | ||
| ) |
Constructor.
Convenience constructor of PColor:
Definition at line 70 of file PColor.cpp.
References GetAlpha(), GetBlue(), GetGreen(), GetRed(), and PEBLObjectBase::InitializeProperty().
| PColor::PColor | ( | const std::string & | colorname | ) |
Constructor.
| PColor::PColor | ( | const PColor & | pcolor | ) |
Constructor using RGBColorNames.
Copy constructor of PColor:
Definition at line 120 of file PColor.cpp.
References GetAlpha(), GetBlue(), GetGreen(), GetRed(), and PEBLObjectBase::InitializeProperty().
|
virtual |
|
inline |
Definition at line 79 of file PColor.h.
Referenced by PlatformFont::ClearChanged().
| int PColor::GetAlpha | ( | ) | const |
Definition at line 229 of file PColor.cpp.
Referenced by PlatformWindow::Draw(), SDLUtility::DrawLine(), SDLUtility::DrawPixel(), main(), PColor(), PColor(), PColor(), SDLUtility::PColorToSDLColor(), PlatformTextBox::RenderText(), PlatformCanvas::Reset(), SetAlpha(), PWidget::SetBackgroundColor(), PFont::SetBackgroundColor(), and PFont::SetFontColor().
| int PColor::GetBlue | ( | ) | const |
Definition at line 228 of file PColor.cpp.
Referenced by PlatformWindow::Draw(), SDLUtility::DrawLine(), SDLUtility::DrawPixel(), main(), PColor(), PColor(), PColor(), SDLUtility::PColorToSDLColor(), PlatformTextBox::RenderText(), PlatformCanvas::Reset(), PWidget::SetBackgroundColor(), PFont::SetBackgroundColor(), SetBlue(), and PFont::SetFontColor().
| unsigned int PColor::GetColor | ( | ) | const |
Gets 32-bit unsigned int color.
this is a bit clearer and easier to deal with cross-platform.
Definition at line 395 of file PColor.cpp.
Referenced by main(), and ObjectName().
| int PColor::GetGreen | ( | ) | const |
Definition at line 227 of file PColor.cpp.
Referenced by PlatformWindow::Draw(), SDLUtility::DrawLine(), SDLUtility::DrawPixel(), main(), PColor(), PColor(), PColor(), SDLUtility::PColorToSDLColor(), PlatformTextBox::RenderText(), PlatformCanvas::Reset(), PWidget::SetBackgroundColor(), PFont::SetBackgroundColor(), PFont::SetFontColor(), and SetGreen().
| int PColor::GetRed | ( | ) | const |
Definition at line 226 of file PColor.cpp.
Referenced by PlatformWindow::Draw(), SDLUtility::DrawLine(), SDLUtility::DrawPixel(), main(), PColor(), PColor(), PColor(), SDLUtility::PColorToSDLColor(), PlatformTextBox::RenderText(), PlatformCanvas::Reset(), PWidget::SetBackgroundColor(), PFont::SetBackgroundColor(), PFont::SetFontColor(), and SetRed().
|
inline |
Change detection for nested property modifications.
Definition at line 78 of file PColor.h.
Referenced by PlatformFont::HasChanged().
|
protectedvirtual |
Reimplemented from PEBLObjectBase.
Definition at line 412 of file PColor.cpp.
References GetColor(), and Variant::GetString().
Referenced by SendToStream().
|
protectedvirtual |
This sends the color descriptions to the specified stream.
Reimplemented from PEBLObjectBase.
Definition at line 406 of file PColor.cpp.
References ObjectName().
| void PColor::SetAlpha | ( | int | color | ) |
Definition at line 218 of file PColor.cpp.
References GetAlpha(), and PEBLObjectBase::SetProperty().
Referenced by main(), PWidget::SetBackgroundColor(), PFont::SetBackgroundColor(), PFont::SetFontColor(), and SetProperty().
| void PColor::SetBlue | ( | int | color | ) |
Definition at line 211 of file PColor.cpp.
References GetBlue(), and PEBLObjectBase::SetProperty().
Referenced by main(), PWidget::SetBackgroundColor(), PFont::SetBackgroundColor(), PFont::SetFontColor(), and SetProperty().
| void PColor::SetColorByName | ( | const std::string & | colorname | ) |
Sets color as by its name.
the RGBNames::Colornames is uppercase and sorted, so use a simple search to find the right one really fast.
Definition at line 257 of file PColor.cpp.
References RGBNames::PEBL_RGB_Color_Names::b, RGBNames::ColorNames, RGBNames::PEBL_RGB_Color_Names::g, RGBNames::PEBL_RGB_Color_Names::name, RGBNames::NumRGBColorNames, RGBNames::PEBL_RGB_Color_Names::r, PError::SignalWarning(), and PEBLUtility::ToUpper().
Referenced by main().
| void PColor::SetColorByRGBA | ( | int | red, |
| int | green, | ||
| int | blue, | ||
| int | alpha | ||
| ) |
Sets color as a 4 8-bit unsigned int.
Convenience constructor of PColor:
Definition at line 247 of file PColor.cpp.
| void PColor::SetColorByRGBA | ( | unsigned int | color | ) |
Sets color as a 32-bit unsigned int.
This uses modular arithmetic to extract colors from unsigned int. There could be more efficient ways to do it, but this is clear, and More likely to work cross-platform.
Definition at line 235 of file PColor.cpp.
| void PColor::SetGreen | ( | int | color | ) |
Definition at line 204 of file PColor.cpp.
References GetGreen(), and PEBLObjectBase::SetProperty().
Referenced by main(), PWidget::SetBackgroundColor(), PFont::SetBackgroundColor(), PFont::SetFontColor(), and SetProperty().
|
virtual |
Standard Destructor.
Reimplemented from PEBLObjectBase.
Definition at line 153 of file PColor.cpp.
References SetAlpha(), SetBlue(), SetGreen(), and SetRed().
| void PColor::SetRed | ( | int | color | ) |
Definition at line 197 of file PColor.cpp.
References GetRed(), and PEBLObjectBase::SetProperty().
Referenced by main(), PWidget::SetBackgroundColor(), PFont::SetBackgroundColor(), PFont::SetFontColor(), and SetProperty().
|
virtual |
Reimplemented from PEBLObjectBase.
Definition at line 177 of file PColor.cpp.
References PEBLObjectBase::ValidateProperty().
|
virtual |
Reimplemented from PEBLObjectBase.
Definition at line 167 of file PColor.cpp.
References Variant::IsNumber(), OVE_INVALID_PROPERTY_NAME, OVE_INVALID_PROPERTY_TYPE, OVE_INVALID_PROPERTY_VALUE, OVE_SUCCESS, and ValidateProperty().
Referenced by ValidateProperty().