Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.awt.Graphics | +----java.awt.Graphics2D | +----java.awt.print.ProxyGraphics2D | +----java.awt.print.PeekGraphics
Inner Class Summary | |
PeekGraphics.ImageWaiter
|
Fields inherited from class java.awt.Graphics2D |
ANTIALIAS_DEFAULT, ANTIALIAS_OFF, ANTIALIAS_ON, ANTIALIASING, RENDER_DEFAULT, RENDER_QUALITY, RENDER_SPEED, RENDERING |
Constructor Summary | |
PeekGraphics(Graphics2D graphics,
PageContext pageContext)
|
Method Summary | |
void | clearRect(int x,
int y,
int width,
int height)
|
void | draw(Shape s)
|
void | drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
|
boolean | drawImage(Image img,
int x,
int y,
ImageObserver observer)
|
boolean | drawImage(Image img,
int x,
int y,
int width,
int height,
ImageObserver observer)
|
boolean | drawImage(Image img,
int x,
int y,
Color bgcolor,
ImageObserver observer)
|
boolean | drawImage(Image img,
int x,
int y,
int width,
int height,
Color bgcolor,
ImageObserver observer)
|
boolean | drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
ImageObserver observer)
|
boolean | drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
Color bgcolor,
ImageObserver observer)
|
void | drawImage(Image img,
AffineTransform xform,
ImageObserver obs)
|
void | drawImage(BufferedImage img,
BufferedImageOp op,
int x,
int y)
|
void | drawLine(int x1,
int y1,
int x2,
int y2)
(x1, y1) and (x2, y2)
in this graphics context's coordinate system.
|
void | drawOval(int x,
int y,
int width,
int height)
|
void | drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
|
void | drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
|
void | drawRenderableImage(RenderableImage img,
AffineTransform xfrom,
Hashtable renderHints,
Hashtable renderHintsObserved)
|
void | drawRenderedImage(RenderedImage img,
AffineTransform xform)
|
void | drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
|
void | drawString(String str,
int x,
int y)
|
void | drawString(String s,
float x,
float y)
|
void | drawString(StyledString s,
float x,
float y)
|
void | drawString(GlyphSet g,
float x,
float y)
|
void | drawString(TextLayout text,
float x,
float y)
|
void | fill(Shape s)
|
void | fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
|
void | fillOval(int x,
int y,
int width,
int height)
|
void | fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
|
void | fillRect(int x,
int y,
int width,
int height)
|
void | fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
|
Area | getDrawingArea()
|
boolean | imageUpdate(Image img,
int infoFlags,
int x,
int y,
int width,
int height)
|
void | rotate(double theta)
|
void | rotate(double theta,
double x,
double y)
|
void | scale(double sx,
double sy)
|
void | shear(double shx,
double shy)
|
void | translate(double tx,
double ty)
|
void | translate(int x,
int y)
|
Methods inherited from class java.awt.print.ProxyGraphics2D |
clearRect, clip, clipRect, copyArea, create, dispose, draw, drawArc, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRenderableImage, drawRenderedImage, drawRoundRect, drawString, drawString, drawString, drawString, drawString, fill, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, getBackground, getClip, getClipBounds, getColor, getComposite, getDelegate, getDeviceConfiguration, getFont, getFontMetrics, getPageFormat, getPageIndex, getPageName, getPagePainter, getPaint, getRenderingHints, getStroke, getTransform, hit, hitString, rotate, rotate, scale, setBackground, setClip, setClip, setColor, setComposite, setDelegate, setFont, setPaint, setPaintMode, setRenderingHints, setStroke, setTransform, setXORMode, shear, transform, translate, translate |
Methods inherited from class java.awt.Graphics2D |
clip, draw, drawImage, drawImage, drawRenderableImage, drawRenderedImage, drawString, drawString, drawString, drawString, fill, getBackground, getComposite, getDeviceConfiguration, getPaint, getRenderingHints, getStroke, getTransform, hit, hitString, rotate, rotate, scale, setBackground, setComposite, setPaint, setRenderingHints, setStroke, setTransform, shear, transform, translate, translate |
Methods inherited from class java.awt.Graphics |
clearRect, clipRect, copyArea, create, create, dispose, draw3DRect, drawArc, drawBytes, drawChars, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, fill3DRect, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillRoundRect, finalize, getClip, getClipBounds, getClipBounds, getClipRect, getColor, getFont, getFontMetrics, getFontMetrics, hitClip, setClip, setClip, setColor, setFont, setPaintMode, setXORMode, toString, translate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PeekGraphics(Graphics2D graphics, PageContext pageContext)
Method Detail |
public Area getDrawingArea()
public void drawLine(int x1, int y1, int x2, int y2)
(x1, y1)
and (x2, y2)
in this graphics context's coordinate system.
x1
- the first point's x coordinate.
y1
- the first point's y coordinate.
x2
- the second point's x coordinate.
y2
- the second point's y coordinate.
public void fillRect(int x, int y, int width, int height)
x
and x + width - 1
.
The top and bottom edges are at
y
and y + height - 1
.
The resulting rectangle covers an area
width
pixels wide by
height
pixels tall.
The rectangle is filled using the graphics context's current color.
x
- the x coordinate
of the rectangle to be filled.
y
- the y coordinate
of the rectangle to be filled.
width
- the width of the rectangle to be filled.
height
- the height of the rectangle to be filled.
public void clearRect(int x, int y, int width, int height)
Beginning with Java 1.1, the background color
of offscreen images may be system dependent. Applications should
use setColor
followed by fillRect
to
ensure that an offscreen image is cleared to a specific color.
x
- the x coordinate of the rectangle to clear.
y
- the y coordinate of the rectangle to clear.
width
- the width of the rectangle to clear.
height
- the height of the rectangle to clear.
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
and x + width
,
respectively. The top and bottom edges of the rectangle are at
y
and y + height
.
x
- the x coordinate of the rectangle to be drawn.
y
- the y coordinate of the rectangle to be drawn.
width
- the width of the rectangle to be drawn.
height
- the height of the rectangle to be drawn.
arcWidth
- the horizontal diameter of the arc
at the four corners.
arcHeight
- the vertical diameter of the arc
at the four corners.
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
and x + width - 1
,
respectively. The top and bottom edges of the rectangle are at
y
and y + height - 1
.
x
- the x coordinate of the rectangle to be filled.
y
- the y coordinate of the rectangle to be filled.
width
- the width of the rectangle to be filled.
height
- the height of the rectangle to be filled.
arcWidth
- the horizontal diameter
of the arc at the four corners.
arcHeight
- the vertical diameter
of the arc at the four corners.
public void drawOval(int x, int y, int width, int height)
x
, y
,
width
, and height
arguments.
The oval covers an area that is
width + 1
pixels wide
and height + 1
pixels tall.
x
- the x coordinate of the upper left
corner of the oval to be drawn.
y
- the y coordinate of the upper left
corner of the oval to be drawn.
width
- the width of the oval to be drawn.
height
- the height of the oval to be drawn.
public void fillOval(int x, int y, int width, int height)
x
- the x coordinate of the upper left corner
of the oval to be filled.
y
- the y coordinate of the upper left corner
of the oval to be filled.
width
- the width of the oval to be filled.
height
- the height of the oval to be filled.
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
The resulting arc begins at startAngle
and extends
for arcAngle
degrees, using the current color.
Angles are interpreted such that 0 degrees
is at the 3 o'clock position.
A positive value indicates a counter-clockwise rotation
while a negative value indicates a clockwise rotation.
The center of the arc is the center of the rectangle whose origin
is (x, y) and whose size is specified by the
width
and height
arguments.
The resulting arc covers an area
width + 1
pixels wide
by height + 1
pixels tall.
x
- the x coordinate of the
upper-left corner of the arc to be drawn.
y
- the y coordinate of the
upper-left corner of the arc to be drawn.
width
- the width of the arc to be drawn.
height
- the height of the arc to be drawn.
startAngle
- the beginning angle.
arcAngle
- the angular extent of the arc,
relative to the start angle.
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
The resulting arc begins at startAngle
and extends
for arcAngle
degrees.
Angles are interpreted such that 0 degrees
is at the 3 o'clock position.
A positive value indicates a counter-clockwise rotation
while a negative value indicates a clockwise rotation.
The center of the arc is the center of the rectangle whose origin
is (x, y) and whose size is specified by the
width
and height
arguments.
The resulting arc covers an area
width + 1
pixels wide
by height + 1
pixels tall.
x
- the x coordinate of the
upper-left corner of the arc to be filled.
y
- the y coordinate of the
upper-left corner of the arc to be filled.
width
- the width of the arc to be filled.
height
- the height of the arc to be filled.
startAngle
- the beginning angle.
arcAngle
- the angular extent of the arc,
relative to the start angle.
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
xPoints
- an array of x points
yPoints
- an array of y points
nPoints
- the total number of points
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
This method draws the polygon defined by nPoint
line
segments, where the first nPoint - 1
line segments are line segments from
(xPoints[i - 1], yPoints[i - 1])
to (xPoints[i], yPoints[i])
, for
1 ≤ i ≤ nPoints
.
The figure is automatically closed by drawing a line connecting
the final point to the first point, if those points are different.
xPoints
- a an array of x
coordinates.
yPoints
- a an array of y
coordinates.
nPoints
- a the total number of points.
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
This method draws the polygon defined by nPoint
line
segments, where the first nPoint - 1
line segments are line segments from
(xPoints[i - 1], yPoints[i - 1])
to (xPoints[i], yPoints[i])
, for
1 ≤ i ≤ nPoints
.
The figure is automatically closed by drawing a line connecting
the final point to the first point, if those points are different.
The area inside the polygon is defined using an even-odd fill rule, also known as the alternating rule.
xPoints
- a an array of x
coordinates.
yPoints
- a an array of y
coordinates.
nPoints
- a the total number of points.
public void drawString(String str, int x, int y)
str
- the string to be drawn.
x
- the x coordinate.
y
- the y coordinate.
public boolean drawImage(Image img, int x, int y, ImageObserver observer)
This method returns immediately in all cases, even if the complete image has not yet been loaded, and it has not been dithered and converted for the current output device.
If the image has not yet been completely loaded, then
drawImage
returns false
. As more of
the image becomes available, the process that draws the image notifies
the specified image observer.
img
- the specified image to be drawn.
x
- the x coordinate.
y
- the y coordinate.
observer
- object to be notified as more of
the image is converted.
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
The image is drawn inside the specified rectangle of this graphics context's coordinate space, and is scaled if necessary. Transparent pixels do not affect whatever pixels are already there.
This method returns immediately in all cases, even if the
entire image has not yet been scaled, dithered, and converted
for the current output device.
If the current output representation is not yet complete, then
drawImage
returns false
. As more of
the image becomes available, the process that draws the image notifies
the image observer by calling its imageUpdate
method.
A scaled version of an image will not necessarily be available immediately just because an unscaled version of the image has been constructed for this output device. Each size of the image may be cached separately and generated from the original data in a separate image production sequence.
img
- the specified image to be drawn.
x
- the x coordinate.
y
- the y coordinate.
width
- the width of the rectangle.
height
- the height of the rectangle.
observer
- object to be notified as more of
the image is converted.
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.
This method returns immediately in all cases, even if the complete image has not yet been loaded, and it has not been dithered and converted for the current output device.
If the image has not yet been completely loaded, then
drawImage
returns false
. As more of
the image becomes available, the process that draws the image notifies
the specified image observer.
img
- the specified image to be drawn.
x
- the x coordinate.
y
- the y coordinate.
bgcolor
- the background color to paint under the
non-opaque portions of the image.
observer
- object to be notified as more of
the image is converted.
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
The image is drawn inside the specified rectangle of this graphics context's coordinate space, and is scaled if necessary. Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.
This method returns immediately in all cases, even if the
entire image has not yet been scaled, dithered, and converted
for the current output device.
If the current output representation is not yet complete then
drawImage
returns false
. As more of
the image becomes available, the process that draws the image notifies
the specified image observer.
A scaled version of an image will not necessarily be available immediately just because an unscaled version of the image has been constructed for this output device. Each size of the image may be cached separately and generated from the original data in a separate image production sequence.
img
- the specified image to be drawn.
x
- the x coordinate.
y
- the y coordinate.
width
- the width of the rectangle.
height
- the height of the rectangle.
bgcolor
- the background color to paint under the
non-opaque portions of the image.
observer
- object to be notified as more of
the image is converted.
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
This method returns immediately in all cases, even if the
image area to be drawn has not yet been scaled, dithered, and converted
for the current output device.
If the current output representation is not yet complete then
drawImage
returns false
. As more of
the image becomes available, the process that draws the image notifies
the specified image observer.
This method always uses the unscaled version of the image to render the scaled rectangle and performs the required scaling on the fly. It does not use a cached, scaled version of the image for this operation. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle, and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings.
img
- the specified image to be drawn
dx1
- the x coordinate of the first corner of the
destination rectangle.
dy1
- the y coordinate of the first corner of the
destination rectangle.
dx2
- the x coordinate of the second corner of the
destination rectangle.
dy2
- the y coordinate of the second corner of the
destination rectangle.
sx1
- the x coordinate of the first corner of the
source rectangle.
sy1
- the y coordinate of the first corner of the
source rectangle.
sx2
- the x coordinate of the second corner of the
source rectangle.
sy2
- the y coordinate of the second corner of the
source rectangle.
observer
- object to be notified as more of the image is
scaled and converted.
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.
This method returns immediately in all cases, even if the
image area to be drawn has not yet been scaled, dithered, and converted
for the current output device.
If the current output representation is not yet complete then
drawImage
returns false
. As more of
the image becomes available, the process that draws the image notifies
the specified image observer.
This method always uses the unscaled version of the image to render the scaled rectangle and performs the required scaling on the fly. It does not use a cached, scaled version of the image for this operation. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle, and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings.
img
- the specified image to be drawn
dx1
- the x coordinate of the first corner of the
destination rectangle.
dy1
- the y coordinate of the first corner of the
destination rectangle.
dx2
- the x coordinate of the second corner of the
destination rectangle.
dy2
- the y coordinate of the second corner of the
destination rectangle.
sx1
- the x coordinate of the first corner of the
source rectangle.
sy1
- the y coordinate of the first corner of the
source rectangle.
sx2
- the x coordinate of the second corner of the
source rectangle.
sy2
- the y coordinate of the second corner of the
source rectangle.
bgcolor
- the background color to paint under the
non-opaque portions of the image.
observer
- object to be notified as more of the image is
scaled and converted.
public void draw(Shape s)
s
- The shape to be drawn.
public void drawImage(Image img, AffineTransform xform, ImageObserver obs)
img
- The image to be drawn.
xform
- The transformation from image space into user space.
obs
- The image observer to be notified as more of the image
is converted.
public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y)
img1 = op.filter(img, null); drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null);
op
- The filter to be applied to the image before drawing.
img
- The BufferedImage to be drawn.
x,y
- The location in user space where the image should be drawn.
public void drawRenderedImage(RenderedImage img, AffineTransform xform)
img
- The image to be drawn.
xform
- The transformation from image space into user space.
obs
- The image observer to be notified as more of the image
is converted.
public void drawRenderableImage(RenderableImage img, AffineTransform xfrom, Hashtable renderHints, Hashtable renderHintsObserved)
public void drawString(String s, float x, float y)
s
- The string to be drawn.
x,y
- The coordinates where the string should be drawn.
public void drawString(StyledString s, float x, float y)
s
- The StyledString to be drawn.
x,y
- The coordinates where the StyledString should be drawn.
public void drawString(GlyphSet g, float x, float y)
g
- The GlyphSet to be drawn.
x,y
- The coordinates where the glyphs should be drawn.
public void drawString(TextLayout text, float x, float y)
public void fill(Shape s)
public void translate(double tx, double ty)
[ 1 0 tx ] [ 0 1 ty ] [ 0 0 1 ]
public void rotate(double theta)
[ cos(theta) -sin(theta) 0 ] [ sin(theta) cos(theta) 0 ] [ 0 0 1 ]Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.
theta
- The angle of rotation in radians.
public void rotate(double theta, double x, double y)
translate(x, y); rotate(theta); translate(-x, -y);Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.
theta
- The angle of rotation in radians.
x
- The x coordinate of the origin of the rotation
y
- The x coordinate of the origin of the rotation
public void scale(double sx, double sy)
[ sx 0 0 ] [ 0 sy 0 ] [ 0 0 1 ]
public void shear(double shx, double shy)
[ 1 shx 0 ] [ shy 1 0 ] [ 0 0 1 ]
shx
- The factor by which coordinates are shifted towards the
positive X axis direction according to their Y coordinate
shy
- The factor by which coordinates are shifted towards the
positive Y axis direction according to their X coordinate
public void translate(int x, int y)
public boolean imageUpdate(Image img, int infoFlags, int x, int y, int width, int height)
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |