Package rma.util.postscript
Class PSGrBase
java.lang.Object
java.awt.Graphics
java.awt.Graphics2D
rma.util.postscript.PSGrBase
- Direct Known Subclasses:
PSGr2
PSGr is a Graphics subclass that images to PostScript.
(C) 1996 E.J. Friedman-Hill and Sandia National Labs
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ColorThe background color of the current widget.protected static final intnumber of chars in a full row of pixel dataprotected Rectangleprotected ColorThe current colorstatic final booleanprotected FontThe current fontprotected static final char[]hexadecimal digitsprotected PrintWriterOutput stream where postscript goesprotected static final intprotected static final intprotected static final intprotected static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRenderingHints(Map map) protected voidarcTo(int x1, int y1, int x2, int y2, int dim) voidclearRect(int x, int y, int width, int height) Clears the specified rectangle by filling it with the current background color of the current drawing surface.voidvoidclipRect(int x, int y, int width, int height) Deprecated.voidcopyArea(int x, int y, int width, int height, int dx, int dy) Copies an area of the screen.create()Creates a new PSGr Object that is a copy of the original PSGr Object.protected voiddiagnostic(String s) voiddispose()Disposes of this graphics context.protected voiddoArc(int x, int y, int width, int height, int startAngle, int arcAngle, boolean fill) protected booleandoImage(Image img, int x, int y, int width, int height, int sx, int sy, int sw, int sh, ImageObserver observer, Color bgcolor) protected voiddoPoly(int[] xPoints, int[] yPoints, int nPoints, boolean fill, boolean close) protected voiddoRect(int x, int y, int width, int height, boolean fill) protected voiddoRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight, boolean fill) voidvoiddraw3DRect(int x, int y, int width, int height, boolean raised) Draws a highlighted 3-D rectangle.voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle) Draws an arc bounded by the specified rectangle from startAngle to endAngle.voiddrawBytes(byte[] data, int offset, int length, int x, int y) Draws the specified bytes using the current font and color.voiddrawChars(char[] data, int offset, int length, int x, int y) Draws the specified characters using the current font and color.voiddrawGlyphVector(GlyphVector vec, float x, float y) voiddrawImage(BufferedImage image, BufferedImageOp op, int x, int y) booleandrawImage(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, Color c, ImageObserver observer) Warning this is not yet supportedbooleandrawImage(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, ImageObserver observer) Warning this is not yet supportedbooleandrawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws the specified image inside the specified rectangle.booleandrawImage(Image img, int x, int y, int width, int height, ImageObserver observer) Draws the specified image inside the specified rectangle.booleandrawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) Draws the specified image at the specified coordinate (x, y).booleandrawImage(Image img, int x, int y, ImageObserver observer) Draws the specified image at the specified coordinate (x, y).booleandrawImage(Image image, AffineTransform xform, ImageObserver observer) voiddrawLine(int x1, int y1, int x2, int y2) Draws a line between the coordinates (x1,y1) and (x2,y2).voiddrawOval(int x, int y, int width, int height) Draws an oval inside the specified rectangle using the current color.voiddrawPolygon(int[] xPoints, int[] yPoints, int nPoints) Draws a polygon defined by an array of x points and y points.voidDraws a polygon defined by the specified point.voiddrawPolyline(int[] xPoints, int[] yPoints, int nPoints) Draws a polygon defined by an array of x points and y points.voiddrawRect(int x, int y, int width, int height) Draws the outline of the specified rectangle using the current color.voiddrawRenderableImage(RenderableImage image, AffineTransform xform) voiddrawRenderedImage(RenderedImage img, AffineTransform xform) voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws an outlined rounded corner rectangle using the current color.voiddrawString(String s, float x, float y) voiddrawString(String str, int x, int y) Draws the specified String using the current font and color.voiddrawString(AttributedCharacterIterator iterator, float x, float y) protected voidemitColorImageProlog(int xdim) protected voidTop of every PS filevoidvoidvoidfill3DRect(int x, int y, int width, int height, boolean raised) Paints a highlighted 3-D rectangle using the current color.voidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle) Fills an arc using the current color.voidfillOval(int x, int y, int width, int height) Fills an oval inside the specified rectangle using the current color.voidfillPolygon(int[] xPoints, int[] yPoints, int nPoints) Fills a polygon with the current color.voidFills the specified polygon with the current color.voidfillRect(int x, int y, int width, int height) Fills the specified rectangle with the current color.voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws a rounded rectangle filled in with the current color.voidfinalize()Disposes of this graphics context once it is no longer referenced.getClip()Returns the bounding rectangle of the current clipping area.Returns the bounding rectangle of the current clipping area.Deprecated.getColor()Gets the current color.getFont()Gets the current font.Gets the current font metrics.Gets the current font metrics for the specified font.getPaint()voidgrestore()voidgsave()booleanprotected voidlineto(int x, int y) protected voidmoveto(int x, int y) voidrotate(double theta) voidrotate(double theta, double x, double y) voidscale(double x, double y) Scales the graphics context.voidGets the current color.voidsetClip(int x, int y, int width, int height) Clips to a rectangle.voidSets the clipping region using the shape's bounding rectangle.voidSets the current color to the specified color.voidprotected voidsetdash(float[] dashstyle, float dashphase) voidSets the font for all subsequent text-drawing operations.voidChange the Writer this context's output goes to.voidvoidSets the default paint mode to overwrite the destination with the current color.voidsetRenderingHint(RenderingHints.Key kintKey, Object hintValue) voidsetRenderingHints(Map hints) voidvoidsetTransform(AffineTransform xform) voidsetXORMode(Color c1) Sets the paint mode to alternate between the current color and the new specified color.voidshear(double shx, double shy) protected voidstroke(boolean fill) toString()Returns a String object representing this Graphic's value.voidtransform(AffineTransform xform) protected inttransformY(int y) Flip Y coords so Postscript looks like Javavoidtranslate(double x, double y) voidtranslate(int x, int y) Translates the specified parameters into the origin of the graphics context.Methods inherited from class java.awt.Graphics2D
drawStringMethods inherited from class java.awt.Graphics
create, getClipBounds, hitClip
-
Field Details
-
DEBUG
public static final boolean DEBUG- See Also:
-
PAGEHEIGHT
protected static final int PAGEHEIGHT- See Also:
-
PAGEWIDTH
protected static final int PAGEWIDTH- See Also:
-
XOFFSET
protected static final int XOFFSET- See Also:
-
YOFFSET
protected static final int YOFFSET- See Also:
-
hd
protected static final char[] hdhexadecimal digits -
charsPerRow
protected static final int charsPerRownumber of chars in a full row of pixel data- See Also:
-
os
Output stream where postscript goes -
clr
The current color -
backClr
The background color of the current widget. It's up to the client software to set this correctly! -
font
The current font -
clippingRect
-
-
Constructor Details
-
PSGrBase
public PSGrBase()Constructs a new PSGr Object that write to stdout. Unlike regular Graphics objects, PSGr contexts can be created directly. -
PSGrBase
Constructs a new PSGr Object. Unlike regular Graphics objects, PSGr contexts can be created directly.- Parameters:
w- Output stream for PostScript output
-
PSGrBase
Constructs a new PSGr Object. Unlike regular Graphics objects, PSGr contexts can be created directly.- Parameters:
w- Output stream for PostScript output
-
-
Method Details
-
create
Creates a new PSGr Object that is a copy of the original PSGr Object. Not implemented; throws RuntimeException -
setOutput
Change the Writer this context's output goes to. -
translate
public void translate(int x, int y) Translates the specified parameters into the origin of the graphics context. All subsequent operations on this graphics context will be relative to this origin.- Specified by:
translatein classGraphics2D- Parameters:
x- the x coordinatey- the y coordinate- See Also:
-
scale
public void scale(double x, double y) Scales the graphics context. All subsequent operations on this graphics context will be affected.- Specified by:
scalein classGraphics2D- Parameters:
x- the scaled x coordinatey- the scaled y coordinate- See Also:
-
lineto
protected void lineto(int x, int y) -
moveto
protected void moveto(int x, int y) -
getColor
Gets the current color. -
setBackground
Gets the current color.- Specified by:
setBackgroundin classGraphics2D- See Also:
-
setColor
Sets the current color to the specified color. All subsequent graphics operations will use this specified color. -
setPaintMode
public void setPaintMode()Sets the default paint mode to overwrite the destination with the current color. PostScript has only paint mode.- Specified by:
setPaintModein classGraphics
-
setXORMode
Sets the paint mode to alternate between the current color and the new specified color. PostScript does not support XOR mode.- Specified by:
setXORModein classGraphics- Parameters:
c1- the second color
-
getFont
Gets the current font. -
setFont
Sets the font for all subsequent text-drawing operations. -
getFontMetrics
Gets the current font metrics.- Overrides:
getFontMetricsin classGraphics- See Also:
-
getFontMetrics
Gets the current font metrics for the specified font.- Specified by:
getFontMetricsin classGraphics- Parameters:
f- the specified font- See Also:
-
getClipRect
Deprecated.Returns the bounding rectangle of the current clipping area.- Overrides:
getClipRectin classGraphics- See Also:
-
getClip
Returns the bounding rectangle of the current clipping area. -
setClip
Sets the clipping region using the shape's bounding rectangle. -
getClipBounds
Returns the bounding rectangle of the current clipping area.- Specified by:
getClipBoundsin classGraphics- Returns:
- the bounding rectangle
- See Also:
-
setClip
public void setClip(int x, int y, int width, int height) Clips to a rectangle. The resulting clipping area is the intersection of the current clipping area and the specified rectangle. Graphic operations have no effect outside of the clipping area. -
clipRect
Deprecated. -
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy) Copies an area of the screen. -
drawLine
public void drawLine(int x1, int y1, int x2, int y2) Draws a line between the coordinates (x1,y1) and (x2,y2). The line is drawn below and to the left of the logical coordinates. -
doRect
protected void doRect(int x, int y, int width, int height, boolean fill) -
fillRect
public void fillRect(int x, int y, int width, int height) Fills the specified rectangle with the current color. -
drawRect
public void drawRect(int x, int y, int width, int height) Draws the outline of the specified rectangle using the current color. Use drawRect(x, y, width-1, height-1) to draw the outline inside the specified rectangle. -
clearRect
public void clearRect(int x, int y, int width, int height) Clears the specified rectangle by filling it with the current background color of the current drawing surface. Which drawing surface it selects depends on how the graphics context was created. -
doRoundRect
protected void doRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight, boolean fill) -
stroke
protected void stroke(boolean fill) -
arcTo
protected void arcTo(int x1, int y1, int x2, int y2, int dim) -
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws an outlined rounded corner rectangle using the current color.- Specified by:
drawRoundRectin classGraphics- Parameters:
x- the x coordinatey- the y coordinatewidth- the width of the rectangleheight- the height of the rectanglearcWidth- the diameter of the arcarcHeight- the radius of the arc- See Also:
-
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws a rounded rectangle filled in with the current color.- Specified by:
fillRoundRectin classGraphics- Parameters:
x- the x coordinatey- the y coordinatewidth- the width of the rectangleheight- the height of the rectanglearcWidth- the diameter of the arcarcHeight- the radius of the arc- See Also:
-
draw3DRect
public void draw3DRect(int x, int y, int width, int height, boolean raised) Draws a highlighted 3-D rectangle.- Overrides:
draw3DRectin classGraphics2D- Parameters:
x- the x coordinatey- the y coordinatewidth- the width of the rectangleheight- the height of the rectangleraised- a boolean that states whether the rectangle is raised or not
-
fill3DRect
public void fill3DRect(int x, int y, int width, int height, boolean raised) Paints a highlighted 3-D rectangle using the current color.- Overrides:
fill3DRectin classGraphics2D- Parameters:
x- the x coordinatey- the y coordinatewidth- the width of the rectangleheight- the height of the rectangleraised- a boolean that states whether the rectangle is raised or not
-
drawOval
public void drawOval(int x, int y, int width, int height) Draws an oval inside the specified rectangle using the current color. -
fillOval
public void fillOval(int x, int y, int width, int height) Fills an oval inside the specified rectangle using the current color. -
doArc
protected void doArc(int x, int y, int width, int height, int startAngle, int arcAngle, boolean fill) -
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) Draws an arc bounded by the specified rectangle from startAngle to endAngle. 0 degrees is at the 3-o'clock position.Positive arc angles indicate counter-clockwise rotations, negative arc angles are drawn clockwise. -
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) Fills an arc using the current color. This generates a pie shape. -
doPoly
protected void doPoly(int[] xPoints, int[] yPoints, int nPoints, boolean fill, boolean close) -
drawPolyline
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) Draws a polygon defined by an array of x points and y points.- Specified by:
drawPolylinein classGraphics- Parameters:
xPoints- an array of x pointsyPoints- an array of y pointsnPoints- the total number of points- See Also:
-
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) Draws a polygon defined by an array of x points and y points.- Specified by:
drawPolygonin classGraphics- Parameters:
xPoints- an array of x pointsyPoints- an array of y pointsnPoints- the total number of points- See Also:
-
drawPolygon
Draws a polygon defined by the specified point.- Overrides:
drawPolygonin classGraphics- Parameters:
p- the specified polygon- See Also:
-
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) Fills a polygon with the current color.- Specified by:
fillPolygonin classGraphics- Parameters:
xPoints- an array of x pointsyPoints- an array of y pointsnPoints- the total number of points- See Also:
-
fillPolygon
Fills the specified polygon with the current color.- Overrides:
fillPolygonin classGraphics- Parameters:
p- the polygon- See Also:
-
drawString
Draws the specified String using the current font and color. The x,y position is the starting point of the baseline of the String.- Specified by:
drawStringin classGraphics2D- Parameters:
str- the String to be drawnx- the x coordinatey- the y coordinate- See Also:
-
drawChars
public void drawChars(char[] data, int offset, int length, int x, int y) Draws the specified characters using the current font and color. -
drawBytes
public void drawBytes(byte[] data, int offset, int length, int x, int y) Draws the specified bytes using the current font and color. -
doImage
protected boolean doImage(Image img, int x, int y, int width, int height, int sx, int sy, int sw, int sh, ImageObserver observer, Color bgcolor) -
drawImage
Draws the specified image at the specified coordinate (x, y). If the image is incomplete the image observer will be notified later. -
drawImage
public boolean drawImage(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, ImageObserver observer) Warning this is not yet supported -
drawImage
public boolean drawImage(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, Color c, ImageObserver observer) Warning this is not yet supported -
drawImage
Draws the specified image inside the specified rectangle. The image is scaled if necessary. If the image is incomplete the image observer will be notified later. -
drawImage
Draws the specified image at the specified coordinate (x, y). If the image is incomplete the image observer will be notified later. -
drawImage
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws the specified image inside the specified rectangle. The image is scaled if necessary. If the image is incomplete the image observer will be notified later. -
dispose
public void dispose()Disposes of this graphics context. The Graphics context cannot be used after being disposed of. -
finalize
public void finalize()Disposes of this graphics context once it is no longer referenced. -
toString
Returns a String object representing this Graphic's value. -
transformY
protected int transformY(int y) Flip Y coords so Postscript looks like Java -
emitProlog
protected void emitProlog()Top of every PS file -
emitColorImageProlog
protected void emitColorImageProlog(int xdim) -
gsave
public void gsave() -
grestore
public void grestore() -
emitThis
-
diagnostic
-
setdash
protected void setdash(float[] dashstyle, float dashphase) -
rotate
public void rotate(double theta) - Specified by:
rotatein classGraphics2D
-
rotate
public void rotate(double theta, double x, double y) - Specified by:
rotatein classGraphics2D
-
getComposite
- Specified by:
getCompositein classGraphics2D
-
drawString
- Specified by:
drawStringin classGraphics2D
-
drawRenderableImage
- Specified by:
drawRenderableImagein classGraphics2D
-
drawRenderedImage
- Specified by:
drawRenderedImagein classGraphics2D
-
addRenderingHints
- Specified by:
addRenderingHintsin classGraphics2D
-
getRenderingHint
- Specified by:
getRenderingHintin classGraphics2D
-
getRenderingHints
- Specified by:
getRenderingHintsin classGraphics2D
-
setRenderingHint
- Specified by:
setRenderingHintin classGraphics2D
-
setRenderingHints
- Specified by:
setRenderingHintsin classGraphics2D
-
getPaint
- Specified by:
getPaintin classGraphics2D
-
hit
- Specified by:
hitin classGraphics2D
-
drawGlyphVector
- Specified by:
drawGlyphVectorin classGraphics2D
-
setComposite
- Specified by:
setCompositein classGraphics2D
-
draw
- Specified by:
drawin classGraphics2D
-
drawImage
- Specified by:
drawImagein classGraphics2D
-
drawImage
- Specified by:
drawImagein classGraphics2D
-
shear
public void shear(double shx, double shy) - Specified by:
shearin classGraphics2D
-
clip
- Specified by:
clipin classGraphics2D
-
fill
- Specified by:
fillin classGraphics2D
-
transform
- Specified by:
transformin classGraphics2D
-
drawString
- Specified by:
drawStringin classGraphics2D
-
getTransform
- Specified by:
getTransformin classGraphics2D
-
setTransform
- Specified by:
setTransformin classGraphics2D
-
getBackground
- Specified by:
getBackgroundin classGraphics2D
-
getDeviceConfiguration
- Specified by:
getDeviceConfigurationin classGraphics2D
-
getFontRenderContext
- Specified by:
getFontRenderContextin classGraphics2D
-
setPaint
- Specified by:
setPaintin classGraphics2D
-
translate
public void translate(double x, double y) - Specified by:
translatein classGraphics2D
-
getStroke
- Specified by:
getStrokein classGraphics2D
-
setStroke
- Specified by:
setStrokein classGraphics2D
-