|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Graphics
java.awt.Graphics2D
org.jfree.pixie.AbstractGraphics2D
org.jfree.pixie.wmf.WmfGraphics2D
Constructor Summary | |
WmfGraphics2D()
|
Method Summary | |
void |
addRenderingHints(java.util.Map hints)
Sets the values of an arbitrary number of preferences for the rendering algorithms. |
void |
clip(java.awt.Shape s)
Intersects the current Clip with the interior of the
specified Shape and sets the Clip to the
resulting intersection. |
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
Copies an area of the component by a distance specified by dx and dy . |
java.awt.Graphics |
create()
Creates a new Graphics object that is
a copy of this Graphics object. |
void |
dispose()
Disposes of this graphics context and releases any system resources that it is using. |
void |
draw(java.awt.Shape s)
Strokes the outline of a Shape using the settings of the
current Graphics2D context. |
boolean |
drawImage(java.awt.Image img,
java.awt.geom.AffineTransform xform,
java.awt.image.ImageObserver obs)
Renders an image, applying a transform from image space into user space before drawing. |
void |
drawRenderedImage(java.awt.image.RenderedImage img,
java.awt.geom.AffineTransform xform)
Renders a RenderedImage ,
applying a transform from image
space into user space before drawing.
|
void |
drawString(java.lang.String s,
float x,
float y)
Renders the text specified by the specified String ,
using the current Font and Paint attributes
in the Graphics2D context.
|
void |
fill(java.awt.Shape s)
Fills the interior of a Shape using the settings of the
Graphics2D context. |
java.awt.Color |
getBackground()
Returns the background color used for clearing a region. |
java.awt.Shape |
getClip()
Gets the current clipping area. |
java.awt.Composite |
getComposite()
Returns the current Composite in the
Graphics2D context. |
java.awt.GraphicsConfiguration |
getDeviceConfiguration()
Returns the device configuration associated with this Graphics2D . |
java.awt.Font |
getFont()
Gets the current font. |
java.awt.FontMetrics |
getFontMetrics(java.awt.Font f)
Gets the font metrics for the specified font. |
java.awt.font.FontRenderContext |
getFontRenderContext()
Get the rendering context of the Font within this
Graphics2D context.
|
java.awt.Paint |
getPaint()
Returns the current Paint of the
Graphics2D context. |
java.lang.Object |
getRenderingHint(java.awt.RenderingHints.Key hintKey)
Returns the value of a single preference for the rendering algorithms. |
java.awt.RenderingHints |
getRenderingHints()
Gets the preferences for the rendering algorithms. |
java.awt.Stroke |
getStroke()
Returns the current Stroke in the
Graphics2D context. |
java.awt.geom.AffineTransform |
getTransform()
Returns a copy of the current Transform in the
Graphics2D context. |
void |
setBackground(java.awt.Color color)
Sets the background color for the Graphics2D context.
|
void |
setClip(java.awt.Shape clip)
Sets the current clipping area to an arbitrary clip shape. |
void |
setComposite(java.awt.Composite comp)
Sets the Composite for the Graphics2D context.
|
void |
setFont(java.awt.Font font)
Sets this graphics context's font to the specified font. |
void |
setPaint(java.awt.Paint paint)
Sets the Paint attribute for the
Graphics2D context. |
void |
setPaintMode()
Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color. |
void |
setRenderingHint(java.awt.RenderingHints.Key hintKey,
java.lang.Object hintValue)
Sets the value of a single preference for the rendering algorithms. |
void |
setRenderingHints(java.util.Map hints)
Replaces the values of all preferences for the rendering algorithms with the specified hints .
|
void |
setStroke(java.awt.Stroke s)
Sets the Stroke for the Graphics2D context. |
void |
setTransform(java.awt.geom.AffineTransform Tx)
Sets the Transform in the Graphics2D
context. |
void |
setXORMode(java.awt.Color c1)
Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color. |
Methods inherited from class org.jfree.pixie.AbstractGraphics2D |
clearRect, clipRect, drawArc, drawGlyphVector, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRenderableImage, drawRoundRect, drawString, drawString, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, getClipBounds, getColor, hit, rotate, rotate, scale, setClip, setColor, shear, transform, translate, translate |
Methods inherited from class java.awt.Graphics2D |
draw3DRect, fill3DRect |
Methods inherited from class java.awt.Graphics |
create, drawBytes, drawChars, drawPolygon, drawRect, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public WmfGraphics2D()
Method Detail |
public void draw(java.awt.Shape s)
Shape
using the settings of the
current Graphics2D
context. The rendering attributes
applied include the Clip
, Transform
,
Paint
, Composite
and
Stroke
attributes.
s
- the Shape
to be renderedsetStroke(java.awt.Stroke)
,
setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
,
AbstractGraphics2D.transform(java.awt.geom.AffineTransform)
,
setTransform(java.awt.geom.AffineTransform)
,
clip(java.awt.Shape)
,
setClip(java.awt.Shape)
,
setComposite(java.awt.Composite)
public boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver obs)
Transform
in the Graphics2D
.
The specified transformation is applied to the image before the
transform attribute in the Graphics2D
context is applied.
The rendering attributes applied include the Clip
,
Transform
, and Composite
attributes.
Note that no rendering is done if the specified transform is
noninvertible.
img
- the Image
to be renderedxform
- the transformation from image space into user spaceobs
- the ImageObserver
to be notified as more of the Image
is converted
true
if the Image
is
fully loaded and completely rendered;
false
if the Image
is still being loaded.AbstractGraphics2D.transform(java.awt.geom.AffineTransform)
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
clip(java.awt.Shape)
,
setClip(java.awt.Shape)
public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
RenderedImage
,
applying a transform from image
space into user space before drawing.
The transformation from user space into device space is done with
the current Transform
in the Graphics2D
.
The specified transformation is applied to the image before the
transform attribute in the Graphics2D
context is applied.
The rendering attributes applied include the Clip
,
Transform
, and Composite
attributes. Note
that no rendering is done if the specified transform is
noninvertible.
img
- the image to be renderedxform
- the transformation from image space into user spaceAbstractGraphics2D.transform(java.awt.geom.AffineTransform)
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
clip(java.awt.Shape)
,
setClip(java.awt.Shape)
public void drawString(java.lang.String s, float x, float y)
String
,
using the current Font
and Paint
attributes
in the Graphics2D
context.
The baseline of the first character is at position
(x, y) in the User Space.
The rendering attributes applied include the Clip
,
Transform
, Paint
, Font
and
Composite
attributes. For characters in script systems
such as Hebrew and Arabic, the glyphs can be rendered from right to
left, in which case the coordinate supplied is the location of the
leftmost character on the baseline.
s
- the String
to be renderedx
- the x-coordinates where the String
should be renderedy
- the y-coordinates where the String
should be rendered
java.lang.NullPointerException
- if str
is
null
setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
,
Graphics.setFont(java.awt.Font)
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
setClip(java.awt.Shape)
public void fill(java.awt.Shape s)
Shape
using the settings of the
Graphics2D
context. The rendering attributes applied
include the Clip
, Transform
,
Paint
, and Composite
.
s
- the Shape
to be filledsetPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
,
AbstractGraphics2D.transform(java.awt.geom.AffineTransform)
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
clip(java.awt.Shape)
,
setClip(java.awt.Shape)
public java.awt.GraphicsConfiguration getDeviceConfiguration()
Graphics2D
.
public void setComposite(java.awt.Composite comp)
Composite
for the Graphics2D
context.
The Composite
is used in all drawing methods such as
drawImage
, drawString
, draw
,
and fill
. It specifies how new pixels are to be combined
with the existing pixels on the graphics device during the rendering
process.
If this Graphics2D
context is drawing to a
Component
on the display screen and the
Composite
is a custom object rather than an
instance of the AlphaComposite
class, and if
there is a security manager, its checkPermission
method is called with an AWTPermission("readDisplayPixels")
permission.
comp
- the Composite
object to be used for rendering
java.lang.SecurityException
- if a custom Composite
object is being
used to render to the screen and a security manager
is set and its checkPermission
method
does not allow the operation.Graphics.setXORMode(java.awt.Color)
,
Graphics.setPaintMode()
,
AlphaComposite
,
SecurityManager.checkPermission(java.security.Permission)
,
AWTPermission
public void setPaint(java.awt.Paint paint)
Paint
attribute for the
Graphics2D
context. Calling this method
with a null
Paint
object does
not have any effect on the current Paint
attribute
of this Graphics2D
.
paint
- the Paint
object to be used to generate
color during the rendering process, or null
Graphics.setColor(java.awt.Color)
,
GradientPaint
,
TexturePaint
public void setStroke(java.awt.Stroke s)
Stroke
for the Graphics2D
context.
s
- the Stroke
object to be used to stroke a
Shape
during the rendering processBasicStroke
public void setRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)
RenderingHints
class for definitions of some common
keys and values.
hintKey
- the key of the hint to be set.hintValue
- the value indicating preferences for the specified
hint category.RenderingHints
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key hintKey)
RenderingHints
class for definitions of some common
keys and values.
hintKey
- the key corresponding to the hint to get.
RenderingHints
class.RenderingHints
public void setRenderingHints(java.util.Map hints)
hints
.
The existing values for all rendering hints are discarded and
the new set of known hints and values are initialized from the
specified Map
object.
Hint categories include controls for rendering quality and
overall time/quality trade-off in the rendering process.
Refer to the RenderingHints
class for definitions of
some common keys and values.
hints
- the rendering hints to be setRenderingHints
public void addRenderingHints(java.util.Map hints)
Map
object are modified.
All other preferences not present in the specified
object are left unmodified.
Hint categories include controls for rendering quality and
overall time/quality trade-off in the rendering process.
Refer to the RenderingHints
class for definitions of
some common keys and values.
hints
- the rendering hints to be setRenderingHints
public java.awt.RenderingHints getRenderingHints()
RenderingHints
class for definitions of some common
keys and values.
RenderingHints
that contains the current preferences.RenderingHints
public void setTransform(java.awt.geom.AffineTransform Tx)
Transform
in the Graphics2D
context.
Tx
- the AffineTransform
object to be used in the
rendering processAbstractGraphics2D.transform(java.awt.geom.AffineTransform)
,
AffineTransform
public java.awt.geom.AffineTransform getTransform()
Transform
in the
Graphics2D
context.
AffineTransform
in the
Graphics2D
context.AbstractGraphics2D.transform(java.awt.geom.AffineTransform)
,
setTransform(java.awt.geom.AffineTransform)
public java.awt.Paint getPaint()
Paint
of the
Graphics2D
context.
Graphics2D
Paint
,
which defines a color or pattern.setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
public java.awt.Composite getComposite()
Composite
in the
Graphics2D
context.
Graphics2D
Composite
,
which defines a compositing style.setComposite(java.awt.Composite)
public void setBackground(java.awt.Color color)
Graphics2D
context.
The background color is used for clearing a region.
When a Graphics2D
is constructed for a
Component
, the background color is
inherited from the Component
. Setting the background color
in the Graphics2D
context only affects the subsequent
clearRect
calls and not the background color of the
Component
. To change the background
of the Component
, use appropriate methods of
the Component
.
color
- the background color that isused in
subsequent calls to clearRect
getBackground()
,
Graphics.clearRect(int, int, int, int)
public java.awt.Color getBackground()
Graphics2D
Color
,
which defines the background color.setBackground(java.awt.Color)
public java.awt.Stroke getStroke()
Stroke
in the
Graphics2D
context.
Graphics2D
Stroke
,
which defines the line style.setStroke(java.awt.Stroke)
public void clip(java.awt.Shape s)
Clip
with the interior of the
specified Shape
and sets the Clip
to the
resulting intersection. The specified Shape
is
transformed with the current Graphics2D
Transform
before being intersected with the current
Clip
. This method is used to make the current
Clip
smaller.
To make the Clip
larger, use setClip
.
The user clip modified by this method is independent of the
clipping associated with device bounds and visibility. If no clip has
previously been set, or if the clip has been cleared using
setClip
with a null
argument, the specified Shape
becomes the new
user clip.
s
- the Shape
to be intersected with the current
Clip
. If s
is null
,
this method clears the current Clip
.public java.awt.font.FontRenderContext getFontRenderContext()
Font
within this
Graphics2D
context.
The FontRenderContext
encapsulates application hints such as anti-aliasing and
fractional metrics, as well as target device specific information
such as dots-per-inch. This information should be provided by the
application when using objects that perform typographical
formatting, such as Font
and
TextLayout
. This information should also be provided
by applications that perform their own layout and need accurate
measurements of various characteristics of glyphs such as advance
and line height when various rendering hints have been applied to
the text rendering.
FontRenderContext
,
Font.createGlyphVector(java.awt.font.FontRenderContext, char[])
,
TextLayout
public java.awt.Graphics create()
Graphics
object that is
a copy of this Graphics
object.
public void setPaintMode()
public void setXORMode(java.awt.Color c1)
When drawing operations are performed, pixels which are the current color are changed to the specified color, and vice versa.
Pixels that are of colors other than those two colors are changed in an unpredictable but reversible manner; if the same figure is drawn twice, then all pixels are restored to their original values.
c1
- the XOR alternation colorpublic java.awt.Font getFont()
Font
,
Graphics.setFont(java.awt.Font)
public void setFont(java.awt.Font font)
font
- the font.Graphics.getFont()
,
Graphics.drawString(String, int, int)
,
Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawChars(char[], int, int, int, int)
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
f
- the specified font
Graphics.getFont()
,
FontMetrics
,
Graphics.getFontMetrics()
public java.awt.Shape getClip()
setClip(null)
, this method returns
null
.
Shape
object representing the
current clipping area, or null
if
no clip is set.Graphics.getClipBounds()
,
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(int, int, int, int)
,
Graphics.setClip(Shape)
public void setClip(java.awt.Shape clip)
Shape
interface can be used to set the clip. The only
Shape
objects that are guaranteed to be
supported are Shape
objects that are
obtained via the getClip
method and via
Rectangle
objects. This method sets the
user clip, which is independent of the clipping associated
with device bounds and window visibility.
clip
- the Shape
to use to set the clipGraphics.getClip()
,
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(int, int, int, int)
public void copyArea(int x, int y, int width, int height, int dx, int dy)
dx
and dy
. From the point specified
by x
and y
, this method
copies downwards and to the right. To copy an area of the
component to the left or upwards, specify a negative value for
dx
or dy
.
If a portion of the source rectangle lies outside the bounds
of the component, or is obscured by another window or component,
copyArea
will be unable to copy the associated
pixels. The area that is omitted can be refreshed by calling
the component's paint
method.
x
- the x coordinate of the source rectangle.y
- the y coordinate of the source rectangle.width
- the width of the source rectangle.height
- the height of the source rectangle.dx
- the horizontal distance to copy the pixels.dy
- the vertical distance to copy the pixels.public void dispose()
Graphics
object cannot be used after
dispose
has been called.
When a Java program runs, a large number of Graphics
objects can be created within a short time frame.
Although the finalization process of the garbage collector
also disposes of the same system resources, it is preferable
to manually free the associated resources by calling this
method rather than to rely on a finalization process which
may not run to completion for a long period of time.
Graphics objects which are provided as arguments to the
paint
and update
methods
of components are automatically released by the system when
those methods return. For efficiency, programmers should
call dispose
when finished using
a Graphics
object only if it was created
directly from a component or another Graphics
object.
Graphics.finalize()
,
Component.paint(java.awt.Graphics)
,
Component.update(java.awt.Graphics)
,
Component.getGraphics()
,
Graphics.create()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |