|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Graphics | +--gov.sandia.postscript.PSGrBase
PSGr is a Graphics subclass that images to PostScript. (C) 1996 E.J. Friedman-Hill and Sandia National Labs
Field Summary | |
---|---|
protected Color |
backClr
The background color of the current widget. |
protected static int |
charsPerRow
number of chars in a full row of pixel data |
protected Rectangle |
clippingRect
|
protected Color |
clr
The current color |
static boolean |
DEBUG
|
protected Font |
font
The current font |
protected static char[] |
hd
hexadecimal digits |
protected PrintWriter |
os
Output stream where postscript goes |
protected static int |
PAGEHEIGHT
|
protected static int |
PAGEWIDTH
|
protected static int |
XOFFSET
|
protected static int |
YOFFSET
|
Constructor Summary | |
---|---|
PSGrBase()
Constructs a new PSGr Object that write to stdout. |
|
PSGrBase(Writer w)
Constructs a new PSGr Object. |
|
PSGrBase(Writer w,
boolean emitProlog)
Constructs a new PSGr Object. |
Method Summary | |
---|---|
protected void |
arcTo(int x1,
int y1,
int x2,
int y2,
int dim)
|
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. |
void |
clipRect(int x,
int y,
int width,
int height)
Deprecated. |
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
Copies an area of the screen. |
Graphics |
create()
Creates a new PSGr Object that is a copy of the original PSGr Object. |
protected void |
diagnostic(String s)
|
void |
dispose()
Disposes of this graphics context. |
protected void |
doArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle,
boolean fill)
|
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)
|
protected void |
doPoly(int[] xPoints,
int[] yPoints,
int nPoints,
boolean fill,
boolean close)
|
protected void |
doRect(int x,
int y,
int width,
int height,
boolean fill)
|
protected void |
doRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight,
boolean fill)
|
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draws a highlighted 3-D rectangle. |
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. |
void |
drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
Draws the specified bytes using the current font and color. |
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
Draws the specified characters using the current font and color. |
boolean |
drawImage(Image img,
int x,
int y,
Color bgcolor,
ImageObserver observer)
Draws the specified image at the specified coordinate (x, y). |
boolean |
drawImage(Image img,
int x,
int y,
ImageObserver observer)
Draws the specified image at the specified coordinate (x, y). |
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
Color bgcolor,
ImageObserver observer)
Draws the specified image inside the specified rectangle. |
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
ImageObserver observer)
Draws the specified image inside the specified rectangle. |
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 |
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 |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line between the coordinates (x1,y1) and (x2,y2). |
void |
drawOval(int x,
int y,
int width,
int height)
Draws an oval inside the specified rectangle using the current color. |
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a polygon defined by an array of x points and y points. |
void |
drawPolygon(Polygon p)
Draws a polygon defined by the specified point. |
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a polygon defined by an array of x points and y points. |
void |
drawRect(int x,
int y,
int width,
int height)
Draws the outline of the specified rectangle using the current color. |
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws an outlined rounded corner rectangle using the current color. |
void |
drawString(AttributedCharacterIterator ai,
int x,
int y)
|
void |
drawString(String str,
int x,
int y)
Draws the specified String using the current font and color. |
protected void |
emitColorImageProlog(int xdim)
|
protected void |
emitProlog()
Top of every PS file |
void |
emitThis(String s)
|
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
Paints a highlighted 3-D rectangle using the current color. |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Fills an arc using the current color. |
void |
fillOval(int x,
int y,
int width,
int height)
Fills an oval inside the specified rectangle using the current color. |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Fills a polygon with the current color. |
void |
fillPolygon(Polygon p)
Fills the specified polygon with the current color. |
void |
fillRect(int x,
int y,
int width,
int height)
Fills the specified rectangle with the current color. |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a rounded rectangle filled in with the current color. |
void |
finalize()
Disposes of this graphics context once it is no longer referenced. |
Shape |
getClip()
Returns the bounding rectangle of the current clipping area. |
Rectangle |
getClipBounds()
Returns the bounding rectangle of the current clipping area. |
Rectangle |
getClipRect()
Deprecated. |
Color |
getColor()
Gets the current color. |
Font |
getFont()
Gets the current font. |
FontMetrics |
getFontMetrics()
Gets the current font metrics. |
FontMetrics |
getFontMetrics(Font f)
Gets the current font metrics for the specified font. |
void |
grestore()
|
void |
gsave()
|
protected void |
lineto(int x,
int y)
|
protected void |
moveto(int x,
int y)
|
protected void |
scale(double x,
double y)
Scales the graphics context. |
void |
setBackground(Color c)
Gets the current color. |
void |
setClip(int x,
int y,
int width,
int height)
Clips to a rectangle. |
void |
setClip(Shape s)
Sets the clipping region using the shape's bounding rectangle. |
void |
setColor(Color c)
Sets the current color to the specified color. |
void |
setFont(Font f)
Sets the font for all subsequent text-drawing operations. |
void |
setOutput(Writer w)
Change the Writer this context's output goes to. |
void |
setPaintMode()
Sets the default paint mode to overwrite the destination with the current color. |
void |
setXORMode(Color c1)
Sets the paint mode to alternate between the current color and the new specified color. |
protected void |
stroke(boolean fill)
|
String |
toString()
Returns a String object representing this Graphic's value. |
protected int |
transformY(int y)
Flip Y coords so Postscript looks like Java |
void |
translate(int x,
int y)
Translates the specified parameters into the origin of the graphics context. |
Methods inherited from class java.awt.Graphics |
---|
create, getClipBounds, hitClip |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final boolean DEBUG
protected static final int PAGEHEIGHT
protected static final int PAGEWIDTH
protected static final int XOFFSET
protected static final int YOFFSET
protected static final char[] hd
protected static final int charsPerRow
protected PrintWriter os
protected Color clr
protected Color backClr
protected Font font
protected Rectangle clippingRect
Constructor Detail |
public PSGrBase()
public PSGrBase(Writer w)
o
- Output stream for PostScript outputpublic PSGrBase(Writer w, boolean emitProlog)
o
- Output stream for PostScript outputMethod Detail |
public Graphics create()
create
in class Graphics
public void setOutput(Writer w)
public void translate(int x, int y)
translate
in class Graphics
x
- the x coordinatey
- the y coordinatescale(double, double)
protected void scale(double x, double y)
sx
- the scaled x coordinatesy
- the scaled y coordinatetranslate(int, int)
protected void lineto(int x, int y)
protected void moveto(int x, int y)
public Color getColor()
getColor
in class Graphics
setColor(java.awt.Color)
public void setBackground(Color c)
setColor(java.awt.Color)
public void setColor(Color c)
setColor
in class Graphics
c
- the color to be setColor
,
getColor()
public void setPaintMode()
setPaintMode
in class Graphics
public void setXORMode(Color c1)
setXORMode
in class Graphics
c1
- the second colorpublic Font getFont()
getFont
in class Graphics
setFont(java.awt.Font)
public void setFont(Font f)
setFont
in class Graphics
font
- the specified fontFont
,
getFont()
,
drawString(java.lang.String, int, int)
,
drawBytes(byte[], int, int, int, int)
,
drawChars(char[], int, int, int, int)
public FontMetrics getFontMetrics()
getFontMetrics
in class Graphics
getFont()
public FontMetrics getFontMetrics(Font f)
getFontMetrics
in class Graphics
f
- the specified fontgetFont()
,
getFontMetrics()
public Rectangle getClipRect()
getClipRect
in class Graphics
clipRect(int, int, int, int)
,
getClipBounds()
public Shape getClip()
getClip
in class Graphics
clipRect(int, int, int, int)
,
getClipBounds()
public void setClip(Shape s)
setClip
in class Graphics
s
- A shape to set the clipping rectangle topublic Rectangle getClipBounds()
getClipBounds
in class Graphics
clipRect(int, int, int, int)
,
getClipRect()
public void setClip(int x, int y, int width, int height)
setClip
in class Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglegetClipRect()
public void clipRect(int x, int y, int width, int height)
clipRect
in class Graphics
public void copyArea(int x, int y, int width, int height, int dx, int dy)
copyArea
in class Graphics
x
- the x-coordinate of the sourcey
- the y-coordinate of the sourcewidth
- the widthheight
- the heightdx
- the horizontal distancedy
- the vertical distance
Note: copyArea not supported by PostScriptpublic void drawLine(int x1, int y1, int x2, int y2)
drawLine
in class Graphics
x1
- the first point's x coordinatey1
- the first point's y coordinatex2
- the second point's x coordinatey2
- the second point's y coordinateprotected void doRect(int x, int y, int width, int height, boolean fill)
public void fillRect(int x, int y, int width, int height)
fillRect
in class Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangledrawRect(int, int, int, int)
,
clearRect(int, int, int, int)
public void drawRect(int x, int y, int width, int height)
drawRect
in class Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglefillRect(int, int, int, int)
,
clearRect(int, int, int, int)
public void clearRect(int x, int y, int width, int height)
clearRect
in class Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglefillRect(int, int, int, int)
,
drawRect(int, int, int, int)
protected void doRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight, boolean fill)
protected void stroke(boolean fill)
protected void arcTo(int x1, int y1, int x2, int y2, int dim)
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
drawRoundRect
in class Graphics
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 arcfillRoundRect(int, int, int, int, int, int)
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
fillRoundRect
in class Graphics
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 arcdrawRoundRect(int, int, int, int, int, int)
public void draw3DRect(int x, int y, int width, int height, boolean raised)
draw3DRect
in class Graphics
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 notpublic void fill3DRect(int x, int y, int width, int height, boolean raised)
fill3DRect
in class Graphics
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 notpublic void drawOval(int x, int y, int width, int height)
drawOval
in class Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglefillOval(int, int, int, int)
public void fillOval(int x, int y, int width, int height)
fillOval
in class Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangledrawOval(int, int, int, int)
protected void doArc(int x, int y, int width, int height, int startAngle, int arcAngle, boolean fill)
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
drawArc
in class Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglestartAngle
- the beginning anglearcAngle
- the angle of the arc (relative to startAngle).fillArc(int, int, int, int, int, int)
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
fillArc
in class Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the archeight
- the height of the arcstartAngle
- the beginning anglearcAngle
- the angle of the arc (relative to startAngle).drawArc(int, int, int, int, int, int)
protected void doPoly(int[] xPoints, int[] yPoints, int nPoints, boolean fill, boolean close)
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
drawPolyline
in class Graphics
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointsfillPolygon(int[], int[], int)
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
drawPolygon
in class Graphics
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointsfillPolygon(int[], int[], int)
public void drawPolygon(Polygon p)
drawPolygon
in class Graphics
p
- the specified polygonfillPolygon(int[], int[], int)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
fillPolygon
in class Graphics
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointsdrawPolygon(int[], int[], int)
public void fillPolygon(Polygon p)
fillPolygon
in class Graphics
p
- the polygondrawPolygon(int[], int[], int)
public void drawString(String str, int x, int y)
drawString
in class Graphics
str
- the String to be drawnx
- the x coordinatey
- the y coordinatedrawChars(char[], int, int, int, int)
,
drawBytes(byte[], int, int, int, int)
public void drawString(AttributedCharacterIterator ai, int x, int y)
drawString
in class Graphics
public void drawChars(char[] data, int offset, int length, int x, int y)
drawChars
in class Graphics
data
- the array of characters to be drawnoffset
- the start offset in the datalength
- the number of characters to be drawnx
- the x coordinatey
- the y coordinatedrawString(java.lang.String, int, int)
,
drawBytes(byte[], int, int, int, int)
public void drawBytes(byte[] data, int offset, int length, int x, int y)
drawBytes
in class Graphics
data
- the data to be drawnoffset
- the start offset in the datalength
- the number of bytes that are drawnx
- the x coordinatey
- the y coordinatedrawString(java.lang.String, int, int)
,
drawChars(char[], int, int, int, int)
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)
public boolean drawImage(Image img, int x, int y, ImageObserver observer)
drawImage
in class Graphics
img
- the specified image to be drawnx
- the x coordinatey
- the y coordinateobserver
- notifies if the image is complete or notImage
,
ImageObserver
public boolean drawImage(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, ImageObserver observer)
drawImage
in class Graphics
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)
drawImage
in class Graphics
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
drawImage
in class Graphics
img
- the specified image to be drawnx
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangleobserver
- notifies if the image is complete or notImage
,
ImageObserver
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
drawImage
in class Graphics
img
- the specified image to be drawnx
- the x coordinatey
- the y coordinatebgcolor
- the background colorobserver
- notifies if the image is complete or notImage
,
ImageObserver
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
drawImage
in class Graphics
img
- the specified image to be drawnx
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglebgcolor
- the background colorobserver
- notifies if the image is complete or notImage
,
NOTE: PSGr ignores the background color.
public void dispose()
dispose
in class Graphics
finalize()
public void finalize()
finalize
in class Graphics
dispose()
public String toString()
toString
in class Graphics
protected int transformY(int y)
protected void emitProlog()
protected void emitColorImageProlog(int xdim)
public void gsave()
public void grestore()
public void emitThis(String s)
protected void diagnostic(String s)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |