|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Graphics java.awt.Graphics2D com.pietjonas.wmfwriter2d.WMFGraphics2D
A class for writing into Windows Metafiles with
java.awt.Graphics2D methods.
Usage is simple. Construct a WMFGraphics2D object with a WMF object
wmf
and the metafile extent:
WMFGraphics wmfg = new WMFGraphics(wmf, 400, 300);Use the standard java.awt.Graphics methods to draw:
... wmfg.drawLine(0, 0, 400, 300); wmfg.drawOval(100, 100, 200, 100); ...Almost all features of the Java2D are supported. WMFGraphics2D is compatible with JDK 1.2 and above
WMFGraphics
,
WMF
Constructor Summary | |
WMFGraphics2D(WMF wmf,
int width,
int height)
Constructs a WMFGraphics2D object. |
|
WMFGraphics2D(WMF wmf,
int width,
int height,
java.awt.Color foreground,
java.awt.Color background)
Constructs a WMFGraphics object. |
Method Summary | |
void |
addRenderingHints(java.util.Map hints)
See Graphics2D. |
void |
clearRect(int x,
int y,
int width,
int height)
See Graphics2D. |
void |
clip(java.awt.Shape s)
See Graphics2D. |
void |
clipRect(int x,
int y,
int width,
int height)
See Graphics2D. |
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
See Graphics2D. |
java.awt.Graphics |
create()
See Graphics2D. |
void |
dispose()
See Graphics2D. |
void |
draw(java.awt.Shape s)
See Graphics2D. |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
See Graphics2D. |
void |
drawGlyphVector(java.awt.font.GlyphVector g,
float x,
float y)
See Graphics2D. |
void |
drawImage(java.awt.image.BufferedImage img,
java.awt.image.BufferedImageOp op,
int x,
int y)
See Graphics2D. |
boolean |
drawImage(java.awt.Image img,
java.awt.geom.AffineTransform xform,
java.awt.image.ImageObserver obs)
See Graphics2D. |
boolean |
drawImage(java.awt.Image img,
int x,
int y,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
See Graphics2D. |
boolean |
drawImage(java.awt.Image img,
int x,
int y,
java.awt.image.ImageObserver observer)
See Graphics2D. |
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
See Graphics2D. |
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
See Graphics2D. |
boolean |
drawImage(java.awt.Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
See Graphics2D. |
boolean |
drawImage(java.awt.Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.image.ImageObserver observer)
See Graphics2D. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
See Graphics2D. |
void |
drawOval(int x,
int y,
int width,
int height)
See Graphics2D. |
void |
drawPolygon(int[] xpoints,
int[] ypoints,
int npoints)
See Graphics2D. |
void |
drawPolyline(int[] xpoints,
int[] ypoints,
int npoints)
See Graphics2D. |
void |
drawRect(int x,
int y,
int width,
int height)
See Graphics2D. |
void |
drawRenderableImage(java.awt.image.renderable.RenderableImage img,
java.awt.geom.AffineTransform xform)
See Graphics2D. |
void |
drawRenderedImage(java.awt.image.RenderedImage img,
java.awt.geom.AffineTransform xform)
See Graphics2D. |
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
See Graphics2D. |
void |
drawString(java.text.AttributedCharacterIterator iterator,
float x,
float y)
See Graphics2D. |
void |
drawString(java.text.AttributedCharacterIterator iterator,
int x,
int y)
See Graphics2D. |
void |
drawString(java.lang.String s,
float x,
float y)
See Graphics2D. |
void |
drawString(java.lang.String str,
int x,
int y)
See Graphics2D. |
void |
fill(java.awt.Shape s)
See Graphics2D. |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
See Graphics2D. |
void |
fillOval(int x,
int y,
int width,
int height)
See Graphics2D. |
void |
fillPolygon(int[] xpoints,
int[] ypoints,
int npoints)
See Graphics2D. |
void |
fillRect(int x,
int y,
int width,
int height)
See Graphics2D. |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
See Graphics2D. |
java.awt.Color |
getBackground()
See Graphics2D. |
java.awt.Shape |
getClip()
See Graphics2D. |
java.awt.Rectangle |
getClipBounds()
See Graphics2D. |
java.awt.Color |
getColor()
See Graphics2D. |
java.awt.Composite |
getComposite()
See Graphics2D. |
java.awt.GraphicsConfiguration |
getDeviceConfiguration()
See Graphics2D. |
double |
getFlatness()
|
java.awt.Font |
getFont()
See Graphics2D. |
java.awt.FontMetrics |
getFontMetrics(java.awt.Font f)
See Graphics2D. |
java.awt.font.FontRenderContext |
getFontRenderContext()
See Graphics2D. |
java.awt.Paint |
getPaint()
See Graphics2D. |
java.lang.Object |
getRenderingHint(java.awt.RenderingHints.Key key)
See Graphics2D. |
java.awt.RenderingHints |
getRenderingHints()
See Graphics2D. |
java.awt.Stroke |
getStroke()
See Graphics2D. |
java.awt.geom.AffineTransform |
getTransform()
See Graphics2D. |
boolean |
hit(java.awt.Rectangle rect,
java.awt.Shape s,
boolean onStroke)
See Graphics2D. |
boolean |
isGDIFontDrawing()
Indicates the use of the native GDI font drawing mechanism. |
boolean |
isGDIPenDrawing()
Indicates the use of the native GDI pen drawing mechanism. |
boolean |
isGDIPenWidthDrawing()
Indicates the use of the native GDI pen width drawing. |
void |
rotate(double theta)
See Graphics2D. |
void |
rotate(double theta,
double x,
double y)
See Graphics2D. |
void |
scale(double sx,
double sy)
See Graphics2D. |
void |
setBackground(java.awt.Color color)
See Graphics2D. |
void |
setClip(int x,
int y,
int width,
int height)
See Graphics2D. |
void |
setClip(java.awt.Shape clip)
See Graphics2D. |
void |
setColor(java.awt.Color c)
See Graphics2D. |
void |
setComposite(java.awt.Composite comp)
See Graphics2D. |
void |
setFlatness(double flatness)
Sets the number of polygons produced for drawing curved shapes. |
void |
setFont(java.awt.Font font)
See Graphics2D. |
void |
setGDIFontDrawing(boolean gdifontdrawing)
Sets the use of the native GDI font drawing mechanism. |
void |
setGDIPenDrawing(boolean gdipendrawing)
Sets the use of the native GDI pen drawing mechanism for java.awt.Shape outlines. |
void |
setGDIPenWidthDrawing(boolean gdipenwidthdrawing)
Sets the use of width for the native GDI pen drawing ( isGDIPenDrawing() must be true).
|
void |
setPaint(java.awt.Paint paint)
See Graphics2D. |
void |
setPaintMode()
See Graphics2D. |
void |
setRenderingHint(java.awt.RenderingHints.Key key,
java.lang.Object hintValue)
See Graphics2D. |
void |
setRenderingHints(java.util.Map hints)
See Graphics2D. |
void |
setStroke(java.awt.Stroke s)
See Graphics2D. |
void |
setTransform(java.awt.geom.AffineTransform Tx)
See Graphics2D. |
void |
setXORMode(java.awt.Color color)
See Graphics2D. |
void |
shear(double shx,
double shy)
See Graphics2D. |
void |
transform(java.awt.geom.AffineTransform Tx)
See Graphics2D. |
void |
translate(double tx,
double ty)
See Graphics2D. |
void |
translate(int x,
int y)
See Graphics2D. |
Methods inherited from class java.awt.Graphics2D |
draw3DRect, fill3DRect |
Methods inherited from class java.awt.Graphics |
create, drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public WMFGraphics2D(WMF wmf, int width, int height)
WMF
object in which the Windows metafile commands
are written and the extent the metafile will have. setWindowOrg, setWindowExt, setBKMode, ...
)
It creates and selects three GDI Objects: a Pen, a Brush and a Font
with black fore- and white background color.
wmf
- The WMF object to write the metafile intowidth
- The width of the metafile extentheight
- The height of the metafile extentWMF
public WMFGraphics2D(WMF wmf, int width, int height, java.awt.Color foreground, java.awt.Color background)
WMF
object in which the Windows metafile commands
are written and the extent the metafile will have. setWindowOrg, setWindowExt, setBKMode, ...
)
It creates and selects three GDI Objects: a Pen, a Brush and a Font
with the specified fore- and background color.
wmf
- The WMF object to write the metafile intowidth
- The width of the metafile extentheight
- The height of the metafile extentforeground
- The foreground colorbackground
- The background colorWMF
Method Detail |
public void setGDIFontDrawing(boolean gdifontdrawing)
gdifontdrawing
- Whether to use GDI fontspublic boolean isGDIFontDrawing()
public void setGDIPenDrawing(boolean gdipendrawing)
gdipendrawing
- Whether to use GDI penssetGDIPenWidthDrawing(boolean)
public boolean isGDIPenDrawing()
public void setGDIPenWidthDrawing(boolean gdipenwidthdrawing)
isGDIPenDrawing()
must be true).
GDI pens are used with the width indicated by
the current java.awt.BasicStroke instance. If set to false, a
GDI pen with width 0 is used plus line filling by the java.awt.Stroke
object.
GDI pens with native width lead to smaller WMF,
faster replay and better drawing quality
but can produce slightly different appearence (joins, end caps).
gdipenwidthdrawing
- Whether to use GDI pen widthsetGDIPenDrawing(boolean)
public boolean isGDIPenWidthDrawing()
public void setFlatness(double flatness)
flatness
- The flatness parameterpublic double getFlatness()
public java.awt.RenderingHints getRenderingHints()
Graphics2D
public java.awt.Graphics create()
Graphics2D
public java.awt.Font getFont()
Graphics2D
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Graphics2D
public void clip(java.awt.Shape s)
Graphics2D
public void setPaintMode()
Graphics2D
public boolean hit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)
Graphics2D
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Graphics2D
public java.awt.font.FontRenderContext getFontRenderContext()
Graphics2D
public java.awt.GraphicsConfiguration getDeviceConfiguration()
Graphics2D
public java.awt.Color getColor()
Graphics2D
public java.awt.Composite getComposite()
Graphics2D
public java.awt.Paint getPaint()
Graphics2D
public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
Graphics2D
public void setClip(java.awt.Shape clip)
Graphics2D
public void setTransform(java.awt.geom.AffineTransform Tx)
Graphics2D
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Graphics2D
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Graphics2D
public void setBackground(java.awt.Color color)
Graphics2D
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Graphics2D
public java.awt.Stroke getStroke()
Graphics2D
public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
Graphics2D
public void setRenderingHint(java.awt.RenderingHints.Key key, java.lang.Object hintValue)
Graphics2D
public void clipRect(int x, int y, int width, int height)
Graphics2D
public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Graphics2D
public void drawOval(int x, int y, int width, int height)
Graphics2D
public void setFont(java.awt.Font font)
Graphics2D
public void setPaint(java.awt.Paint paint)
Graphics2D
public void copyArea(int x, int y, int width, int height, int dx, int dy)
Graphics2D
public void setStroke(java.awt.Stroke s)
Graphics2D
public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
Graphics2D
public void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)
Graphics2D
public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
Graphics2D
public void drawString(java.lang.String str, int x, int y)
Graphics2D
public void drawLine(int x1, int y1, int x2, int y2)
Graphics2D
public void drawRect(int x, int y, int width, int height)
Graphics2D
public void dispose()
Graphics2D
public void setClip(int x, int y, int width, int height)
Graphics2D
public void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)
Graphics2D
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Graphics2D
public void rotate(double theta, double x, double y)
Graphics2D
public void transform(java.awt.geom.AffineTransform Tx)
Graphics2D
public void clearRect(int x, int y, int width, int height)
Graphics2D
public void setColor(java.awt.Color c)
Graphics2D
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key key)
Graphics2D
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
Graphics2D
public void setRenderingHints(java.util.Map hints)
Graphics2D
public void translate(int x, int y)
Graphics2D
public void setXORMode(java.awt.Color color)
Graphics2D
public java.awt.Rectangle getClipBounds()
Graphics2D
public void drawString(java.text.AttributedCharacterIterator iterator, float x, float y)
Graphics2D
public void addRenderingHints(java.util.Map hints)
Graphics2D
public java.awt.Color getBackground()
Graphics2D
public void translate(double tx, double ty)
Graphics2D
public void fill(java.awt.Shape s)
Graphics2D
public java.awt.Shape getClip()
Graphics2D
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
Graphics2D
public void drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)
Graphics2D
public void setComposite(java.awt.Composite comp)
Graphics2D
public void scale(double sx, double sy)
Graphics2D
public void fillOval(int x, int y, int width, int height)
Graphics2D
public void fillRect(int x, int y, int width, int height)
Graphics2D
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
Graphics2D
public boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver obs)
Graphics2D
public void rotate(double theta)
Graphics2D
public void draw(java.awt.Shape s)
Graphics2D
public void drawString(java.lang.String s, float x, float y)
Graphics2D
public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
Graphics2D
public java.awt.geom.AffineTransform getTransform()
Graphics2D
public void drawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)
Graphics2D
public void shear(double shx, double shy)
Graphics2D
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |