|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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.
Style
public Style(java.util.Map attributes)
- Constructs a new Style with the specified attributes. All
unspecified attributes are assigned with default values.
- Parameters:
attributes
- the attributes to assign to the new Style
Method Detail
getDefaultStyle
public static Style getDefaultStyle()
- Returns the shared instance of style with defaults for
all attributes.
- Returns:
- default style
deriveStyle
public 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.
- Parameters:
attributes
- a map of attributes enabled for the new
Style
- Returns:
- a new
Style
object
getBackground
public java.awt.Color getBackground()
- Returns the value of the background attribute of this style.
- Returns:
- color value
getFont
public java.awt.Font getFont()
- Returns the value of the font attribute of this style.
- Returns:
- font value
getComposite
public java.awt.Composite getComposite()
- Returns the value of the composite attribute of this style.
- Returns:
- composite value
getPaint
public java.awt.Paint getPaint()
- Returns the value of the paint attribute of this style.
- Returns:
- paint value
getStroke
public java.awt.Stroke getStroke()
- Returns the value of the stroke attribute of this style.
- Returns:
- stroke value
getTransform
public java.awt.geom.AffineTransform getTransform()
- Returns the value of the transform attribute of this style.
- Returns:
- transform value
getRenderingHints
public java.util.Map getRenderingHints()
- Returns the value of the renderingHints attribute of this style.
- Returns:
- rendering hints value
getClip
public java.awt.Shape getClip()
- Returns the value of the clip attribute of this style.
- Returns:
- clip value
getStringBounds
public 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
.
- Parameters:
string
- the specified String
context
- the specified FontRenderingContext
- Returns:
- a
Rectangle2D
that is the bounding box of
the specified String
getShapeBounds
public java.awt.Rectangle getShapeBounds(java.awt.Shape shape)
- Returns bounding box of the specified shape according to
transform attribute.
- Parameters:
shape
- the specified shape
- Returns:
- a
Rectangle
that is the bounding box of
the specified shape
getShapeBounds2D
public java.awt.geom.Rectangle2D getShapeBounds2D(java.awt.Shape shape)
- Returns high precision bounding box of the specified shape
according to transform attribute.
- Parameters:
shape
- the specified shape
- Returns:
- a
Rectangle2D
that is the bounding box of
the specified shape
shapeIntersects
public 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.
- Parameters:
shape
- the specified shaperectangle
- the given rectangle
- Returns:
true
if the specified shape intersects with
the given rectangle; false
otherwise
shapeContains
public boolean shapeContains(java.awt.Shape shape,
java.awt.geom.Rectangle2D rectangle)
- Tests if the specified shape contains the given rectangle
according to transform attribute.
- Parameters:
shape
- the specified shaperectangle
- the given rectangle
- Returns:
true
if the specified shape contains
the given rectangle; false
otherwise
shapeContains
public boolean shapeContains(java.awt.Shape shape,
java.awt.geom.Point2D point)
- Tests if the specified shape contains the given point
according to transform attribute.
- Parameters:
shape
- the specified shapepoint
- the given point
- Returns:
true
if the specified shape contains
the given point; false
otherwise
createStrokedShape
public 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.
- Parameters:
shape
- the specified shape
- Returns:
- the stroked outline Shape
equals
public boolean equals(java.lang.Object object)
- Checks whether two styles are equal. The result is
true
if and only if the argument is not
null
and is a Style
object
that has the same attributes as this Style
.
- Parameters:
object
- the Object
to compare with
this Style
- Returns:
true
if the objects are equal;
false
otherwise.
hashCode
public int hashCode()
- Returns the hashcode for this style.
- Returns:
- a hash code for this style.
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD