kcl.waterloo.common.deploy
Class AbstractDeployableGraphics2D
- java.lang.Object
-
- java.awt.Graphics
-
- java.awt.Graphics2D
-
- kcl.waterloo.common.deploy.AbstractDeployableGraphics2D
-
- Direct Known Subclasses:
- PDEGraphics2D, WSVGGraphics2D
public abstract class AbstractDeployableGraphics2D extends java.awt.Graphics2DAbstract class for generating graphics scripts.AbstractDeployableGraphics2D is extended e.g. by PDEGraphics2D which provides a concrete implementation for generating Processing script output.
Other subclasses may be added in the future to support other scripting languages.
Revisions:
14.05.2013 Change class name to avoid conflicts with third-party packages.
27.05.2013 Do not clone parentGraphics in constructor
08.12.2013 Remove some left-over pde specific code
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract voidaddCode(java.lang.String code)Inserts user-specified code into the coded output at the current location.abstract voidaddComment(java.lang.String comment)Sets a string that will be added to the code output as a comment.voidaddRenderingHints(java.util.Map<?,?> hints)abstract voidappend(java.awt.Component c)abstract voidappend(java.awt.Component c, int elapsedTime)abstract voidappendCode(java.lang.String code)Adds user-specified code to the end of the generated code.voidclearRect(int x, int y, int width, int height)voidclip(java.awt.Shape s)voidclipRect(int x, int y, int width, int height)voidcopyArea(int x, int y, int width, int height, int dx, int dy)abstract booleancopyImage(java.awt.Image img, int dx, int dy, int sx, int sy, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)Implemented in some Graphics2D subclasses e.g.voiddispose()voiddraw(java.awt.Shape s)voiddraw3DRect(int x, int y, int width, int height, boolean raised)AWT Graphics and Graphics2D classes generally implement draw3DRect through calls to other methods.voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle)voiddrawBytes(byte[] data, int offset, int length, int x, int y)voiddrawGlyphVector(java.awt.font.GlyphVector g, float x, float y)voiddrawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)booleandrawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver obs)booleandrawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)booleandrawImage(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)booleandrawImage(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)voiddrawLine(int x1, int y1, int x2, int y2)voiddrawOval(int x, int y, int width, int height)voiddrawPolygon(int[] xPoints, int[] yPoints, int nPoints)voiddrawPolyline(int[] xPoints, int[] yPoints, int nPoints)voiddrawRect(int x, int y, int width, int height)voiddrawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)voiddrawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)voiddrawString(java.text.AttributedCharacterIterator iterator, float x, float y)voiddrawString(java.text.AttributedCharacterIterator iterator, int x, int y)voiddrawString(java.lang.String str, float x, float y)voiddrawString(java.lang.String str, int x, int y)voidfill(java.awt.Shape s)voidfill3DRect(int x, int y, int width, int height, boolean raised)AWT Graphics and Graphics2D classes generally implement fill3DRect through calls to other methods.voidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle)voidfillOval(int x, int y, int width, int height)voidfillPolygon(int[] xPoints, int[] yPoints, int nPoints)voidfillRect(int x, int y, int width, int height)voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)intgetActionDelay()java.awt.ColorgetBackground()java.awt.ShapegetClip()java.awt.RectanglegetClipBounds()java.lang.StringgetCode()java.awt.ColorgetColor()java.awt.CompositegetComposite()java.awt.GraphicsConfigurationgetDeviceConfiguration()java.awt.FontgetFont()java.awt.FontMetricsgetFontMetrics(java.awt.Font f)java.awt.font.FontRenderContextgetFontRenderContext()java.awt.PaintgetPaint()java.lang.ObjectgetRenderingHint(java.awt.RenderingHints.Key hintKey)java.awt.RenderingHintsgetRenderingHints()java.awt.StrokegetStroke()java.awt.geom.AffineTransformgetTransform()booleanhit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)booleanisAlsoPaintToSource()abstract voidprependCode(java.lang.String code)Inserts user-specified code at the start of the generated code, but after any automatically generated declarations (which are therefore potentially available for use in that code).voidrotate(double theta)voidrotate(double theta, double x, double y)voidscale(double sx, double sy)voidsetActionDelay(int actionDelay)voidsetAlsoPaintToSource(boolean alsoPaintToSource)voidsetBackground(java.awt.Color color)voidsetClip(int x, int y, int width, int height)voidsetClip(java.awt.Shape clip)voidsetColor(java.awt.Color c)voidsetComposite(java.awt.Composite comp)voidsetFont(java.awt.Font font)voidsetPaint(java.awt.Paint paint)voidsetPaintMode()abstract voidsetPaintObject(java.lang.Object paintObject)Call this routine in the painting mechanism of an AWT/Swing hierarchy.voidsetRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)voidsetRenderingHints(java.util.Map<?,?> hints)voidsetStroke(java.awt.Stroke s)voidsetTransform(java.awt.geom.AffineTransform Tx)voidsetXORMode(java.awt.Color c1)voidshear(double shx, double shy)voidtransform(java.awt.geom.AffineTransform Tx)voidtranslate(double tx, double ty)voidtranslate(int x, int y)voidwrite(java.io.File f)voidwrite(java.lang.String f)Writes the generated code to
-
-
-
Method Detail
-
isAlsoPaintToSource
public boolean isAlsoPaintToSource()
-
setAlsoPaintToSource
public void setAlsoPaintToSource(boolean alsoPaintToSource)
-
getActionDelay
public int getActionDelay()
- Returns:
- the actionDelay
-
setActionDelay
public void setActionDelay(int actionDelay)
- Parameters:
actionDelay- the actionDelay to set
-
append
public abstract void append(java.awt.Component c, int elapsedTime)
-
append
public abstract void append(java.awt.Component c)
-
getCode
public java.lang.String getCode()
- Returns:
- the code
-
write
public void write(java.io.File f) throws java.io.IOException- Throws:
java.io.IOException
-
write
public void write(java.lang.String f) throws java.io.IOExceptionWrites the generated code to- Parameters:
f- the file name- Throws:
java.io.IOException
-
setPaintObject
public abstract void setPaintObject(java.lang.Object paintObject)
Call this routine in the painting mechanism of an AWT/Swing hierarchy. How a concrete class responds is an implementation detail for the subclass. Typically, this will simply be used to add a comment to the generated code in a custom component e.g.public void paintComponent(Graphics g){
if (g instanceof AbstractDeployableGraphics2D) {
((AbstractDeployableGraphics2D)g).setPaintObject(this);
}
}- Parameters:
paintObject- the paintObject to set
-
addComment
public abstract void addComment(java.lang.String comment)
Sets a string that will be added to the code output as a comment. Do not added comment markers - these should be added by any concrete implementations automatically and will be specific to the code language being used.- Parameters:
comment- the comment to set as a String
-
prependCode
public abstract void prependCode(java.lang.String code)
Inserts user-specified code at the start of the generated code, but after any automatically generated declarations (which are therefore potentially available for use in that code).- Parameters:
code- fully formatted code string
-
addCode
public abstract void addCode(java.lang.String code)
Inserts user-specified code into the coded output at the current location.- Parameters:
code- fully formatted code string
-
appendCode
public abstract void appendCode(java.lang.String code)
Adds user-specified code to the end of the generated code.- Parameters:
code- the code to append
-
copyImage
public abstract boolean copyImage(java.awt.Image img, int dx, int dy, int sx, int sy, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)Implemented in some Graphics2D subclasses e.g. com.sun.java.Graphics2D. This is not part of the java.awt.Graphics2D API.- Parameters:
img-dx-dy-sx-sy-width-height-bgcolor-observer-- Returns:
- true or false
-
draw3DRect
public final void draw3DRect(int x, int y, int width, int height, boolean raised)AWT Graphics and Graphics2D classes generally implement draw3DRect through calls to other methods. Consequently there is no need to implement any code here explicitly as long as the concrete implementation of Graphics2D in parentGraphics works similarly, e.g. by a call to the Graphics2D methods.- Overrides:
draw3DRectin classjava.awt.Graphics2D
-
fill3DRect
public final void fill3DRect(int x, int y, int width, int height, boolean raised)AWT Graphics and Graphics2D classes generally implement fill3DRect through calls to other methods. Consequently there is no need to implement any code here explicitly as long as the concrete implementation of Graphics2D in parentGraphics works similarly, e.g. by a call to the Graphics2D methods.- Overrides:
fill3DRectin classjava.awt.Graphics2D
-
setTransform
public final void setTransform(java.awt.geom.AffineTransform Tx)
- Specified by:
setTransformin classjava.awt.Graphics2D
-
getTransform
public java.awt.geom.AffineTransform getTransform()
- Specified by:
getTransformin classjava.awt.Graphics2D
-
getStroke
public java.awt.Stroke getStroke()
- Specified by:
getStrokein classjava.awt.Graphics2D
-
clip
public void clip(java.awt.Shape s)
- Specified by:
clipin classjava.awt.Graphics2D
-
getFontRenderContext
public java.awt.font.FontRenderContext getFontRenderContext()
- Specified by:
getFontRenderContextin classjava.awt.Graphics2D
-
getColor
public java.awt.Color getColor()
- Specified by:
getColorin classjava.awt.Graphics
-
setColor
public void setColor(java.awt.Color c)
- Specified by:
setColorin classjava.awt.Graphics
-
setPaintMode
public void setPaintMode()
- Specified by:
setPaintModein classjava.awt.Graphics
-
getFont
public final java.awt.Font getFont()
- Specified by:
getFontin classjava.awt.Graphics
-
setFont
public void setFont(java.awt.Font font)
- Specified by:
setFontin classjava.awt.Graphics
-
getClipBounds
public java.awt.Rectangle getClipBounds()
- Specified by:
getClipBoundsin classjava.awt.Graphics
-
clipRect
public void clipRect(int x, int y, int width, int height)- Specified by:
clipRectin classjava.awt.Graphics
-
setClip
public void setClip(int x, int y, int width, int height)- Specified by:
setClipin classjava.awt.Graphics
-
getClip
public java.awt.Shape getClip()
- Specified by:
getClipin classjava.awt.Graphics
-
setClip
public void setClip(java.awt.Shape clip)
- Specified by:
setClipin classjava.awt.Graphics
-
hit
public boolean hit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)- Specified by:
hitin classjava.awt.Graphics2D
-
setComposite
public void setComposite(java.awt.Composite comp)
- Specified by:
setCompositein classjava.awt.Graphics2D
-
setPaint
public void setPaint(java.awt.Paint paint)
- Specified by:
setPaintin classjava.awt.Graphics2D
-
setStroke
public void setStroke(java.awt.Stroke s)
- Specified by:
setStrokein classjava.awt.Graphics2D
-
setRenderingHint
public void setRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)- Specified by:
setRenderingHintin classjava.awt.Graphics2D
-
getRenderingHint
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key hintKey)
- Specified by:
getRenderingHintin classjava.awt.Graphics2D
-
setRenderingHints
public void setRenderingHints(java.util.Map<?,?> hints)
- Specified by:
setRenderingHintsin classjava.awt.Graphics2D
-
addRenderingHints
public void addRenderingHints(java.util.Map<?,?> hints)
- Specified by:
addRenderingHintsin classjava.awt.Graphics2D
-
getRenderingHints
public java.awt.RenderingHints getRenderingHints()
- Specified by:
getRenderingHintsin classjava.awt.Graphics2D
-
setXORMode
public void setXORMode(java.awt.Color c1)
- Specified by:
setXORModein classjava.awt.Graphics
-
getFontMetrics
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
- Specified by:
getFontMetricsin classjava.awt.Graphics
-
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy)- Specified by:
copyAreain classjava.awt.Graphics
-
getDeviceConfiguration
public java.awt.GraphicsConfiguration getDeviceConfiguration()
- Specified by:
getDeviceConfigurationin classjava.awt.Graphics2D
-
translate
public void translate(int x, int y)- Specified by:
translatein classjava.awt.Graphics2D
-
translate
public void translate(double tx, double ty)- Specified by:
translatein classjava.awt.Graphics2D
-
rotate
public void rotate(double theta)
- Specified by:
rotatein classjava.awt.Graphics2D
-
rotate
public void rotate(double theta, double x, double y)- Specified by:
rotatein classjava.awt.Graphics2D
-
scale
public void scale(double sx, double sy)- Specified by:
scalein classjava.awt.Graphics2D
-
shear
public void shear(double shx, double shy)- Specified by:
shearin classjava.awt.Graphics2D
-
transform
public void transform(java.awt.geom.AffineTransform Tx)
- Specified by:
transformin classjava.awt.Graphics2D
-
getPaint
public java.awt.Paint getPaint()
- Specified by:
getPaintin classjava.awt.Graphics2D
-
getComposite
public java.awt.Composite getComposite()
- Specified by:
getCompositein classjava.awt.Graphics2D
-
setBackground
public void setBackground(java.awt.Color color)
- Specified by:
setBackgroundin classjava.awt.Graphics2D
-
getBackground
public java.awt.Color getBackground()
- Specified by:
getBackgroundin classjava.awt.Graphics2D
-
draw
public void draw(java.awt.Shape s)
- Specified by:
drawin classjava.awt.Graphics2D- Parameters:
s-
-
drawString
public void drawString(java.lang.String str, int x, int y)- Specified by:
drawStringin classjava.awt.Graphics2D
-
drawString
public void drawString(java.lang.String str, float x, float y)- Specified by:
drawStringin classjava.awt.Graphics2D
-
drawString
public void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)- Specified by:
drawStringin classjava.awt.Graphics2D
-
drawString
public void drawString(java.text.AttributedCharacterIterator iterator, float x, float y)- Specified by:
drawStringin classjava.awt.Graphics2D
-
drawGlyphVector
public void drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)- Specified by:
drawGlyphVectorin classjava.awt.Graphics2D
-
fill
public void fill(java.awt.Shape s)
- Specified by:
fillin classjava.awt.Graphics2D
-
drawLine
public void drawLine(int x1, int y1, int x2, int y2)- Specified by:
drawLinein classjava.awt.Graphics
-
drawRect
public void drawRect(int x, int y, int width, int height)- Overrides:
drawRectin classjava.awt.Graphics
-
fillRect
public void fillRect(int x, int y, int width, int height)- Specified by:
fillRectin classjava.awt.Graphics
-
clearRect
public void clearRect(int x, int y, int width, int height)- Specified by:
clearRectin classjava.awt.Graphics
-
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)- Specified by:
drawRoundRectin classjava.awt.Graphics
-
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)- Specified by:
fillRoundRectin classjava.awt.Graphics
-
drawOval
public void drawOval(int x, int y, int width, int height)- Specified by:
drawOvalin classjava.awt.Graphics
-
fillOval
public void fillOval(int x, int y, int width, int height)- Specified by:
fillOvalin classjava.awt.Graphics
-
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)- Specified by:
drawArcin classjava.awt.Graphics
-
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)- Specified by:
fillArcin classjava.awt.Graphics
-
drawPolyline
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)- Specified by:
drawPolylinein classjava.awt.Graphics
-
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)- Specified by:
drawPolygonin classjava.awt.Graphics
-
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)- Specified by:
fillPolygonin classjava.awt.Graphics
-
drawBytes
public void drawBytes(byte[] data, int offset, int length, int x, int y)- Overrides:
drawBytesin classjava.awt.Graphics
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics
-
drawImage
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)- Specified by:
drawImagein classjava.awt.Graphics
-
drawImage
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)- Specified by:
drawImagein classjava.awt.Graphics
-
drawImage
public boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver obs)- Specified by:
drawImagein classjava.awt.Graphics2D
-
drawImage
public void drawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)- Specified by:
drawImagein classjava.awt.Graphics2D
-
drawRenderedImage
public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)- Specified by:
drawRenderedImagein classjava.awt.Graphics2D
-
drawRenderableImage
public void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)- Specified by:
drawRenderableImagein classjava.awt.Graphics2D
-
dispose
public void dispose()
- Specified by:
disposein classjava.awt.Graphics
-
-
DMelt 3.0 © DataMelt by jWork.ORG