App::Color Class Reference

Color class. More...

#include <Material.h>

Public Member Functions

std::string asCSSString () const
 
std::string asHexString () const
 returns color as hex color "#RRGGBB" More...
 
template<typename T >
asValue () const
 returns a template type e.g. More...
 
 Color (const Color &c)
 Copy constructor. More...
 
 Color (float R=0.0, float G=0.0, float B=0.0, float A=0.0)
 Defines the color as (R,G,B,A) whereas all values are in the range [0,1]. More...
 
 Color (uint32_t rgba)
 Does basically the same as the constructor above unless that (R,G,B,A) is encoded as an unsigned int. More...
 
bool fromHexString (const std::string &hex)
 gets color from hex color "#RRGGBB" More...
 
uint32_t getPackedValue () const
 Returns color as a 32 bit packed unsigned int in the form 0xRRGGBBAA. More...
 
bool operator!= (const Color &c) const
 
Coloroperator= (const Color &c)
 
bool operator== (const Color &c) const
 Returns true if both colors are equal. More...
 
void set (float R, float G, float B, float A=0.0)
 Defines the color as (R,G,B,A) whereas all values are in the range [0,1]. More...
 
ColorsetPackedValue (uint32_t rgba)
 Sets the color value as a 32 bit combined red/green/blue/alpha value. More...
 
template<typename T >
void setValue (const T &q)
 creates FC Color from template type, e.g. More...
 

Public Attributes

float a
 
float b
 
float g
 
float r
 color values, public accessible More...
 

Detailed Description

Color class.

Constructor & Destructor Documentation

◆ Color() [1/3]

App::Color::Color ( float  R = 0.0,
float  G = 0.0,
float  B = 0.0,
float  A = 0.0 
)
explicit

Defines the color as (R,G,B,A) whereas all values are in the range [0,1].

A defines the transparency.

◆ Color() [2/3]

App::Color::Color ( uint32_t  rgba)

Does basically the same as the constructor above unless that (R,G,B,A) is encoded as an unsigned int.

◆ Color() [3/3]

App::Color::Color ( const Color c)

Copy constructor.

Member Function Documentation

◆ asCSSString()

◆ asHexString()

◆ asValue()

◆ fromHexString()

bool App::Color::fromHexString ( const std::string &  hex)

◆ getPackedValue()

uint32_t App::Color::getPackedValue ( ) const

Returns color as a 32 bit packed unsigned int in the form 0xRRGGBBAA.

See also
setPackedValue().

Referenced by App::ColorLegend::getPackedColor(), MeshGui::ViewProviderMesh::ViewProviderMesh(), and MeshGui::ViewProviderMeshNode::ViewProviderMeshNode().

◆ operator!=()

bool App::Color::operator!= ( const Color c) const

◆ operator=()

Color & App::Color::operator= ( const Color c)

References r.

◆ operator==()

bool App::Color::operator== ( const Color c) const

Returns true if both colors are equal.

Therefore all components must be equal.

◆ set()

void App::Color::set ( float  R,
float  G,
float  B,
float  A = 0.0 
)

Defines the color as (R,G,B,A) whereas all values are in the range [0,1].

A defines the transparency, 0 means complete opaque and 1 invisible.

Referenced by draftguitools.gui_trackers.editTracker::move(), PartGui::ViewProviderPartExt::ViewProviderPartExt(), and PartGui::ViewProviderPartReference::ViewProviderPartReference().

◆ setPackedValue()

◆ setValue()

Member Data Documentation

◆ a

◆ b

◆ g

◆ r


The documentation for this class was generated from the following file: