APIdia Launch Partner
Top Description Fields Constructors Methods
sun.print

pack-priv Class PSPathGraphics

extends PathGraphics
Class Inheritance
Imports
java.awt.Color, .Font, .Graphics, .Graphics2D, .Image, .Shape, .Transparency, java.awt.font.FontRenderContext, .TextLayout, java.awt.geom.AffineTransform, .Area, .PathIterator, .Point2D, .Rectangle2D, .Line2D, java.awt.image.BufferedImage, sun.awt.image.ByteComponentRaster, java.awt.print.PageFormat, .Printable, .PrinterException, .PrinterJob

This class converts paths into PostScript by breaking all graphics into fills and clips of paths.

Field Summary

Modifier and TypeField and Description
private static final int
DEFAULT_USER_RES

For a drawing application the initial user space resolution is 72dpi.

Inherited from sun.print.PathGraphics:
fontMapRefprintingGlyphVector

Constructor Summary

AccessConstructor and Description
pack-priv
PSPathGraphics(Graphics2D graphics, PrinterJob printerJob, Printable painter, PageFormat pageFormat, int pageIndex, boolean canRedraw)

Method Summary

Modifier and TypeMethod and Description
protected boolean
public Graphics

Returns:

a new graphics context that is a copy of this graphics context.
create
()

Overrides sun.print.ProxyGraphics2D.create.

Creates a new Graphics object that is a copy of this Graphics object.

protected void
protected void
deviceDrawLine(int xBegin, int yBegin, int xEnd, int yEnd, Color color)

Implements abstract sun.print.PathGraphics.deviceDrawLine.

protected void
deviceFill(PathIterator pathIter, Color color)

Implements abstract sun.print.PathGraphics.deviceFill.

Fill the path defined by pathIter with the specified color.

protected void
deviceFillRect(int x, int y, int width, int height, Color color)

Implements abstract sun.print.PathGraphics.deviceFillRect.

protected void
deviceFrameRect(int x, int y, int width, int height, Color color)

Implements abstract sun.print.PathGraphics.deviceFrameRect.

protected boolean
drawImageToPlatform(Image
The image to be drawn. This method does nothing if img is null.
image
,
AffineTransform
Used to transform the image before drawing. This can be null.
xform
,
Color
This color is drawn where the image has transparent pixels. If this parameter is null then the pixels already in the destination should show through.
bgcolor
,
int
With srcY this defines the upper-left corner of the portion of the image to be drawn.
srcX
,
int
With srcX this defines the upper-left corner of the portion of the image to be drawn.
srcY
,
int
The width of the portion of the image to be drawn.
srcWidth
,
int
The height of the portion of the image to be drawn.
srcHeight
,
boolean
if being recursively called to print opaque region of transparent image
handlingTransparency
)

Implements abstract sun.print.PathGraphics.drawImageToPlatform.

The various drawImage() methods for WPathGraphics are all decomposed into an invocation of drawImageToPlatform.

public void
drawString(String
the string to be drawn.
str
,
int
the x coordinate.
x
,
int
the y coordinate.
y
)

Overrides sun.print.PathGraphics.drawString.

Draws the text given by the specified string, using this graphics context's current font and color.

public void
drawString(String
the String to be rendered
str
,
float x, float y)

Overrides sun.print.PathGraphics.drawString.

Renders the text specified by the specified String, using the current Font and Paint attributes in the Graphics2D context.

protected void
drawString(String str, float x, float y, Font font, FontRenderContext frc, float w)

Overrides sun.print.PathGraphics.drawString.

public void
fill(Shape s, Color color)

Overrides sun.print.PathGraphics.fill.

Override the inherited implementation of fill so that we can generate PostScript in user space rather than device space.

protected int
public void
redrawRegion(Rectangle2D region, double scaleX, double scaleY, Shape savedClip, AffineTransform savedTransform)

Implements abstract sun.print.PathGraphics.redrawRegion.

Redraw a rectangular area using a proxy graphics To do this we need to know the rectangular area to redraw and the transform & clip in effect at the time of the original drawImage

Inherited from sun.print.PathGraphics:
canDoRedrawsclearRectconvertToBufferedImagedrawdrawArcdrawBitmaskImagedrawGlyphVectordrawImagedrawImagedrawImagedrawImagedrawImagedrawImagedrawImagedrawImagedrawLinedrawOvaldrawPolygondrawPolygondrawPolylinedrawRectdrawRenderedImagedrawRoundRectdrawStringdrawStringfillfillArcfillOvalfillPolygonfillPolygonfillRectfillRoundRectgetBufferedImagegetPageFormatgetPageIndexgetPrintablehasTransparentPixelsisBitmaskTransparencyisCompositingprintedSimpleGlyphVectorprintGlyphVector

Field Detail

DEFAULT_USER_RESback to summary
private static final int DEFAULT_USER_RES

For a drawing application the initial user space resolution is 72dpi.

Constructor Detail

PSPathGraphicsback to summary
pack-priv PSPathGraphics(Graphics2D graphics, PrinterJob printerJob, Printable painter, PageFormat pageFormat, int pageIndex, boolean canRedraw)

Method Detail

canDrawStringToWidthback to summary
protected boolean canDrawStringToWidth()

Overrides sun.print.PathGraphics.canDrawStringToWidth.

createback to summary
public Graphics create()

Overrides sun.print.ProxyGraphics2D.create.

Creates a new Graphics object that is a copy of this Graphics object.

Returns:Graphics

a new graphics context that is a copy of this graphics context.

Since
1.0
deviceClipback to summary
protected void deviceClip(PathIterator pathIter)

Implements abstract sun.print.PathGraphics.deviceClip.

deviceDrawLineback to summary
protected void deviceDrawLine(int xBegin, int yBegin, int xEnd, int yEnd, Color color)

Implements abstract sun.print.PathGraphics.deviceDrawLine.

deviceFillback to summary
protected void deviceFill(PathIterator pathIter, Color color)

Implements abstract sun.print.PathGraphics.deviceFill.

Doc from sun.print.PathGraphics.deviceFill.

Fill the path defined by pathIter with the specified color. The path is provided in device coordinates.

deviceFillRectback to summary
protected void deviceFillRect(int x, int y, int width, int height, Color color)

Implements abstract sun.print.PathGraphics.deviceFillRect.

deviceFrameRectback to summary
protected void deviceFrameRect(int x, int y, int width, int height, Color color)

Implements abstract sun.print.PathGraphics.deviceFrameRect.

drawImageToPlatformback to summary
protected boolean drawImageToPlatform(Image image, AffineTransform xform, Color bgcolor, int srcX, int srcY, int srcWidth, int srcHeight, boolean handlingTransparency)

Implements abstract sun.print.PathGraphics.drawImageToPlatform.

The various drawImage() methods for WPathGraphics are all decomposed into an invocation of drawImageToPlatform. The portion of the passed in image defined by srcX, srcY, srcWidth, and srcHeight is transformed by the supplied AffineTransform and drawn using PS to the printer context.

Parameters
image:Image

The image to be drawn. This method does nothing if img is null.

xform:AffineTransform

Used to transform the image before drawing. This can be null.

bgcolor:Color

This color is drawn where the image has transparent pixels. If this parameter is null then the pixels already in the destination should show through.

srcX:int

With srcY this defines the upper-left corner of the portion of the image to be drawn.

srcY:int

With srcX this defines the upper-left corner of the portion of the image to be drawn.

srcWidth:int

The width of the portion of the image to be drawn.

srcHeight:int

The height of the portion of the image to be drawn.

handlingTransparency:boolean

if being recursively called to print opaque region of transparent image

drawStringback to summary
public void drawString(String str, int x, int y)

Overrides sun.print.PathGraphics.drawString.

Draws the text given by the specified string, using this graphics context's current font and color. The baseline of the first character is at position (x, y) in this graphics context's coordinate system.

Parameters
str:String

the string to be drawn.

x:int

the x coordinate.

y:int

the y coordinate.

Since
1.0
See Also
java.awt.Graphics#drawBytes, java.awt.Graphics#drawChars
drawStringback to summary
public void drawString(String str, float x, float y)

Overrides sun.print.PathGraphics.drawString.

Renders the text specified by the specified 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.

Parameters
str:String

the String to be rendered

See Also
setPaint, java.awt.Graphics#setColor, java.awt.Graphics#setFont, setTransform, setComposite, setClip
drawStringback to summary
protected void drawString(String str, float x, float y, Font font, FontRenderContext frc, float w)

Overrides sun.print.PathGraphics.drawString.

fillback to summary
public void fill(Shape s, Color color)

Overrides sun.print.PathGraphics.fill.

Override the inherited implementation of fill so that we can generate PostScript in user space rather than device space.

platformFontCountback to summary
protected int platformFontCount(Font font, String str)

Overrides sun.print.PathGraphics.platformFontCount.

redrawRegionback to summary
public void redrawRegion(Rectangle2D region, double scaleX, double scaleY, Shape savedClip, AffineTransform savedTransform) throws PrinterException

Implements abstract sun.print.PathGraphics.redrawRegion.

Redraw a rectangular area using a proxy graphics To do this we need to know the rectangular area to redraw and the transform & clip in effect at the time of the original drawImage