karbon

VColor Class Reference

#include <vcolor.h>

List of all members.


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.


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 QColor &color)
 operator QColor () 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 (QDomElement &element) const
void load (const QDomElement &element)

Member Enumeration Documentation

enum VColor::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::VColor VColorSpace  colorSpace = rgb  ) 
 

Constructs a new VColor with the specified colorspace.

Parameters:
colorSpace the colorspace of the new color

Definition at line 28 of file vcolor.cc.

VColor::VColor const VColor color  ) 
 

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

Parameters:
color the color to copy from

Definition at line 39 of file vcolor.cc.

VColor::VColor const QColor &  color  ) 
 

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

Parameters:
color the color to copy from

Definition at line 50 of file vcolor.cc.


Member Function Documentation

VColorSpace VColor::colorSpace  )  const [inline]
 

Returns the color's colorspace.

Returns:
the color's colorspace

Definition at line 145 of file vcolor.h.

void VColor::load const QDomElement &  element  ) 
 

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

Parameters:
element the DOM element from which the attributes are read

Definition at line 321 of file vcolor.cc.

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.

VColor::operator QColor  )  const
 

Cast operator to QColor.

Definition at line 60 of file vcolor.cc.

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

Index operator to access color components.

Parameters:
i the index of the color component to access
Returns:
the requested color component

Definition at line 83 of file vcolor.h.

void VColor::save QDomElement &  element  )  const
 

Save this color's state to xml.

Parameters:
element the DOM element to which the attributes are saved

Definition at line 297 of file vcolor.cc.

void VColor::set float  v1,
float  v2,
float  v3,
float  v4
[inline]
 

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

Parameters:
v1 the new value of the first color component
v2 the new value of the second color component
v3 the new value of the third color component
v4 the new value of the fourth color component

Definition at line 121 of file vcolor.h.

void VColor::set float  v1,
float  v2,
float  v3
[inline]
 

Sets the first, second and third color component.

Parameters:
v1 the new value of the first color component
v2 the new value of the second color component
v3 the new value of the third color component

Definition at line 110 of file vcolor.h.

void VColor::set float  v1,
float  v2
[inline]
 

Sets the first and second color component.

Parameters:
v1 the new value of the first color component
v2 the new value of the second color component

Definition at line 100 of file vcolor.h.

void VColor::set float  v1  )  [inline]
 

Sets the first color component.

Parameters:
v1 the new value of the first color component

Definition at line 91 of file vcolor.h.

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:
colorSpace the new colorspace
convert controls if color is converted into new colorspace

Definition at line 72 of file vcolor.cc.

void VColor::setOpacity float  opacity  )  [inline]
 

Sets the color opacity.

Parameters:
opacity the new color opacity.

Definition at line 138 of file vcolor.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys