|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jdrawing.graphics.Style
Encapsulates style information used to perform graphics operations.
Field Summary | |
static java.lang.String |
BACKGROUND
Key for background attribute. |
static java.lang.String |
CLIP
Key for rendering clip attribute. |
static java.lang.String |
COMPOSITE
Key for composite attribute. |
static java.lang.String |
FONT
Key for font attribute. |
static java.lang.String |
PAINT
Key for paint attribute. |
static java.lang.String |
RENDERING_HINTS
Key for rendering hints attribute. |
static java.lang.String |
STROKE
Key for stroke attribute. |
static java.lang.String |
TRANSFORM
Key for transform attribute. |
Constructor Summary | |
Style()
Constructs a new Style with defaults for all attributes. |
|
Style(java.util.Map attributes)
Constructs a new Style with the specified attributes. |
Method Summary | |
java.awt.Shape |
createStrokedShape(java.awt.Shape shape)
Returns an outline Shape which encloses the area that should be painted when the Shape is stroked according to the stroke attribute. |
Style |
deriveStyle(java.util.Map attributes)
Creates a new Style object by replicating the current
Style object and applying a new set of style
attributes to it. |
boolean |
equals(java.lang.Object object)
Checks whether two styles are equal. |
java.awt.Color |
getBackground()
Returns the value of the background attribute of this style. |
java.awt.Shape |
getClip()
Returns the value of the clip attribute of this style. |
java.awt.Composite |
getComposite()
Returns the value of the composite attribute of this style. |
static Style |
getDefaultStyle()
Returns the shared instance of style with defaults for all attributes. |
java.awt.Font |
getFont()
Returns the value of the font attribute of this style. |
java.awt.Paint |
getPaint()
Returns the value of the paint attribute of this style. |
java.util.Map |
getRenderingHints()
Returns the value of the renderingHints attribute of this style. |
java.awt.Rectangle |
getShapeBounds(java.awt.Shape shape)
Returns bounding box of the specified shape according to transform attribute. |
java.awt.geom.Rectangle2D |
getShapeBounds2D(java.awt.Shape shape)
Returns high precision bounding box of the specified shape according to transform attribute. |
java.awt.geom.Rectangle2D |
getStringBounds(java.lang.String string,
java.awt.font.FontRenderContext context)
Returns bounding box of the specified string according to font attribute and specified FontRenderingContext . |
java.awt.Stroke |
getStroke()
Returns the value of the stroke attribute of this style. |
java.awt.geom.AffineTransform |
getTransform()
Returns the value of the transform attribute of this style. |
int |
hashCode()
Returns the hashcode for this style. |
boolean |
shapeContains(java.awt.Shape shape,
java.awt.geom.Point2D point)
Tests if the specified shape contains the given point according to transform attribute. |
boolean |
shapeContains(java.awt.Shape shape,
java.awt.geom.Rectangle2D rectangle)
Tests if the specified shape contains the given rectangle according to transform attribute. |
boolean |
shapeIntersects(java.awt.Shape shape,
java.awt.geom.Rectangle2D rectangle)
Tests if the specified shape intersects with the given rectangle according to transform attribute. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String BACKGROUND
Color
.
Graphics2D.setBackground(java.awt.Color)
,
Constant Field Valuespublic static final java.lang.String FONT
Font
.
Graphics.setFont(java.awt.Font)
,
Constant Field Valuespublic static final java.lang.String COMPOSITE
Composite
.
Graphics2D.setComposite(java.awt.Composite)
,
Constant Field Valuespublic static final java.lang.String PAINT
Paint
.
Graphics2D.setPaint(java.awt.Paint)
,
Constant Field Valuespublic static final java.lang.String STROKE
Stroke
.
Graphics2D.setStroke(java.awt.Stroke)
,
Constant Field Valuespublic static final java.lang.String TRANSFORM
AffineTransform
.
Graphics2D.transform(java.awt.geom.AffineTransform)
,
Constant Field Valuespublic static final java.lang.String RENDERING_HINTS
Map
.
Graphics2D.setRenderingHints(java.util.Map)
,
Constant Field Valuespublic static final java.lang.String CLIP
Shape
.
Graphics.setClip(int, int, int, int)
,
Constant Field ValuesConstructor Detail |
public Style()
Color.WHITE
;
new Font (null)
;
AlphaComposite.SrcOver;
- paint:
Color.BLACK
;
- stroke: the result of
new BasicStroke ()
;
- transform: the result of
new AffineTransform ()
;
- renderingHints: empty map;
- clip: null.
public Style(java.util.Map attributes)
attributes
- the attributes to assign to the new StyleMethod Detail |
public static Style getDefaultStyle()
public Style deriveStyle(java.util.Map attributes)
Style
object by replicating the current
Style
object and applying a new set of style
attributes to it.
attributes
- a map of attributes enabled for the new
Style
Style
objectpublic java.awt.Color getBackground()
public java.awt.Font getFont()
public java.awt.Composite getComposite()
public java.awt.Paint getPaint()
public java.awt.Stroke getStroke()
public java.awt.geom.AffineTransform getTransform()
public java.util.Map getRenderingHints()
public java.awt.Shape getClip()
public java.awt.geom.Rectangle2D getStringBounds(java.lang.String string, java.awt.font.FontRenderContext context)
FontRenderingContext
.
string
- the specified String
context
- the specified FontRenderingContext
Rectangle2D
that is the bounding box of
the specified String
public java.awt.Rectangle getShapeBounds(java.awt.Shape shape)
shape
- the specified shape
Rectangle
that is the bounding box of
the specified shapepublic java.awt.geom.Rectangle2D getShapeBounds2D(java.awt.Shape shape)
shape
- the specified shape
Rectangle2D
that is the bounding box of
the specified shapepublic boolean shapeIntersects(java.awt.Shape shape, java.awt.geom.Rectangle2D rectangle)
shape
- the specified shaperectangle
- the given rectangle
true
if the specified shape intersects with
the given rectangle; false
otherwisepublic boolean shapeContains(java.awt.Shape shape, java.awt.geom.Rectangle2D rectangle)
shape
- the specified shaperectangle
- the given rectangle
true
if the specified shape contains
the given rectangle; false
otherwisepublic boolean shapeContains(java.awt.Shape shape, java.awt.geom.Point2D point)
shape
- the specified shapepoint
- the given point
true
if the specified shape contains
the given point; false
otherwisepublic java.awt.Shape createStrokedShape(java.awt.Shape shape)
shape
- the specified shape
public boolean equals(java.lang.Object object)
true
if and only if the argument is not
null
and is a Style
object
that has the same attributes as this Style
.
object
- the Object
to compare with
this Style
true
if the objects are equal;
false
otherwise.public int hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |