Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
Graphics2D
org.jfree.pixie.AbstractGraphics2D
org.jfree.pixie.g2recorder.G2Recorder
public class G2Recorder
extends AbstractGraphics2D
Constructor Summary | |
|
Method Summary | |
protected void |
|
void |
|
void |
|
void |
|
Graphics |
|
void |
|
void |
|
boolean |
|
void |
|
void |
|
void |
|
Color |
|
Shape |
|
Composite |
|
GraphicsConfiguration |
|
Font |
|
FontMetrics |
|
FontRenderContext |
|
Paint |
|
Object |
|
RenderingHints |
|
G2OpStore |
|
Stroke |
|
AffineTransform |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
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 |
public void addRenderingHints(Map hints)
Sets the values of an arbitrary number of preferences for the rendering algorithms. Only values for the rendering hints that are present in the specifiedMap
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 theRenderingHints
class for definitions of some common keys and values.
- Parameters:
hints
- the rendering hints to be set
- See Also:
RenderingHints
public void clip(Shape s)
Intersects the currentClip
with the interior of the specifiedShape
and sets theClip
to the resulting intersection. The specifiedShape
is transformed with the currentGraphics2D
Transform
before being intersected with the currentClip
. This method is used to make the currentClip
smaller. To make theClip
larger, usesetClip
. 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 usingsetClip
with anull
argument, the specifiedShape
becomes the new user clip.
- Parameters:
s
- theShape
to be intersected with the currentClip
. Ifs
isnull
, this method clears the currentClip
.
public void copyArea(int x, int y, int width, int height, int dx, int dy)
Copies an area of the component by a distance specified bydx
anddy
. From the point specified byx
andy
, this method copies downwards and to the right. To copy an area of the component to the left or upwards, specify a negative value fordx
ordy
. 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'spaint
method.
- Parameters:
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 Graphics create()
Creates a newGraphics
object that is a copy of thisGraphics
object.
- Returns:
- a new graphics context that is a copy of this graphics context.
public void dispose()
Disposes of this graphics context and releases any system resources that it is using. AGraphics
object cannot be used afterdispose
has been called. When a Java program runs, a large number ofGraphics
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 thepaint
andupdate
methods of components are automatically released by the system when those methods return. For efficiency, programmers should calldispose
when finished using aGraphics
object only if it was created directly from a component or anotherGraphics
object.
- See Also:
Graphics.finalize
,java.awt.Component.paint
,java.awt.Component.update
,java.awt.Component.getGraphics
,Graphics.create
public void draw(Shape s)
Strokes the outline of aShape
using the settings of the currentGraphics2D
context. The rendering attributes applied include theClip
,Transform
,Paint
,Composite
andStroke
attributes.
- Parameters:
s
- theShape
to be rendered
- See Also:
setStroke(Stroke)
,setPaint(Paint)
,Graphics.setColor
,transform
,setTransform(AffineTransform)
,clip
,setClip(Shape)
,setComposite(Composite)
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)
Renders an image, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the currentTransform
in theGraphics2D
. The specified transformation is applied to the image before the transform attribute in theGraphics2D
context is applied. The rendering attributes applied include theClip
,Transform
, andComposite
attributes. Note that no rendering is done if the specified transform is noninvertible.
- Parameters:
img
- theImage
to be renderedxform
- the transformation from image space into user spaceobs
- theImageObserver
to be notified as more of theImage
is converted
- Returns:
true
if theImage
is fully loaded and completely rendered;false
if theImage
is still being loaded.
public void drawRenderedImage(RenderedImage img, AffineTransform xform)
Renders aRenderedImage
, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the currentTransform
in theGraphics2D
. The specified transformation is applied to the image before the transform attribute in theGraphics2D
context is applied. The rendering attributes applied include theClip
,Transform
, andComposite
attributes. Note that no rendering is done if the specified transform is noninvertible.
- Parameters:
img
- the image to be renderedxform
- the transformation from image space into user space
public void drawString(String s, float x, float y)
Renders the text specified by the specifiedString
, using the currentFont
andPaint
attributes in theGraphics2D
context. The baseline of the first character is at position (x, y) in the User Space. The rendering attributes applied include theClip
,Transform
,Paint
,Font
andComposite
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.
- Parameters:
s
- theString
to be renderedx
- the coordinates where the iterator's text is to be renderedy
- the coordinates where the iterator's text is to be rendered
- See Also:
setPaint(Paint)
,Graphics.setColor
,Graphics.setFont
,setTransform(AffineTransform)
,setComposite(Composite)
,setClip(Shape)
public void fill(Shape s)
Fills the interior of aShape
using the settings of theGraphics2D
context. The rendering attributes applied include theClip
,Transform
,Paint
, andComposite
.
- Parameters:
s
- theShape
to be filled
- See Also:
setPaint(Paint)
,Graphics.setColor
,transform
,setTransform(AffineTransform)
,setComposite(Composite)
,clip
,setClip(Shape)
public Color getBackground()
Returns the background color used for clearing a region.
- Returns:
- the current
Graphics2D
Color
, which defines the background color.
- See Also:
setBackground(Color)
public Shape getClip()
Gets the current clipping area. This method returns the user clip, which is independent of the clipping associated with device bounds and window visibility. If no clip has previously been set, or if the clip has been cleared usingsetClip(null)
, this method returnsnull
.
- Returns:
- a
Shape
object representing the current clipping area, ornull
if no clip is set.
- Since:
- JDK1.1
- See Also:
Graphics.getClipBounds
,Graphics.clipRect
,Graphics.setClip(int, int, int, int)
,Graphics.setClip(Shape)
public Composite getComposite()
Returns the currentComposite
in theGraphics2D
context.
- Returns:
- the current
Graphics2D
Composite
, which defines a compositing style.
- See Also:
setComposite(Composite)
public GraphicsConfiguration getDeviceConfiguration()
Returns the device configuration associated with thisGraphics2D
.
public Font getFont()
Gets the current font.
- Returns:
- this graphics context's current font.
- See Also:
Font
,Graphics.setFont
public FontMetrics getFontMetrics(Font f)
Gets the font metrics for the specified font.
- Parameters:
f
- the specified font
- Returns:
- the font metrics for the specified font.
- See Also:
Graphics.getFont
,FontMetrics
,Graphics.getFontMetrics()
public FontRenderContext getFontRenderContext()
Get the rendering context of theFont
within thisGraphics2D
context. TheFontRenderContext
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 asFont
andTextLayout
. 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.
- Returns:
- a reference to an instance of FontRenderContext.
- Since:
- 1.2
- See Also:
FontRenderContext
,Font.createGlyphVector
,java.awt.font.TextLayout
public Paint getPaint()
Returns the currentPaint
of theGraphics2D
context.
- Returns:
- the current
Graphics2D
Paint
, which defines a color or pattern.
- See Also:
setPaint(Paint)
,Graphics.setColor
public Object getRenderingHint(RenderingHints.Key hintKey)
Returns the value of a single preference for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to theRenderingHints
class for definitions of some common keys and values.
- Parameters:
hintKey
- the key corresponding to the hint to get.
- Returns:
- an object representing the value for the specified hint key. Some of the keys and their associated values are defined in the
RenderingHints
class.
- See Also:
RenderingHints
public RenderingHints getRenderingHints()
Gets the preferences for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Returns all of the hint key/value pairs that were ever specified in one operation. Refer to theRenderingHints
class for definitions of some common keys and values.
- Returns:
- a reference to an instance of
RenderingHints
that contains the current preferences.
- See Also:
RenderingHints
public Stroke getStroke()
Returns the currentStroke
in theGraphics2D
context.
- Returns:
- the current
Graphics2D
Stroke
, which defines the line style.
- See Also:
setStroke(Stroke)
public AffineTransform getTransform()
Returns a copy of the currentTransform
in theGraphics2D
context.
- Returns:
- the current
AffineTransform
in theGraphics2D
context.
- See Also:
transform
,setTransform(AffineTransform)
public void setBackground(Color color)
Sets the background color for theGraphics2D
context. The background color is used for clearing a region. When aGraphics2D
is constructed for aComponent
, the background color is inherited from theComponent
. Setting the background color in theGraphics2D
context only affects the subsequentclearRect
calls and not the background color of theComponent
. To change the background of theComponent
, use appropriate methods of theComponent
.
- Parameters:
color
- the background color that isused in subsequent calls toclearRect
- See Also:
getBackground()
,Graphics.clearRect
public void setClip(Shape clip)
Sets the current clipping area to an arbitrary clip shape. Not all objects that implement theShape
interface can be used to set the clip. The onlyShape
objects that are guaranteed to be supported areShape
objects that are obtained via thegetClip
method and viaRectangle
objects. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility.
- Parameters:
clip
- theShape
to use to set the clip
- Since:
- JDK1.1
- See Also:
Graphics.getClip()
,Graphics.clipRect
,Graphics.setClip(int, int, int, int)
public void setComposite(Composite comp)
Sets theComposite
for theGraphics2D
context. TheComposite
is used in all drawing methods such asdrawImage
,drawString
,draw
, andfill
. It specifies how new pixels are to be combined with the existing pixels on the graphics device during the rendering process. If thisGraphics2D
context is drawing to aComponent
on the display screen and theComposite
is a custom object rather than an instance of theAlphaComposite
class, and if there is a security manager, itscheckPermission
method is called with anAWTPermission("readDisplayPixels")
permission.
- Parameters:
comp
- theComposite
object to be used for rendering
- See Also:
Graphics.setXORMode
,Graphics.setPaintMode
,AlphaComposite
,SecurityManager.checkPermission
,java.awt.AWTPermission
public void setFont(Font font)
Sets this graphics context's font to the specified font. All subsequent text operations using this graphics context use this font.
- Parameters:
font
- the font.
- See Also:
Graphics.getFont
,Graphics.drawString(String, int, int)
,Graphics.drawBytes(byte[], int, int, int, int)
,Graphics.drawChars(char[], int, int, int, int)
public void setPaint(Paint paint)
Sets thePaint
attribute for theGraphics2D
context. Calling this method with anull
Paint
object does not have any effect on the currentPaint
attribute of thisGraphics2D
.
- Parameters:
paint
- thePaint
object to be used to generate color during the rendering process, ornull
- See Also:
Graphics.setColor
,java.awt.GradientPaint
,java.awt.TexturePaint
public void setPaintMode()
Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color. This sets the logical pixel operation function to the paint or overwrite mode. All subsequent rendering operations will overwrite the destination with the current color.
public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
Sets the value of a single preference for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to theRenderingHints
class for definitions of some common keys and values.
- Parameters:
hintKey
- the key of the hint to be set.hintValue
- the value indicating preferences for the specified hint category.
- See Also:
RenderingHints
public void setRenderingHints(Map hints)
Replaces the values of all preferences for the rendering algorithms with the specifiedhints
. The existing values for all rendering hints are discarded and the new set of known hints and values are initialized from the specifiedMap
object. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to theRenderingHints
class for definitions of some common keys and values.
- Parameters:
hints
- the rendering hints to be set
- See Also:
RenderingHints
public void setStroke(Stroke s)
Sets theStroke
for theGraphics2D
context.
- Parameters:
s
- theStroke
object to be used to stroke aShape
during the rendering process
- See Also:
BasicStroke
public void setTransform(AffineTransform Tx)
Sets theTransform
in theGraphics2D
context.
- Parameters:
Tx
- theAffineTransform
object to be used in the rendering process
- See Also:
transform
,AffineTransform
public void setXORMode(Color c1)
Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color. This specifies that logical pixel operations are performed in the XOR mode, which alternates pixels between the current color and a specified XOR color. 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.
- Parameters:
c1
- the XOR alternation color