public final class PSGr
extends java.awt.Graphics
HACK: Currently, the bounding box exactly covers the JavaView display although it should cover only the visible geometry lying within the display. Also, if the geometry extends outside the display then the PS is not clipped here.
Modifier and Type | Field and Description |
---|---|
static int |
CLONE |
Constructor and Description |
---|
PSGr(java.awt.Graphics gr,
int what) |
PSGr(java.awt.Graphics gr,
java.lang.String name,
int width,
int height)
Constructs a new PSGr Object.
|
Modifier and Type | Method and Description |
---|---|
void |
boundingBox(int xMin,
int yMin,
int xMax,
int yMax)
Insert bounding box statement for eps files.
|
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) |
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
Copies an area of the screen.
|
java.awt.Graphics |
create()
Creates a new PSGr Object that is a copy of the original PSGr Object.
|
java.awt.Graphics |
create(int x,
int y,
int width,
int height)
Creates a new Graphics Object with the specified parameters,
based on the original graphics object.
|
void |
dispose()
Disposes of this graphics context.
|
boolean |
doImage(java.awt.Image img,
int xInt,
int yInt,
int widthInt,
int heightInt,
java.awt.image.ImageObserver observer,
java.awt.Color bgcolor) |
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. 0 degrees is at the 3-o'clock position.Positive arc
angles indicate counter-clockwise rotations, negative arc angles are
drawn clockwise.
|
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(java.awt.Image img,
int x,
int y,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Draws the specified image at the specified coordinate (x, y).
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
java.awt.image.ImageObserver observer)
Draws the specified image at the specified coordinate (x, y).
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Draws the specified image inside the specified rectangle.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
Draws the specified image inside the specified rectangle.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
int x1,
int x2,
int x3,
int x4,
java.awt.Color col,
java.awt.image.ImageObserver observer) |
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
int x1,
int x2,
int x3,
int x4,
java.awt.image.ImageObserver observer) |
void |
drawLine(int x1Int,
int y1Int,
int x2Int,
int y2Int)
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(java.awt.Polygon p)
Draws a polygon defined by the specified point.
|
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints) |
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(java.text.AttributedCharacterIterator iterator,
int x,
int y)
Draws the text given by the specified iterator, using this
graphics context's current color.
|
void |
drawString(java.lang.String str,
int x,
int y)
Draws the specified String using the current font and color.
|
void |
emitThis(java.lang.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(java.awt.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.
|
void |
flush() |
java.awt.Shape |
getClip() |
java.awt.Rectangle |
getClipBounds()
Returns the bounding rectangle of the current clipping area.
|
java.awt.Color |
getColor()
Gets the current color.
|
java.awt.Font |
getFont()
Gets the current font.
|
java.awt.FontMetrics |
getFontMetrics()
Gets the current font metrics.
|
java.awt.FontMetrics |
getFontMetrics(java.awt.Font font)
Gets the current font metrics for the specified font.
|
void |
grestore() |
void |
gsave() |
void |
print(double x) |
void |
print(float x) |
void |
print(int x) |
void |
print(java.lang.String text)
Following print methods avoid exchange of all print-statements in PSGr.
|
void |
println(double x) |
void |
println(float x) |
void |
println(int x) |
void |
println(java.lang.String text) |
void |
scale(float sx,
float sy)
Scales the graphics context.
|
void |
setBackground(java.awt.Color col)
Gets the current color.
|
void |
setClip(int xInt,
int yInt,
int widthInt,
int heightInt)
Clips to a rectangle.
|
void |
setClip(java.awt.Shape shape) |
void |
setColor(java.awt.Color col)
Sets the current color to the specified color.
|
void |
setFont(java.awt.Font font)
Sets the font for all subsequent text-drawing operations.
|
void |
setPaintMode()
Sets the default paint mode to overwrite the destination with the
current color.
|
void |
setXORMode(java.awt.Color col)
Sets the paint mode to alternate between the current color
and the new specified color.
|
void |
setZoom(float zoom)
Set zoom factor to undo previous pixel scaling.
|
java.lang.String |
toString()
Create a string representation of the PostScript image.
|
void |
translate(int x,
int y)
Translates the specified parameters into the origin of
the graphics context.
|
public static final int CLONE
public PSGr(java.awt.Graphics gr, java.lang.String name, int width, int height)
gr
- Graphics object of panelname
- Name of geometrywidth
- the width of the drawing regionheight
- the height of the drawing regioncreate()
public PSGr(java.awt.Graphics gr, int what)
public java.lang.String toString()
toString
in class java.awt.Graphics
public void setZoom(float zoom)
public java.awt.Graphics create()
create
in class java.awt.Graphics
public java.awt.Graphics create(int x, int y, int width, int height)
create
in class java.awt.Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the areaheight
- the height of the areatranslate(int, int)
public void translate(int x, int y)
translate
in class java.awt.Graphics
x
- the x coordinatey
- the y coordinatem_scale
public void boundingBox(int xMin, int yMin, int xMax, int yMax)
public void scale(float sx, float sy)
sx
- the scaled x coordinatesy
- the scaled y coordinatetranslate(int, int)
public java.awt.Color getColor()
getColor
in class java.awt.Graphics
setColor(java.awt.Color)
public void setBackground(java.awt.Color col)
setColor(java.awt.Color)
public void setColor(java.awt.Color col)
setColor
in class java.awt.Graphics
col
- the color to be setColor
,
getColor()
public void setPaintMode()
setPaintMode
in class java.awt.Graphics
public void setXORMode(java.awt.Color col)
setXORMode
in class java.awt.Graphics
col
- The second colorpublic java.awt.Font getFont()
getFont
in class java.awt.Graphics
public void setFont(java.awt.Font font)
setFont
in class java.awt.Graphics
font
- the specified fontgetFont()
,
drawBytes(byte[], int, int, int, int)
,
drawChars(char[], int, int, int, int)
public java.awt.FontMetrics getFontMetrics()
getFontMetrics
in class java.awt.Graphics
getFont()
public java.awt.FontMetrics getFontMetrics(java.awt.Font font)
getFontMetrics
in class java.awt.Graphics
font
- the specified fontgetFont()
public java.awt.Rectangle getClipBounds()
getClipBounds
in class java.awt.Graphics
m_clipRect
public void setClip(int xInt, int yInt, int widthInt, int heightInt)
setClip
in class java.awt.Graphics
xInt
- the x coordinateyInt
- the y coordinatewidthInt
- the width of the rectangleheightInt
- the height of the rectanglegetClipBounds()
public void copyArea(int x, int y, int width, int height, int dx, int dy)
copyArea
in class java.awt.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 x1Int, int y1Int, int x2Int, int y2Int)
drawLine
in class java.awt.Graphics
x1Int
- the first point's x coordinatey1Int
- the first point's y coordinatex2Int
- the second point's x coordinatey2Int
- the second point's y coordinatepublic void fillRect(int x, int y, int width, int height)
fillRect
in class java.awt.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 java.awt.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 java.awt.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)
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
drawRoundRect
in class java.awt.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 java.awt.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 java.awt.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 java.awt.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 java.awt.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 java.awt.Graphics
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangledrawOval(int, int, int, int)
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
drawArc
in class java.awt.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 java.awt.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)
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
drawPolygon
in class java.awt.Graphics
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointsfillPolygon(Polygon)
public void drawPolygon(java.awt.Polygon p)
drawPolygon
in class java.awt.Graphics
p
- the specified polygonfillPolygon(Polygon)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
fillPolygon
in class java.awt.Graphics
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointsdrawPolygon(Polygon)
public void fillPolygon(java.awt.Polygon p)
fillPolygon
in class java.awt.Graphics
p
- the polygondrawPolygon(Polygon)
public void drawString(java.lang.String str, int x, int y)
drawString
in class java.awt.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(java.text.AttributedCharacterIterator iterator, int x, int y)
drawString
in class java.awt.Graphics
iterator
- the iterator whose text is to be drawnx
- the x coordinate.y
- the y coordinate.Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawChars(char[], int, int, int, int)
public void drawChars(char[] data, int offset, int length, int x, int y)
drawChars
in class java.awt.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 coordinatedrawBytes(byte[], int, int, int, int)
public void drawBytes(byte[] data, int offset, int length, int x, int y)
drawBytes
in class java.awt.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 coordinatedrawChars(char[], int, int, int, int)
public boolean doImage(java.awt.Image img, int xInt, int yInt, int widthInt, int heightInt, java.awt.image.ImageObserver observer, java.awt.Color bgcolor)
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.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(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.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(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.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(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.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 java.awt.Graphics
finalize()
public void finalize()
finalize
in class java.awt.Graphics
dispose()
public void gsave()
public void grestore()
public void emitThis(java.lang.String s)
public java.awt.Shape getClip()
getClip
in class java.awt.Graphics
public void setClip(java.awt.Shape shape)
setClip
in class java.awt.Graphics
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, int x1, int x2, int x3, int x4, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.Graphics
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, int x1, int x2, int x3, int x4, java.awt.Color col, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.Graphics
public void clipRect(int x, int y, int width, int height)
clipRect
in class java.awt.Graphics
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
drawPolyline
in class java.awt.Graphics
public void print(java.lang.String text)
public void println(java.lang.String text)
public void print(int x)
public void print(float x)
public void print(double x)
public void println(int x)
public void println(float x)
public void println(double x)
public void flush()
"