|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.PaintFormat
PaintFormat represents a format for area fillings. This format
consists of the following attributes:
The style attribute defines the fashion the area is filled out.
The different styles PaintFormat provides are as follows.
The background color attribute defines the background color for the area
filling. It is used with the following styles.
| Constant | Description |
|---|---|
FILL_SOLID |
the color the area is filled with |
FILL_GRADIENT |
the first color used to render the gradient |
FILL_PATTERN |
the background color for the pattern |
int that defines the
values for the red, green and blue components as illustrated by the following
hexadecimal pattern:
The foreground color attribute defines the foreground color for the area
filling. It is used with the following styles:
| Constant | Description |
|---|---|
FILL_GRADIENT |
the second color used to render the gradient |
FILL_PATTERN |
the color used for the pattern |
int that defines the
values for the red, green and blue components as illustrated by the following
hexadecimal pattern:
The gradient type attribute defines the type of the gradient the area is
filled with. To get more informations about gradients and what types of
gradients are selectable see the documentation of the Gradient class.
Notice that the gradient type attribute is only used when the style of the
PaintFormat is set to FILL_GRADIENT.
The pattern type attribute defines the type of the pattern the area is
filled with. To get more informations about patterns and what types of
pattern are selectable see the documentation of the Pattern class.
Notice that the pattern type attribute is only used when the style of the
PaintFormat is set to FILL_PATTERN.
The transparent flag indicates whether the filling of the area should be transparent or not.
The transparency value attribute defines the value of transparency for the area filling. This value is given in percent where zero percent means that the filling is not transparent and one hundred percent means that the filling is completely transparent.
Since the PaintFormat is an object that is frequently used
within the graphics framework and all frameworks that use the
graphics framework PaintFormats are subject of
pooling. The pooling of the PaintFormat instances is being done
by the FormatPool. To get more information about this class
take a look at the documentation about the FormatPool.
In order to pool a PaintFormat it has to be immutable because
maybe many objects have a reference on the same PaintFormat and
modifying the PaintFormat will affect all these objects.
For the pooling also an unique expression is needed so that a
PaintFormat can be surely identified. The unique expression is
called the canonical description. This canonical description is made up of
the attributes a PaintFormat consists of and it can be gained
by Format.getCanonicalDescription().
PaintFormat can only be created by using the
FormatPool.parsePaintFormat(String) method to
ensure a correct pooling behavior. You can obtain the canonical description
by calling the on of the static methods called getCanonicalDescription().
A PaintFormat is usually applied to a Primitive
by calling the Primitive.setPaint(PaintFormat) method.
A PaintFormat provides the following attributes:
PaintFormat:
FILL_INVISIBLE, FILL_SOLID, FILL_GRADIENT
FILL_PATTERN and FILL_TEXTURE
PaintFormat.
PaintFormat style is
set to FILL_GRADIENT or FILL_PATTERN.
Gradient class defines a way to fill an
enclosed area with a linear gradient pattern. There are various
gradient types and each is defined by a constant. For example, if
you choose gradient type RIGHTLEFT with a
background color c1 and a foreground color c2, the color of the
connecting line from the left to the right of the area will be
proportionally changed from c1 to c2.
RIGHTLEFT with foreground color blackand background color
white.
Pattern defines a way to fill a
closed area with a pattern. As the name implies, the foreground
color defines the color that is used to draw the pattern and the
background color defines the color that is used to draw the pattern
background. It is not possible to create an instance of this class
but the API provides some predefined patterns. These patterns can
be retrieved by type by calling method getPattern(type).
Pattern.
PaintFormat
is transparent or not.
PaintFormat is completely opaque and a value of 100
means that it is completely transparent.
| Field Summary | |
protected static java.lang.String |
CANONIC_DESCRIPTION_DELIMITER
constant needed as delimitier for the canonical description |
static PaintFormat |
DEFAULT_PAINT_FORMAT_BLACK
constant for a default paint format |
static PaintFormat |
DEFAULT_PAINT_FORMAT_NULL
constant for a default paint format |
static PaintFormat |
DEFAULT_PAINT_FORMAT_TEXTRETOUCHING
constant for a default paint format |
static PaintFormat |
DEFAULT_PAINT_FORMAT_WHITE
constant for a default paint format |
static int |
FILL_GRADIENT
A gradient is used for area fills. |
static int |
FILL_INVISIBLE
Areas are left empty. |
static int |
FILL_PATTERN
A pattern is used for area fills.. |
static int |
FILL_SOLID
Areas get filled with one color. |
static int |
FILL_TEXTURE
Areas are left empty. |
static int |
STYLE_MAX
constant that indicates the maximum number of predefined styles |
static java.lang.String |
TEXTURE_NONE
Constant for the texture attribute when no texture is assigned |
protected static java.lang.String |
TOKEN_COLORBACK
enumeration that tells about the canonical description tokens |
protected static java.lang.String |
TOKEN_COLORFORE
enumeration that tells about the canonical description tokens |
protected static java.lang.String |
TOKEN_GRADIENTTYPE
enumeration that tells about the canonical description tokens |
protected static java.lang.String |
TOKEN_PATTERNTYPE
enumeration that tells about the canonical description tokens |
protected static java.lang.String |
TOKEN_STYLE
enumeration that tells about the canonical description tokens |
protected static java.lang.String |
TOKEN_TEXTURERASTERKEY
enumeration that tells about the canonical description tokens |
protected static java.lang.String |
TOKEN_TRANSPARENCY
enumeration that tells about the canonical description tokens |
protected static java.lang.String |
TOKEN_TRANSPARENT
enumeration that tells about the canonical description tokens |
| Method Summary | |
boolean |
equals(java.lang.Object o)
|
java.lang.String |
getCanonicalDescription()
Returns the canonical description of a PaintFormat. |
static java.lang.String |
getCanonicalDescription(int style,
int colorback,
int colorfore,
int gradienttype,
int patterntype,
int transparency,
boolean transparent)
Returns the canonical description of a PaintFormat. |
static java.lang.String |
getCanonicalDescription(int style,
int colorback,
int colorfore,
int gradienttype,
int patterntype,
java.lang.String texturerasterkey,
int transparency,
boolean transparent)
Returns the canonical description of a PaintFormat. |
static java.lang.String |
getCanonicalDescription(java.lang.String style,
java.lang.String colorback,
java.lang.String colorfore,
java.lang.String gradienttype,
java.lang.String patterntype,
java.lang.String texturerasterkey,
java.lang.String transparency,
java.lang.String transparent)
Returns the canonical description of a PaintFormat. |
int |
getColor()
Returns the background color of the PaintFormat. |
int |
getColorFore()
Returns the foreground color of the PaintFormat. |
java.lang.Object[] |
getFormatData()
Returns an array filled with the attributes of the PaintFormat. |
int |
getGradientType()
Return the gradient type of the PaintFormat. |
int |
getPatternType()
Returns the pattern type of the PaintFormat. |
int |
getStyle()
Returns the style of the PaintFormat. |
java.lang.String |
getTextureRasterKey()
Returns the key used within the ImagePool of the texture
raster if a texture is used or TEXTURE_NONE if no texture is used. |
static java.lang.String |
getTextureRasterKey(Texture texture)
Returns the key for the Texture given by
texture that is used within the ImagePool to
pool the raster of the given Texture. |
int |
getTransparency()
Returns the transparency value of the PaintFormat. |
boolean |
getTransparent()
Returns a boolean that indicates whether the transparency is
turned of or off. |
int |
hashCode()
|
boolean |
isVisible()
Returns a boolean that indicates whether the
PaintFormat is visible or not. |
java.lang.String |
toString()
Returns a String that represent the PaintFormat
and all of the attributes of it. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int FILL_INVISIBLE
public static final int FILL_SOLID
public static final int FILL_GRADIENT
public static final int FILL_PATTERN
public static final int FILL_TEXTURE
public static final java.lang.String TEXTURE_NONE
public static final int STYLE_MAX
public static final PaintFormat DEFAULT_PAINT_FORMAT_WHITE
public static final PaintFormat DEFAULT_PAINT_FORMAT_BLACK
public static final PaintFormat DEFAULT_PAINT_FORMAT_NULL
public static final PaintFormat DEFAULT_PAINT_FORMAT_TEXTRETOUCHING
protected static final java.lang.String CANONIC_DESCRIPTION_DELIMITER
protected static final java.lang.String TOKEN_STYLE
protected static final java.lang.String TOKEN_COLORBACK
protected static final java.lang.String TOKEN_COLORFORE
protected static final java.lang.String TOKEN_GRADIENTTYPE
protected static final java.lang.String TOKEN_PATTERNTYPE
protected static final java.lang.String TOKEN_TEXTURERASTERKEY
protected static final java.lang.String TOKEN_TRANSPARENCY
protected static final java.lang.String TOKEN_TRANSPARENT
| Method Detail |
public int getStyle()
PaintFormat. The possible styles
are given by the style constants defined in this class.
PaintFormatpublic int getColor()
PaintFormat.
public int getColorFore()
PaintFormat.
public int getGradientType()
PaintFormat.
public int getPatternType()
PaintFormat.
public java.lang.String getTextureRasterKey()
ImagePool of the texture
raster if a texture is used or TEXTURE_NONE if no texture is used.
ImagePool or TEXTURE_NONE if no texture is usedpublic int getTransparency()
PaintFormat.
public boolean getTransparent()
boolean that indicates whether the transparency is
turned of or off.
public boolean isVisible()
boolean that indicates whether the
PaintFormat is visible or not.
public java.lang.Object[] getFormatData()
PaintFormat. The indices of the attributes are given by
constants defined in this class. This array is used by
Renderers and Devices. To get more information
about this objects take a look at the documentation of
Renderer and
Device
PaintFormat.public java.lang.String getCanonicalDescription()
PaintFormat. For
instance this description is used for the pooling of
PaintFormats. It can also be used to compare two instances
of a PaintFormat.
getCanonicalDescription in interface FormatPaintFormatpublic java.lang.String toString()
String that represent the PaintFormat
and all of the attributes of it. For instance this representation can be
used for tracing purposes and such.
toString in interface FormatPaintFormatpublic int hashCode()
public boolean equals(java.lang.Object o)
public static final java.lang.String getCanonicalDescription(int style,
int colorback,
int colorfore,
int gradienttype,
int patterntype,
int transparency,
boolean transparent)
PaintFormat. For
instance this description is used for the pooling of
PaintFormats. It can also be used to compare two instances
of a PaintFormat.
style - the style of a PaintFormatcolorback - the background colorback of a PaintFormatcolorfore - the foreground colorback of a PaintFormatgradienttype - the gradient type of a PaintFormatpatterntype - the pattern type of a PaintFormattransparency - the transparency of a PaintFormattransparent - flag that indicates weather transparency of a
PaintFormat is turned on or off.
PaintFormat
public static final java.lang.String getCanonicalDescription(int style,
int colorback,
int colorfore,
int gradienttype,
int patterntype,
java.lang.String texturerasterkey,
int transparency,
boolean transparent)
PaintFormat. For
instance this description is used for the pooling of
PaintFormats. It can also be used to compare two instances
of a PaintFormat.
style - the style of a PaintFormatcolorback - the background colorback of a PaintFormatcolorfore - the foreground colorback of a PaintFormatgradienttype - the gradient type of a PaintFormatpatterntype - the pattern type of a PaintFormattexturerasterkey - the key used within the ImagePool
for the raster of the texture or null if no texture is usedtransparency - the transparency of a PaintFormattransparent - flag that indicates weather transparency of a
PaintFormat is turned on or off.
PaintFormat
public static final java.lang.String getCanonicalDescription(java.lang.String style,
java.lang.String colorback,
java.lang.String colorfore,
java.lang.String gradienttype,
java.lang.String patterntype,
java.lang.String texturerasterkey,
java.lang.String transparency,
java.lang.String transparent)
PaintFormat. For
instance this description is used for the pooling of
PaintFormats. It can also be used to compare two instances
of a PaintFormat.
style - the style of a PaintFormatcolorback - the background colorback of a PaintFormatcolorfore - the foreground colorback of a PaintFormatgradienttype - the gradient type of a PaintFormatpatterntype - the pattern type of a PaintFormattexturerasterkey - the key used within the ImagePool
for the raster of the texture or null if no texture is usedtransparency - the transparency of a PaintFormattransparent - flag that indicates weather transparency of a
PaintFormat is turned on or off.
PaintFormatpublic static final java.lang.String getTextureRasterKey(Texture texture)
Texture given by
texture that is used within the ImagePool to
pool the raster of the given Texture.
texture - the Texture instance to return the key for
Texture instance
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||