IlvPalette
changer.
More...
#include <ilviews/base/resource.h>
Public Member Functions | |
Changer (const Changer &changer) | |
Copy constructor. More... | |
Changer (IlvPalette *source) | |
Initializes a new palette changer for a given palette. More... | |
virtual IlvPalette * | get (IlBoolean shared=IlTrue) const |
Builds and returns the new palette. More... | |
Changer & | operator= (const Changer &changer) |
Assignment operator. More... | |
Public Member Functions inherited from IlvPalette::Builder | |
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... | |
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
changer.
Library: xviews or winviews or mviews (mutually exclusive)
This class simplifies the process of modifying an IlvPalette
, by allowing to indicate just the parameters that you want to modify.
If you need to modify a new palette so that, 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:
IlvDisplay::getPalette()
.IlvPalette
that is used in the Changer
constructor is considered not to be used anymore, because it is changed the to the IlvPalette
that is returned by the get()
member function. See get()
for a full explanation of the different use cases. IlvPalette::Changer::Changer | ( | IlvPalette * | source | ) |
Initializes a new palette changer for a given palette.
source | The palette to initialize the changer from. This palette, if shared, may potentially be unlocked when get() is invoked. |
IlvPalette::Changer::Changer | ( | const Changer & | changer | ) |
Copy constructor.
Constructs a copy of changer.
changer | The changer that is copied to this object. |
|
virtual |
Builds and returns the new palette.
This member function does the following, succesively:
IlvPalette
, based on this Changer
attribute values:IlTrue
, this palette is queried to the display using IlvDisplay::getPalette()
, then this palette is locked.IlFalse
, this palette is a new palette, initialized by the IlvPalette
constructor.Changer
constructor:Typically, you would assign the returned palette to the variable that holds the pointer that was provided in the constructor.
Because the original palette (the one provided in the constructor) may be deleted (because it is not shared, or its reference count drops to 0), you must make sure that you are not keeping a pointer to this palette unintentionally.
shared | If IlTrue , the returned palette is shared and locked.If IlFalse , the returned palette is not shared. |
Changer
attribute values. operator IlvPalette*()
. Reimplemented from IlvPalette::Builder.