IlvPalette
builder.
More...
#include <ilviews/base/resource.h>
Public Member Functions | |
Builder (const Builder &builder) | |
Copy constructor. More... | |
Builder (const IlvPalette *palette) | |
Initializes a new palette builder, starting with an existing palette. More... | |
Builder (IlvDisplay *display) | |
Initializes a new palette builder, starting with the default palette of the indicated display. More... | |
Builder & | alpha (IlvIntensity alpha) |
Sets the new palette alpha value. More... | |
Builder & | antialiasingMode (IlvAntialiasingMode aaMode) |
Sets the new palette antialias setting. More... | |
Builder & | arcMode (IlvArcMode arcMode) |
Sets the new palette arc mode. More... | |
Builder & | background (const char *background) |
Sets the new palette background color name. More... | |
Builder & | background (IlvColor *background) |
Sets the new palette background color. More... | |
Builder & | backgroundHSV (IlFloat hue, IlFloat saturation, IlFloat value) |
Sets the new palette background color HSV values. More... | |
Builder & | backgroundRGB (IlvIntensity r, IlvIntensity g, IlvIntensity b) |
Sets the new palette background color RGB values. More... | |
Builder & | colorPattern (IlvColorPattern *colorPattern) |
Sets the new palette fill color pattern. More... | |
Builder & | fillRule (IlvFillRule fillRule) |
Sets the new palette fill rule. More... | |
Builder & | fillStyle (IlvFillStyle fillStyle) |
Sets the new palette fill style. More... | |
Builder & | font (const char *fontName) |
Sets the new palette font by name. More... | |
Builder & | font (IlvFont *font) |
Sets the new palette font. More... | |
Builder & | foreground (const char *foreground) |
Sets the new palette foreground color name. More... | |
Builder & | foreground (IlvColor *foreground) |
Sets the new palette foreground color. More... | |
Builder & | foregroundHSV (IlFloat hue, IlFloat saturation, IlFloat value) |
Sets the new palette foreground color HSV values. More... | |
Builder & | foregroundRGB (IlvIntensity r, IlvIntensity g, IlvIntensity b) |
Sets the new palette foreground color RGB values. More... | |
virtual IlvPalette * | get (IlBoolean shared=IlTrue) const |
Builds and returns the new palette. More... | |
Builder & | gradientPattern (IlvGradientPattern *gradPat) |
Sets the new palette gradient pattern. More... | |
Builder & | invert () |
Swaps the foreground and the background colors of this palette builder. More... | |
Builder & | lineStyle (const char *name) |
Sets the new palette line style. More... | |
Builder & | lineStyle (IlUShort count, const unsigned char *dashes, IlUShort offset=0) |
Sets the new palette line style. More... | |
Builder & | lineStyle (IlvLineStyle *lineStyle) |
Sets the new palette line style. More... | |
Builder & | lineWidth (IlUShort lineWidth) |
Sets the new palette line width. More... | |
operator IlvPalette * () const | |
Cast operator to a pointer to an IlvPalette . More... | |
Builder & | operator= (const Builder &builder) |
Assignment operator. More... | |
Builder & | pattern (IlvPattern *pattern) |
Sets the new palette fill pattern. More... | |
IlvPalette
builder.
Library: xviews or winviews or mviews (mutually exclusive)
This class simplifies the process of building a new IlvPalette
, starting from an existing palette, and limiting the parameters that need to be changed to just what the application needs .
Starting with a palette, the palette builder lets you change one or several palette settings, so one does not have to provide the entire set of palette parameters should only a few of them be changed.
If you need to create a new palette that is the exact copy of another one, but where, for example, the background and foreground colors are swapped and where the line width is changed, you can use the following code:
that is much more readable, less error-prone and shorter than the equivalent code:
A handy use case is when you want to create a set of IlvPalette
objects that are based on a reference one:
Without the Builder
, you would have to repeat a large number of parameters when invoking IlvDisplay::getPalette()
.
IlvPalette::Builder::Builder | ( | IlvDisplay * | display | ) |
Initializes a new palette builder, starting with the default palette of the indicated display.
display | The display instance to query the default palette from, that initializes the builder state. |
IlvPalette::Builder::Builder | ( | const IlvPalette * | palette | ) |
Initializes a new palette builder, starting with an existing palette.
palette | The palette to initialize the builder from. |
IlvPalette::Builder::Builder | ( | const Builder & | builder | ) |
Copy constructor.
Constructs a copy of builder.
builder | The builder that is copied to this object. |
Builder& IlvPalette::Builder::alpha | ( | IlvIntensity | alpha | ) |
Sets the new palette alpha value.
alpha | The new palette alpha value. |
Builder
object (*this
). Builder& IlvPalette::Builder::antialiasingMode | ( | IlvAntialiasingMode | aaMode | ) |
Sets the new palette antialias setting.
aaMode | The new palette antialias setting. |
Builder
object (*this
). Builder& IlvPalette::Builder::arcMode | ( | IlvArcMode | arcMode | ) |
Sets the new palette arc mode.
arcMode | The new palette arc mode. |
Builder
object (*this
). Builder& IlvPalette::Builder::background | ( | const char * | background | ) |
Sets the new palette background color name.
background | The name of the new palette background color. If this name does not correspond to an actual color, this function does nothing. |
Builder
object (*this
). Sets the new palette background color.
background | The new palette background color. This color is locked. |
Builder
object (*this
). Sets the new palette background color HSV values.
hue | The hue value value of the new palette background color. |
saturation | The saturation value of the new palette background color. |
value | The The luminosity value of the new palette background color. |
Builder
object (*this
). Builder& IlvPalette::Builder::backgroundRGB | ( | IlvIntensity | r, |
IlvIntensity | g, | ||
IlvIntensity | b | ||
) |
Sets the new palette background color RGB values.
r | The red component value of the new palette background color. |
g | The green component value of the new palette background color. |
b | The red component value of the new palette background color. |
Builder
object (*this
). Builder& IlvPalette::Builder::colorPattern | ( | IlvColorPattern * | colorPattern | ) |
Sets the new palette fill color pattern.
colorPattern | The new palette fill color pattern. This pattern is locked. |
Builder
object (*this
). Builder& IlvPalette::Builder::fillRule | ( | IlvFillRule | fillRule | ) |
Sets the new palette fill rule.
fillRule | The new palette fill rule. |
Builder
object (*this
). Builder& IlvPalette::Builder::fillStyle | ( | IlvFillStyle | fillStyle | ) |
Sets the new palette fill style.
fillStyle | The new palette fill style. |
Builder
object (*this
). Builder& IlvPalette::Builder::font | ( | const char * | fontName | ) |
Sets the new palette font by name.
fontName | The new palette font name. This font is locked. If this name does not correspond to an actual font, this function does nothing. |
Builder
object (*this
). Sets the new palette font.
font | The new palette font. This font is locked. |
Builder
object (*this
). Builder& IlvPalette::Builder::foreground | ( | const char * | foreground | ) |
Sets the new palette foreground color name.
foreground | The name of the new palette foreground color. If this name does not correspond to an actual color, this function does nothing. |
Builder
object (*this
). Sets the new palette foreground color.
foreground | The new palette foreground color. This color is locked. |
Builder
object (*this
). Sets the new palette foreground color HSV values.
hue | The hue value value of the new palette foreground color. |
saturation | The saturation value of the new palette foreground color. |
value | The The luminosity value of the new palette foreground color. |
Builder
object (*this
). Builder& IlvPalette::Builder::foregroundRGB | ( | IlvIntensity | r, |
IlvIntensity | g, | ||
IlvIntensity | b | ||
) |
Sets the new palette foreground color RGB values.
r | The red component value of the new palette foreground color. |
g | The green component value of the new palette foreground color. |
b | The red component value of the new palette foreground color. |
Builder
object (*this
).
|
virtual |
Builds and returns the new palette.
shared | If IlTrue , the palette that is built is shared (that is, allocated using IlvDisplay::getPalette() ), and not locked.If IlFalse , the new palette is not shared (allocated using the IlvPalette constructor). |
operator IlvPalette*()
. Reimplemented in IlvPalette::Changer.
Builder& IlvPalette::Builder::gradientPattern | ( | IlvGradientPattern * | gradPat | ) |
Sets the new palette gradient pattern.
gradPat | The new gradient pattern. This gradient pattern is locked. |
Builder
object (*this
). Builder& IlvPalette::Builder::invert | ( | ) |
Swaps the foreground and the background colors of this palette builder.
Builder
object (*this
). foreground()
, background()
. Builder& IlvPalette::Builder::lineStyle | ( | const char * | name | ) |
Sets the new palette line style.
name | The new palette line style name if the style has been previously defined. |
Builder
object (*this
). Builder& IlvPalette::Builder::lineStyle | ( | IlUShort | count, |
const unsigned char * | dashes, | ||
IlUShort | offset = 0 |
||
) |
Sets the new palette line style.
count | The length of the line style array. |
dashes | The number of foreground-colored pixels in a dash. |
offset | The number of pixels to be skipped before the next dash. |
Builder
object (*this
). Builder& IlvPalette::Builder::lineStyle | ( | IlvLineStyle * | lineStyle | ) |
Sets the new palette line style.
lineStyle | The new palette line style. This line style is locked. |
Builder
object (*this
). Sets the new palette line width.
lineWidth | The new palette line width. |
Builder
object (*this
). IlvPalette::Builder::operator IlvPalette * | ( | ) | const |
Cast operator to a pointer to an IlvPalette
.
The palette that is returned is a shared palette that is not locked.
get(IlTrue)
. Assignment operator.
This operator assigns builder to this object.
builder | The builder that is copied to this object. |
Builder& IlvPalette::Builder::pattern | ( | IlvPattern * | pattern | ) |
Sets the new palette fill pattern.
pattern | The new palette fill pattern. This pattern is locked. |
Builder
object (*this
).