karbon

#include <vcolor.h>

Public Types

enum  VColorSpace { rgb = 0 , cmyk = 1 , hsb = 2 , gray = 3 }
 

Public Member Functions

 VColor (VColorSpace colorSpace=rgb)
 
 VColor (const VColor &color)
 
 VColor (const TQColor &color)
 
 operator TQColor () const
 
float operator[] (unsigned i) const
 
void set (float v1)
 
void set (float v1, float v2)
 
void set (float v1, float v2, float v3)
 
void set (float v1, float v2, float v3, float v4)
 
float opacity () const
 
void setOpacity (float opacity)
 
VColorSpace colorSpace () const
 
void setColorSpace (const VColorSpace colorSpace, bool convert=true)
 
void save (TQDomElement &element) const
 
void load (const TQDomElement &element)
 

Detailed Description

This class keeps track of color properties.

The actual color values can be represented in rgb and hsv color spaces. Also each color has a related opacity value.

Default is opaque, rgb, black color.

Definition at line 40 of file vcolor.h.

Member Enumeration Documentation

◆ VColorSpace

Enumerator
rgb 

the RGB colorspace (red, green and blue components)

cmyk 

the CMYK colorspace (cyan, magenta, yellow and black components)

hsb 

the HSB colorspace (hue, saturation and brightnes components)

gray 

the Gray colorspace (gray from black to white)

Definition at line 43 of file vcolor.h.

Constructor & Destructor Documentation

◆ VColor() [1/3]

VColor::VColor ( VColorSpace  colorSpace = rgb)

Constructs a new VColor with the specified colorspace.

Parameters
colorSpacethe colorspace of the new color

Definition at line 28 of file vcolor.cpp.

◆ VColor() [2/3]

VColor::VColor ( const VColor &  color)

Constructs a new VColor by copying data from the specified VColor.

Parameters
colorthe color to copy from

Definition at line 39 of file vcolor.cpp.

◆ VColor() [3/3]

VColor::VColor ( const TQColor &  color)

Constructs a new VColor by copying data from the specified TQColor.

Parameters
colorthe color to copy from

Definition at line 50 of file vcolor.cpp.

Member Function Documentation

◆ colorSpace()

VColorSpace VColor::colorSpace ( ) const
inline

Returns the color's colorspace.

Returns
the color's colorspace

Definition at line 145 of file vcolor.h.

◆ load()

void VColor::load ( const TQDomElement &  element)

Load this color's state from xml and initialize it accordingly.

Parameters
elementthe DOM element from which the attributes are read

Definition at line 321 of file vcolor.cpp.

◆ opacity()

float VColor::opacity ( ) const
inline

Returns the color opacity.

Opacity is a value ranging from 0.0 (fully transparent) to 1.0 (opaque).

Returns
the color opacity

Definition at line 131 of file vcolor.h.

◆ operator TQColor()

VColor::operator TQColor ( ) const

Cast operator to TQColor.

Definition at line 60 of file vcolor.cpp.

◆ operator[]()

float VColor::operator[] ( unsigned  i) const
inline

Index operator to access color components.

Parameters
ithe index of the color component to access
Returns
the requested color component

Definition at line 83 of file vcolor.h.

◆ save()

void VColor::save ( TQDomElement &  element) const

Save this color's state to xml.

Parameters
elementthe DOM element to which the attributes are saved

Definition at line 297 of file vcolor.cpp.

◆ set() [1/4]

void VColor::set ( float  v1)
inline

Sets the first color component.

Parameters
v1the new value of the first color component

Definition at line 91 of file vcolor.h.

◆ set() [2/4]

void VColor::set ( float  v1,
float  v2 
)
inline

Sets the first and second color component.

Parameters
v1the new value of the first color component
v2the new value of the second color component

Definition at line 100 of file vcolor.h.

◆ set() [3/4]

void VColor::set ( float  v1,
float  v2,
float  v3 
)
inline

Sets the first, second and third color component.

Parameters
v1the new value of the first color component
v2the new value of the second color component
v3the new value of the third color component

Definition at line 110 of file vcolor.h.

◆ set() [4/4]

void VColor::set ( float  v1,
float  v2,
float  v3,
float  v4 
)
inline

Sets the first, second, third and fourth color component.

Parameters
v1the new value of the first color component
v2the new value of the second color component
v3the new value of the third color component
v4the new value of the fourth color component

Definition at line 121 of file vcolor.h.

◆ setColorSpace()

void VColor::setColorSpace ( const VColorSpace  colorSpace,
bool  convert = true 
)

Sets the color's colorspace.

The color is converted into the new colorspace by setting convert = true.

Parameters
colorSpacethe new colorspace
convertcontrols if color is converted into new colorspace

Definition at line 72 of file vcolor.cpp.

◆ setOpacity()

void VColor::setOpacity ( float  opacity)
inline

Sets the color opacity.

Parameters
opacitythe new color opacity.

Definition at line 138 of file vcolor.h.


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