You may return to the Cvo Object Documenation Index from this document. This document contains the following sections describing the Cvo_Color object:
Cvo_Color
#include
<Cvo/Color.h++>
Cvo_Color c( )
Cvo_Color c( Cvo_Color cvo_color )
Cvo_Color c( Cvo_BasicObject *object,
char *color,
[ int background ] )
Cvo_Color c( Cvo_BasicObject *object
double hue,
double lightness,
double saturation,
[ int background ] )
Cvo_Color c( Cvo_BasicObject *object
XColor xc,
[ int background ] )
The Cvo_Color object is used to store colors in Cvo. A color can be created in several ways, as shown above. When a color is created with no arguments it starts in the empty state, which means none of its member functions will actually work. Typically it is created with either a set of the arguments shown above, or it is assigned the value of another Cvo_Color object. In all the above creations, the optional argument background is used to determine what color should be used if the color is not found. If background is set to a non-zero value, the default background color is returned if the color cannot be allocated. If it is not specified, or is 0, the default foreground color is returned if the color cannot be allocated.
If cvo_color is given, it is copied to this Cvo_Color object.
If the string color is given, then a lookup is done for that color in the RGB database. The color name can be any valid X11 color name.
If hue, lightness and saturation are passed, a color is allocated according to those values. Hue ranges from 0.0 to 360.0, lightness and saturation range from 0 to 1.0.
If xc is given then the RGB values from xc are used to allocate the color.
This object generally should not be created as a pointer. See below.
This object defines the following member functions.
The Cvo_Color object is a smart pointer. This means that the object
actually indirectly accesses the data associated with it. This allows
for many Cvo_Color objects to actually refer to the same color/pixel
value. Due to this, the Cvo_Color object has a somewhat unique method
of accessing most of its member functions. All the functions listed
below assume the name of the Color object is c
. Note that c
is not a pointer to a Cvo_Color object but the color object
itself.
BOOL c.Empty (
)
BOOL c.Full (
)
These functions return True
or False
, indicating whether or
not the color has been allocated. If the color has been allocated,
then the following member functions will return valid values.
Cvo_Color c->Grayed (
)
Return the version of c
which is grayed out.
Cvo_Color c->Upper (
)
Return the Cvo_Color used for an upper chamfer when c
is the
background.
Cvo_Color c->Lower (
)
Return the Cvo_Color used for a lower chamfer when c
is the
background.
Cvo_Color c->Select (
)
Return the Cvo_Color used for a selected background when c
is
the normal background.
Cvo_Color c->Raised (
)
Return the Cvo_Color used for a normal background when c
is
the selected background.
double c->Hue (
)
double c->Lightness (
)
double c->Saturation (
)
Return the hue, lightness or saturation for the color c
.
int c->Level (
)
Return a darkness level between 0 and 16, inclusive. This is most useful on monochrome displays.
BOOL c->UsePixmap (
)
Return True
if the color requires a pixmap (typically only true
on monochrome displays)
CARD32 c->Pixel (
)
Return the pixel used to draw this color.
Pixmap c->GetPixmap (
[ int bitmap ] )
Return the Pixmap for this color, if any. If bitmap is specified and non-zero then the Pixmap returned will have depth one, else it will have the same depth as the display.
BOOL c->Monochrome (
)
Return True
if this color is for use on a monochome display.
XColor c->xcolor (
)
Return the RGB values for c
in an XColor structure.
See the example source code for an example of how to use this object.
See the legend for information about the conventions used in this documentation.