gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
ColourLineSpec Class Reference

encapsulates a method to specify colour and line or point plotting This class tries to encapsulate octave style colours and line type specification. See ColourLineSpec::ColourLineSpec for a description More...

#include <ColourLineSpec.H>

Inheritance diagram for ColourLineSpec:
[legend]
Collaboration diagram for ColourLineSpec:
[legend]

Public Member Functions

 ColourLineSpec (void)
 default constructor with blue colour Initiates the defaul blue line type of size 1 More...
 
 ColourLineSpec (const char *clsChar)
 use a octave like string to define the line/points or colour Speciy whether to use points or lines and the colour. For example, "r" means, plot red with lines, ":k" means plot black in points. Also you can specify size, eg : ":r10" means points, red, size 10 More...
 
bool wasSizeSpecified (void)
 
bool wasColourSpecified (void)
 
void setSize (int s)
 
void setSize (float s)
 
float getSize (void) const
 
void setColour (GdkColor c)
 
void setColour (const char *c)
 
GdkColor getColour (void)
 
gchar * getColourString (void)
 
void setColourAndLinesOrPoints (const char *clsChar)
 interprets the octave style line/colour spec. By default implements lines specify points using the ':' character. Understands the default octave colours. More...
 
ColourLineSpecoperator= (string &c)
 
ColourLineSpecoperator= (const char *c)
 
ColourLineSpecoperator>> (cairo_t *cr)
 
ColourLineSpec setRGBA (cairo_t *cr, double alpha)
 

Static Public Member Functions

static const char ** getColourLabels (void)
 
static const char * getColour (uint i)
 

Public Attributes

vector< string > shortColours
 User specified colours in character notation : More...
 
vector< string > X11Colours
 User specified colour strings : More...
 
bool linePlot
 The indication for lines or points plotting. More...
 

Private Attributes

bool sizeNotSpecified
 Set to true if the size was not specified ... i.e. "r" for red with no size. More...
 
bool colourNotSpecified
 Set to true if the colour was not specified ... i.e. "12" for size 12 with no colour. More...
 
float size
 The size of the line or point. More...
 
GdkColor colour
 The colour holder. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from StandardColours< 0 >
static int colourCntPrivate
 The number of colours defined in the following char ** variables. More...
 
static const char * shortColoursPrivate []
 Default octave colours which match ColourLineSpec::X11ColoursPrivate. More...
 
static const char * X11ColoursPrivate []
 Default X11 colours to match ColourLineSpec::shortColoursPrivate. More...
 

Detailed Description

encapsulates a method to specify colour and line or point plotting This class tries to encapsulate octave style colours and line type specification. See ColourLineSpec::ColourLineSpec for a description

This class allows you to specify plot specifications like so : "c1" for a cyan plot of line width 1. Or "y2:" for a yellow dotted plot of size 2. i.e. : plot(x,y,x.size(),"y2");

NOTE: in the future there are plans to allow the user to specify their own colours.

Examples:
CairoBoxTest.C, CairoCircleTest.C, MessageDialogTest.C, PangoTest.C, and PlotTest2.C.

Definition at line 61 of file ColourLineSpec.H.

Constructor & Destructor Documentation

◆ ColourLineSpec() [1/2]

ColourLineSpec::ColourLineSpec ( void  )
inline

default constructor with blue colour Initiates the defaul blue line type of size 1

Definition at line 81 of file ColourLineSpec.H.

◆ ColourLineSpec() [2/2]

ColourLineSpec::ColourLineSpec ( const char *  clsChar)
inline

use a octave like string to define the line/points or colour Speciy whether to use points or lines and the colour. For example, "r" means, plot red with lines, ":k" means plot black in points. Also you can specify size, eg : ":r10" means points, red, size 10

Definition at line 90 of file ColourLineSpec.H.

Member Function Documentation

◆ getColour() [1/2]

GdkColor ColourLineSpec::getColour ( void  )
inline

Request the colour

Returns
the Gdk color

Definition at line 173 of file ColourLineSpec.H.

Here is the caller graph for this function:

◆ getColour() [2/2]

static const char* ColourLineSpec::getColour ( uint  i)
inlinestatic

Given an integer, find the matching short colour name. If the number given is larger then the number of available colours, then find the modulus and return that colour.

Parameters
iThe desired colour index into shortColoursPrivate.
Returns
A shortColoursPrivate char array pointer which is indexed by i, and if i > colourCntPrivate, then find the index from the modulus [icolourCntPrivate].

Definition at line 274 of file ColourLineSpec.H.

◆ getColourLabels()

static const char** ColourLineSpec::getColourLabels ( void  )
inlinestatic

Get the pointer to the short colour names.

Returns
A pointer to shortColoursPrivate.

Definition at line 266 of file ColourLineSpec.H.

◆ getColourString()

gchar* ColourLineSpec::getColourString ( void  )
inline

Request the colour string

Returns
the Gdk colour as a newly allocated string

Definition at line 181 of file ColourLineSpec.H.

Here is the caller graph for this function:

◆ getSize()

float ColourLineSpec::getSize ( void  ) const
inline

Request the size

Returns
the size

Definition at line 139 of file ColourLineSpec.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

ColourLineSpec& ColourLineSpec::operator= ( string &  c)
inline

Definition at line 247 of file ColourLineSpec.H.

◆ operator=() [2/2]

ColourLineSpec& ColourLineSpec::operator= ( const char *  c)
inline

Definition at line 255 of file ColourLineSpec.H.

◆ operator>>()

ColourLineSpec& ColourLineSpec::operator>> ( cairo_t *  cr)
inline

Sets the cairo drawing colour and width.

Parameters
crThe cairo context to set the colour and width in.
Returns
A reference to this class.

Definition at line 282 of file ColourLineSpec.H.

◆ setColour() [1/2]

void ColourLineSpec::setColour ( GdkColor  c)
inline

Manually specify the colour

Parameters
cthe GtkColor

Definition at line 149 of file ColourLineSpec.H.

◆ setColour() [2/2]

void ColourLineSpec::setColour ( const char *  c)
inline

Manually specify the colour

Parameters
cthe char* color (could be something like "red" or "#b2b2b2")

Definition at line 158 of file ColourLineSpec.H.

◆ setColourAndLinesOrPoints()

void ColourLineSpec::setColourAndLinesOrPoints ( const char *  clsChar)
inline

interprets the octave style line/colour spec. By default implements lines specify points using the ':' character. Understands the default octave colours.

Definition at line 194 of file ColourLineSpec.H.

◆ setRGBA()

ColourLineSpec ColourLineSpec::setRGBA ( cairo_t *  cr,
double  alpha 
)
inline

Set the RGBA for the cairo context .

Parameters
crThe cairo context to set the colour and width in.
alphaThe number to scale by. 0.0 <= alpha <= 1.0

Definition at line 296 of file ColourLineSpec.H.

◆ setSize() [1/2]

void ColourLineSpec::setSize ( int  s)
inline

Manually specify the size

Parameters
sthe size

Definition at line 124 of file ColourLineSpec.H.

◆ setSize() [2/2]

void ColourLineSpec::setSize ( float  s)
inline

Manually specify the size

Parameters
sthe size

Definition at line 131 of file ColourLineSpec.H.

◆ wasColourSpecified()

bool ColourLineSpec::wasColourSpecified ( void  )
inline

Enquire whether the colour was specified as well as the size For example:

ColourLineSpec cls("12"); // is size 12 without colour.
cls.wasColourSpecified(); // is false
Returns
true if the colour was specified, false otherwise

Definition at line 117 of file ColourLineSpec.H.

Here is the caller graph for this function:

◆ wasSizeSpecified()

bool ColourLineSpec::wasSizeSpecified ( void  )
inline

Enquire whether the size was specified as well as the colour. For example:

ColourLineSpec cls("r"); // is red without size.
cls.wasSizeSpecified(); // is false
Returns
true if the size was specified, false otherwise

Definition at line 105 of file ColourLineSpec.H.

Here is the caller graph for this function:

Member Data Documentation

◆ colour

GdkColor ColourLineSpec::colour
private

The colour holder.

Definition at line 69 of file ColourLineSpec.H.

◆ colourNotSpecified

bool ColourLineSpec::colourNotSpecified
private

Set to true if the colour was not specified ... i.e. "12" for size 12 with no colour.

Definition at line 63 of file ColourLineSpec.H.

◆ linePlot

bool ColourLineSpec::linePlot

The indication for lines or points plotting.

Definition at line 76 of file ColourLineSpec.H.

◆ shortColours

vector<string> ColourLineSpec::shortColours

User specified colours in character notation :

See also
shortColoursPrivate
Examples:
PlotTest2.C.

Definition at line 73 of file ColourLineSpec.H.

◆ size

float ColourLineSpec::size
private

The size of the line or point.

Definition at line 64 of file ColourLineSpec.H.

◆ sizeNotSpecified

bool ColourLineSpec::sizeNotSpecified
private

Set to true if the size was not specified ... i.e. "r" for red with no size.

Definition at line 62 of file ColourLineSpec.H.

◆ X11Colours

vector<string> ColourLineSpec::X11Colours

User specified colour strings :

See also
X11ColoursPrivate
Examples:
PlotTest2.C.

Definition at line 74 of file ColourLineSpec.H.


The documentation for this class was generated from the following file:
gtkIOStream: ColourLineSpec Class Reference
GTK+ IOStream  Beta