public abstract class IltPattern extends Object implements IlPattern
When an area is drawn, the pattern is drawn in the foreground color,
and the remainder of the area is drawn in the background color.
If the background color is null
, it means transparency.
The predefined patterns are defined by class IlvPattern
,
it is also possible to create customized patterns using the CSS function
pattern
as follows:
aPattern : '@|pattern("Grid", 3, 2)';
bPattern : '@|pattern("SkewGrid", 2, 2)';
cPattern : '@|pattern("Dots")';
dPattern : '@|pattern("ThinHatching")';
ePattern : '@|pattern("LIGHT_VERTICAL")';
See IltPatternFunction
for more details.
To create customized patterns, the method getPaint
must be
implemented to return the corresponding instance of Paint
that
will be used for fill
operations. For backward compatibility,
methods NewGridPattern
and NewSkewGridPattern
are
still available through the API.
IltPatternFunction
,
Ilt2DPalette
,
IlvPattern
,
Paint
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
IltPattern.PatternWrapper
Auxiliary class which converts from IlPattern to IltPattern.
|
static class |
IltPattern.Solid
Deprecated.
Please set the fillStyle CSS property to be SOLID
instead of PATTERN.
|
Modifier and Type | Field and Description |
---|---|
static IltPattern |
Solid
Deprecated.
Please set the fillStyle CSS property to be SOLID
instead of PATTERN.
|
Modifier | Constructor and Description |
---|---|
protected |
IltPattern() |
protected |
IltPattern(int type,
int arg1,
int arg2) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Compares two objects.
|
void |
fillPolygon(Graphics g,
AffineTransform t,
IlIntPolygon polygon,
Color foreground,
Color background)
Fills a polygon.
|
void |
fillRect(Graphics g,
AffineTransform t,
int x1,
int y1,
int x2,
int y2,
Color foreground,
Color background)
Fills a rectangle with corners (x1,y1) and
(x2,y2).
|
abstract Paint |
getPaint(Color foreground,
Color background)
This method returns an instance of
Paint interface that
should be used to fill a 2D area with the specified pattern. |
int |
hashCode()
Returns a hash code value for the object.
|
static IltPattern |
NewGridPattern(int xPeriod,
int yPeriod)
This creates a new pattern, parallel to the x axis and the y axis.
|
static IltPattern |
NewSkewGridPattern(int uPeriod,
int vPeriod)
This creates a new pattern, parallel to the diagonals (i.e. the
bisectors between the x axis and the y axis).
|
static IltPattern |
NewViewsPattern(int type,
int arg1,
int arg2)
This creates a new pattern based on
IlvPattern . |
@Deprecated public static IltPattern Solid
protected IltPattern()
protected IltPattern(int type, int arg1, int arg2)
public boolean equals(Object o)
public int hashCode()
public void fillRect(Graphics g, AffineTransform t, int x1, int y1, int x2, int y2, Color foreground, Color background)
IlPattern
fillRect
in interface IlPattern
g
- The Graphics where the pattern will be drawn.t
- The transformer of the view, normally null
.
Note: It is assumed that t
has already been
applied to x1, y1, x2, y2.
x1
- The upper left corner of the rectangle.y1
- The upper left corner of the rectangle.x2
- The lower left corner of the rectangle.y2
- The lower left corner of the rectangle.foreground
- The foreground color.background
- The background color, or null
.public void fillPolygon(Graphics g, AffineTransform t, IlIntPolygon polygon, Color foreground, Color background)
IlPattern
fillPolygon
in interface IlPattern
g
- The Graphics where the pattern will be drawn.t
- The transformer of the view, normally null
.
Note: It is assumed that t
has already been
applied to x1, y1, x2, y2.
polygon
- The polygon to be filled.foreground
- The foreground color.background
- The background color, or null
.public abstract Paint getPaint(Color foreground, Color background)
Paint
interface that
should be used to fill a 2D area with the specified pattern.foreground
- The foreground color to be used to draw the pattern.background
- The background color of the pattern to be used.Paint
interface to be used to fill
a 2D area.public static IltPattern NewViewsPattern(int type, int arg1, int arg2)
IlvPattern
.
The two arguments arg1
and arg2
have
been added to address support call 1-43367250 (performance on
remote XWindows).type
- One of the types available in IlvPattern
, or a
solid pattern, if it is unable to match the given type with
the ones in IlvPattern
.arg1
- The argument1 used for legacy pattern, it has been introduced
in TGO 4.5 to address support call 1-43367250 (performance
on remote XWindows)arg2
- The argument2 used for legacy pattern, it has been introduced
in TGO 4.5 to address support call 1-43367250 (performance
on remote XWindows)IlvPattern
public static IltPattern NewGridPattern(int xPeriod, int yPeriod)
xPeriod
- Horizontal distance between two dots (1 means continuous
horizontal hatching)yPeriod
- Vertical distance between two dots (1 means continuous
vertical hatching)public static IltPattern NewSkewGridPattern(int uPeriod, int vPeriod)
uPeriod
- The pattern is translation invariant w.r.t. the vector
(uPeriod/2,uPeriod/2).
2 means continuous diagonal hatching.vPeriod
- The pattern is translation invariant w.r.t. the vector
(vPeriod/2,-vPeriod/2).
2 means continuous anti-diagonal hatching.
Note: The pattern's "area" is uPeriod*vPeriod/2. Either uPeriod or vPeriod has to be even.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.