Class PDEGraphics2D
- java.lang.Object
-
- java.awt.Graphics
-
- java.awt.Graphics2D
-
- kcl.waterloo.common.deploy.AbstractDeployableGraphics2D
-
- kcl.waterloo.deploy.pde.PDEGraphics2D
-
- All Implemented Interfaces:
- java.lang.Cloneable
public class PDEGraphics2D extends AbstractDeployableGraphics2D implements java.lang.Cloneable
PDEGraphics2D - a Graphics2D subclass that generates a script using the Processing graphics language.
The generated script may be displayed using the open-source, multi-platform Processing application and displayed in web pages using the processing.js javascript when graphics will be rendered to an HTML5 canvas element.
Usage:
PDEGraphics2D instances are used in AWT/Swing component paint methods in the same way as any other Graphics2D class object. When painting is complete, a Processing script can be accessed by calling the
getCode()method on the instance which returns the script as a String. Alternatively, call one of thewrite(...)methods to save the code to file. These methods optionally support the creation of HTML files, together with CSS style sheets, to display the generated script in an HTML5 browser canvas.The methods are not thread-safe. All painting should be done on the EDT.
To create a PDEGraphics2D instance, pass the constructor an instance of a standard Graphics2D object, together with the size of the canvas to paint:
PDEGraphics2D g= new PDEGraphics2D(Graphics2D g, int w, int h)
or
PDEGraphics2D g= new PDEGraphics2D(Graphics2D g, Dimension d)Alternatively, pass the component to paint as the input to one of the static paint methods:
PDEGraphics2D g=PDEGraphics2D.paint(Component c);
PDEGraphics2D g=PDEGraphics2D.paint(JComponent c);
PDEGraphics2D g=PDEGraphics2D.paint(Window c);
PDEGraphics2D g=PDEGraphics2D.paint(JApplet c);Creating animations:
The PDEGraphics2D
append()methods can be used to append paints to PDEGraphics2D instance to create animations using Processing. Theappend()method should be called after the first use of the instance to paint a component.Write methods:
The
writemethods create files following a convention that is intended to facilitate the use of the generated scripts with both the Processing application and processing.js javascriptThe convention is as follows
If you write a file named e.g. "script_name.pde", the file will be created in a folder named "script_name". This folder will be created if it does not exist. Thus a file specified as "/Users/ML/Documents/script_name", would create "/Users/ML/Documents/script_name/script_name.pde" - the .pde extension will be added if not specified.
If the the paint methods called with the PDEGraphics2D instance include calls to the
drawImagemethods, the required images will be added to a "/script_name/data/" folder as PNG images. Gradient paints, including MultipleGradientPaints, are also supported through drawing images and require a /data folder.The
writemethods also support the creation of HTML files. If thehtmlFlagon input istrue, the following files can be created:script_name.html - a simple file that shows only the graphics
index.html - a styled file that includes titles etc
PDEGraphics2D.css - styling sheet for index.html
index.xml - an xml file describing the contents of the /data folder
htppd.py - a Python 2.7 script that displays index.html in the system default brpwser using a local server. Use this if the default browser's security settings prevent JavaScript accessing the local file system directly.
See the write{)} methods for full details of the options available.PDEGraphics2D has been tested with the following browsers
Adding code and comments to the scripts:
Several methods allow the generated script to be modified on-the-fly when users have access to the paint methods of the components being painted. These methods are defined in AbstractDeployableGraphics2D, the PDEGraphics superclass.- public void setPaintObject(Object referenceObject) Places a comment in file. Custom-subclasses could override this to do something more complex.
- public void addComment(String comment) Adds a comment to the script at the current writing location. Format markers will be added automatically.
- public void addCode(String comment) Inserts the specified code at the current write location
- public void prependCode(String code) Prepends the specified code to the Processing script before {@code void setup() {...}}
- public void appendCode(String code) Adds the code to the end of the generated script.
Titles etc
- public void setTitle(String title) Gives the script a title. This will added as the name of the displayed Window or displayed in HTML files. It will also be used to set the title tag in HTML.
- public void setDescription(String description) The description will be displayed with index.html
- public void setKeyWords(ArrayList
keyWords)
Adds the specified strings as keywords to HTML documents.
- public void addKeyWord(String word) Adds the keyword to the current list for HTML files.
PDEGraphics can only render graphics normally rendered through Java2D graphics calls. When painting using a proprietary, platform-specific, Java look-and-feel, some features may be painted using native graphics calls and will not appear in the generated scripts. For example, JFrames will not be decorated with close/maximize buttons etc.
In addition, some components may not render fully perhaps because the componentUIs are cloning the wrapped Graphics2D instance instead of the PDEGraphics2D instance or maybe generating a new instance with a call to Component.getGraphics(). This seems to affect mainly the Mac Aqua L&F. Some fixes/workarounds are included for specific L&Fs and AWT/Swing components where the cause of the problem has been identified.
Revisions: 14.05.2013 corrected drawString(AttributedCharacterIterator iterator, float x, float y). 14.05.2013 corrected handling of special cases from processShape(...). 15.05.2013 improved support for quadTo: now built from flattened pathiterator: heavy-handed perhaps but works with any control points and produces relatively compact output (2-3 lines of processing code per SEG_QUADTO). 15.05.2013 Add support for rotated text. 18.05.2013 Improved write options, CSS options etc. 27.05.2013 Minor improvements: colors, sizing of images.
-
-
Field Summary
Fields Modifier and Type Field and Description static intaquaFixesstatic intaquaJButtonMacOS Aqua L&F
-
Constructor Summary
Constructors Constructor and Description PDEGraphics2D(java.awt.Graphics2D g, java.awt.Dimension d)Constructs an initialised PDEGraphics2D object of specified width and height.PDEGraphics2D(java.awt.Graphics2D g, int w, int h)Constructs an initialised PDEGraphics2D object of specified width and height.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddCode(java.lang.String code)Inserts user-specified code into the coded output at the current location.voidaddComment(java.lang.String comment)Sets a string that will be added to the code output as a comment.voidaddKeyWord(java.lang.String word)voidappend(java.awt.Component c)Appends a paint of the specified component to this instance.voidappend(java.awt.Component c, int elapsedTime)Appends a paint of the specified component to this instance.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)voidcopyArea(int x, int y, int width, int height, int dx, int dy)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.java.awt.Graphicscreate()java.awt.Graphicscreate(int x, int y, int width, int height)voiddraw(java.awt.Shape s)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 vec, 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 observer)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 w, int h)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)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 w, int h)voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)java.lang.StringgetCode()java.lang.StringgetDescription()Returns the description.java.util.ArrayList<java.lang.String>getKeyWords()Returns a shallow copy the the keywords.intgetLFFixes()Returns an integer value, the bits of which indicate the use of fixes/workarounds for the look and feel in use.java.lang.StringgetTitle()Returns the title.static java.lang.StringgetUserHTML()booleanisTextAsShapes()Return the textAsShapes setting.booleanisVerbose()static PDEGraphics2Dpaint(java.awt.Component c)Convenience static method for painting an AWT Component and its contents.static PDEGraphics2Dpaint(javax.swing.JApplet c)Convenience static method for painting an Swing JApplet and its contents.static PDEGraphics2Dpaint(javax.swing.JComponent c)Convenience static method for painting an Swing JComponent and its contents.static PDEGraphics2Dpaint(java.awt.Window c)Convenience static method for painting an AWT Window and its contents.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).voidsetColor(java.awt.Color c)voidsetDescription(java.lang.String description)Creates a description.voidsetKeyWords(java.util.ArrayList<java.lang.String> keyWords)Sets the keyWords list.voidsetPaint(java.awt.Paint p)voidsetPaintObject(java.lang.Object referenceObject)Call this routine in the painting mechanism of an AWT/Swing hierarchy.voidsetStroke(java.awt.Stroke s2)voidsetTextAsShapes(boolean textAsShapes)Sets the textAsShapes setting.voidsetTitle(java.lang.String title)Creates a title.static voidsetUserHTML(java.lang.String aUserHTML)voidsetVerbose(boolean verbose)voidwrite(java.io.File f, boolean htmlFlag, java.lang.String jsLoc, java.lang.String cssLoc, boolean httpdFlag)Writes the generated code to file.voidwrite(java.lang.String fileName)Writes the generated code to file.voidwrite(java.lang.String fileName, boolean htmlFlag)Writes the generated code to file.voidwrite(java.lang.String fileName, boolean htmlFlag, java.lang.String jsLoc)Writes the generated code to file.voidwrite(java.lang.String fileName, boolean htmlFlag, java.lang.String jsLoc, java.lang.String cssLoc, boolean httpdFlag)Writes the generated code to file.-
Methods inherited from class kcl.waterloo.common.deploy.AbstractDeployableGraphics2D
addRenderingHints, clip, clipRect, dispose, draw3DRect, fill3DRect, getActionDelay, getBackground, getClip, getClipBounds, getColor, getComposite, getDeviceConfiguration, getFont, getFontMetrics, getFontRenderContext, getPaint, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, isAlsoPaintToSource, rotate, rotate, scale, setActionDelay, setAlsoPaintToSource, setBackground, setClip, setClip, setComposite, setFont, setPaintMode, setRenderingHint, setRenderingHints, setTransform, setXORMode, shear, transform, translate, translate, write
-
-
-
-
Field Detail
-
aquaJButton
public static final int aquaJButton
MacOS Aqua L&F- See Also:
- Constant Field Values
-
aquaFixes
public static final int aquaFixes
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PDEGraphics2D
public PDEGraphics2D(java.awt.Graphics2D g, int w, int h)Constructs an initialised PDEGraphics2D object of specified width and height.- Parameters:
g- Graphics2D object for the java component to be drawn.w- the width of the componenth- the height of the component
-
PDEGraphics2D
public PDEGraphics2D(java.awt.Graphics2D g, java.awt.Dimension d)Constructs an initialised PDEGraphics2D object of specified width and height.- Parameters:
g- Graphics2D object for the java component to be drawn.d- Dimension of the component
-
-
Method Detail
-
paint
public static PDEGraphics2D paint(java.awt.Component c)
Convenience static method for painting an AWT Component and its contents. Returns a PDEGraphics instance that is ready to write to file.- Parameters:
c- the component to paint- Returns:
- a ready-to-write PDEGraphics instance.
-
paint
public static PDEGraphics2D paint(javax.swing.JComponent c)
Convenience static method for painting an Swing JComponent and its contents. Returns a PDEGraphics instance that is ready to write to file.- Parameters:
c- the component to paint- Returns:
- a ready-to-write PDEGraphics instance.
-
paint
public static PDEGraphics2D paint(java.awt.Window c)
Convenience static method for painting an AWT Window and its contents. Returns a PDEGraphics instance that is ready to write to file.- Parameters:
c- the component to paint- Returns:
- a ready-to-write PDEGraphics instance.
-
paint
public static PDEGraphics2D paint(javax.swing.JApplet c)
Convenience static method for painting an Swing JApplet and its contents. Returns a PDEGraphics instance that is ready to write to file.- Parameters:
c- the component to paint- Returns:
- a ready-to-write PDEGraphics instance.
-
getLFFixes
public int getLFFixes()
Returns an integer value, the bits of which indicate the use of fixes/workarounds for the look and feel in use.- Returns:
- the lfFixes
-
getKeyWords
public java.util.ArrayList<java.lang.String> getKeyWords()
Returns a shallow copy the the keywords.- Returns:
- an ArrayList
-
setKeyWords
public void setKeyWords(java.util.ArrayList<java.lang.String> keyWords)
Sets the keyWords list.- Parameters:
keyWords- the keyWords to set
-
addKeyWord
public void addKeyWord(java.lang.String word)
-
getTitle
public java.lang.String getTitle()
Returns the title.- Returns:
- the title
-
setTitle
public void setTitle(java.lang.String title)
Creates a title. This will be display in index.html and used as the frame title by Processing.app.- Parameters:
title- the title to set
-
getDescription
public java.lang.String getDescription()
Returns the description.- Returns:
- the description
-
setDescription
public void setDescription(java.lang.String description)
Creates a description. This will be display in index.html.- Parameters:
description- the description to set
-
isTextAsShapes
public boolean isTextAsShapes()
Return the textAsShapes setting. If true, text will be rendered as glyphs. If false, the default Processing font will be used.- Returns:
- the textAsShapes
-
setTextAsShapes
public void setTextAsShapes(boolean textAsShapes)
Sets the textAsShapes setting. If true, text will be rendered as glyphs. If false, the default Processing font will be used.- Parameters:
textAsShapes- the textAsShapes to set
-
create
public java.awt.Graphics create()
- Specified by:
createin classjava.awt.Graphics
-
create
public java.awt.Graphics create(int x, int y, int width, int height)- Overrides:
createin classjava.awt.Graphics
-
append
public void append(java.awt.Component c, int elapsedTime)Appends a paint of the specified component to this instance. The component should have the same dimensions as the graphics for this instance. The appended graphics will be painted, when deployed to the target, at the time specified (+ the actionDelay constant value).- Specified by:
appendin classAbstractDeployableGraphics2D- Parameters:
c- the component to paintelapsedTime- the time to paint this component in the deployed code.
-
append
public void append(java.awt.Component c)
Appends a paint of the specified component to this instance. The component should have the same dimensions as the graphics for this instance. This is equivalent toappend(c, elapsedTime)where elapsedTime is the interval in milliseconds between the instantiation of this instance and this call toappend.- Specified by:
appendin classAbstractDeployableGraphics2D- Parameters:
c- the component to paint
-
write
public void write(java.lang.String fileName) throws java.io.IOExceptionWrites the generated code to file. Equivalent to: write(fileName, true, "./processing.js", "./PDEGraphics2D.css", true);- Overrides:
writein classAbstractDeployableGraphics2D- Parameters:
fileName- - String describing the file to write toThe remaining arguments are relevant only when htmlFlag==true and will be ignored otherwise.
Notes:
A file named "FILENAME.pde" will always be added to a folder name "FILENAME": the folder will be created if required following the usual Processing.app convention. If that folder already exists, any existing files will be overwritten
Additional data such as images will be written to a "/data" sub-folder.- Throws:
java.io.IOException
-
write
public void write(java.lang.String fileName, boolean htmlFlag) throws java.io.IOExceptionWrites the generated code to file. Equivalent to: write(fileName, htmlFlag, "./processing.js", "./PDEGraphics2D.css", true);- Parameters:
fileName- - String describing the file to write tohtmlFlag- - if true, html files to view the script will also be created.The remaining arguments are relevant only when htmlFlag==true and will be ignored otherwise.
Notes:
A file named "FILENAME.pde" will always be added to a folder name "FILENAME": the folder will be created if required following the usual Processing.app convention. If that folder already exists, any existing files will be overwritten
Additional data such as images will be written to a "/data" sub-folder.- Throws:
java.io.IOException
-
write
public void write(java.lang.String fileName, boolean htmlFlag, java.lang.String jsLoc) throws java.io.IOExceptionWrites the generated code to file. Equivalent to: write(fileName,htmlFlag, jsLoc, "./PDEGraphics2D.css", true);- Parameters:
fileName- - String describing the file to write tohtmlFlag- - if true, html files to view the script will also be created.The remaining arguments are relevant only when htmlFlag==true and will be ignored otherwise.
jsLoc- - String specifying the location of the processing.js file. If this is "processing.js" or "./processing.js", a copy of the JavaScript file will be created in the folder alongside the html files. Otherwise, the string should point to the location of a processing JavaScript file relative to the HTML file folder OR describe a URL. Notes:Notes:
A file named "FILENAME.pde" will always be added to a folder name "FILENAME": the folder will be created if required following the usual Processing.app convention. If that folder already exists, any existing files will be overwritten
Additional data such as images will be written to a "/data" sub-folder.- Throws:
java.io.IOException
-
write
public void write(java.lang.String fileName, boolean htmlFlag, java.lang.String jsLoc, java.lang.String cssLoc, boolean httpdFlag) throws java.io.IOExceptionWrites the generated code to file.- Parameters:
fileName- - String describing the file to write tohtmlFlag- - if true, html files to view the script will also be created.The remaining arguments are relevant only when htmlFlag==true and will be ignored otherwise.
jsLoc- - String specifying the location of the processing.js file. If this is "processing.js" or "./processing.js", a copy of the JavaScript file will be created in the folder alongside the html files. Otherwise, the string should point to the location of a processing JavaScript file relative to the HTML file folder OR describe a URL.cssLoc- - String specifying the location of the CSS styling. If this is "PDEGraphics2D.css" or "./PDEGraphics2D.css", a copy of the default CSS settings will be created in the folder alongside the html files. The the string may also point to the location of a suitable CSS file relative to the HTML file folder OR describe a URL. Alternatively, if cssLoc is "index.html" or "./index.html" the default CSS settings will be embedded in the heml file.httpdFlag- If true, a Python 2.7 script ("httpd.py") will be created alongside the html files which will set up a local server and display index.html in the system browser. This can be useful if system or security settings prevent access to the local file system. The port to use will be obtained by the script from the OS.Notes:
A file named "FILENAME.pde" will always be added to a folder name "FILENAME": the folder will be created if required following the usual Processing.app convention. If that folder already exists, any existing files will be overwritten
Additional data such as images will be written to a "/data" sub-folder.- Throws:
java.io.IOException
-
write
public void write(java.io.File f, boolean htmlFlag, java.lang.String jsLoc, java.lang.String cssLoc, boolean httpdFlag) throws java.io.IOExceptionWrites the generated code to file.- Parameters:
f- - theFileto write tohtmlFlag- - if true, html files to view the script will also be created.The remaining arguments are relevant only when htmlFlag==true and will be ignored otherwise.
jsLoc- - String specifying the location of the processing.js file. If this is "processing.js" or "./processing.js", a copy of the JavaScript file will be created in the folder alongside the html files. Otherwise, the string should point to the location of a processing JavaScript file relative to the HTML file folder OR describe a URL.cssLoc- - String specifying the location of the CSS styling. If this is "PDEGraphics2D.css" or "./PDEGraphics2D.css", a copy of the default CSS settings will be created in the folder alongside the html files. The the string may also point to the location of a suitable CSS file relative to the HTML file folder OR describe a URL. Alternatively, if cssLoc is "index.html" or "./index.html" the default CSS settings will be embedded in the heml file.httpdFlag- If true, a Python 2.7 script ("httpd.py") will be created alongside the html files which will set up a local server and display index.html in the system browser. This can be useful if system or security settings prevent access to the local file system. The port to use will be obtained by the script from the OS.Notes:
A file named "FILENAME.pde" will always be added to a folder name "FILENAME": the folder will be created if required following the usual Processing.app convention. If that folder already exists, any existing files will be overwritten
Additional data such as images will be written to a "/data" sub-folder.- Throws:
java.io.IOException
-
setStroke
public void setStroke(java.awt.Stroke s2)
- Overrides:
setStrokein classAbstractDeployableGraphics2D
-
draw
public void draw(java.awt.Shape s)
- Overrides:
drawin classAbstractDeployableGraphics2D
-
fill
public void fill(java.awt.Shape s)
- Overrides:
fillin classAbstractDeployableGraphics2D
-
fillRect
public void fillRect(int x, int y, int w, int h)- Overrides:
fillRectin classAbstractDeployableGraphics2D
-
drawRect
public void drawRect(int x, int y, int w, int h)- Overrides:
drawRectin classAbstractDeployableGraphics2D
-
drawString
public void drawString(java.lang.String str, int x, int y)- Overrides:
drawStringin classAbstractDeployableGraphics2D
-
drawString
public void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)- Overrides:
drawStringin classAbstractDeployableGraphics2D
-
drawString
public void drawString(java.lang.String str, float x, float y)- Overrides:
drawStringin classAbstractDeployableGraphics2D
-
drawString
public void drawString(java.text.AttributedCharacterIterator iterator, float x, float y)- Overrides:
drawStringin classAbstractDeployableGraphics2D
-
drawGlyphVector
public void drawGlyphVector(java.awt.font.GlyphVector vec, float x, float y)- Overrides:
drawGlyphVectorin classAbstractDeployableGraphics2D
-
drawLine
public void drawLine(int x1, int y1, int x2, int y2)- Overrides:
drawLinein classAbstractDeployableGraphics2D
-
clearRect
public void clearRect(int x, int y, int width, int height)- Overrides:
clearRectin classAbstractDeployableGraphics2D
-
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)- Overrides:
drawRoundRectin classAbstractDeployableGraphics2D
-
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)- Overrides:
fillRoundRectin classAbstractDeployableGraphics2D
-
drawOval
public void drawOval(int x, int y, int width, int height)- Overrides:
drawOvalin classAbstractDeployableGraphics2D
-
fillOval
public void fillOval(int x, int y, int width, int height)- Overrides:
fillOvalin classAbstractDeployableGraphics2D
-
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)- Overrides:
drawArcin classAbstractDeployableGraphics2D
-
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)- Overrides:
fillArcin classAbstractDeployableGraphics2D
-
drawPolyline
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)- Overrides:
drawPolylinein classAbstractDeployableGraphics2D
-
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)- Overrides:
drawPolygonin classAbstractDeployableGraphics2D
-
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)- Overrides:
fillPolygonin classAbstractDeployableGraphics2D
-
setColor
public void setColor(java.awt.Color c)
- Overrides:
setColorin classAbstractDeployableGraphics2D
-
setPaint
public void setPaint(java.awt.Paint p)
- Overrides:
setPaintin classAbstractDeployableGraphics2D
-
copyImage
public 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)Description copied from class:AbstractDeployableGraphics2DImplemented in some Graphics2D subclasses e.g. com.sun.java.Graphics2D. This is not part of the java.awt.Graphics2D API.- Specified by:
copyImagein classAbstractDeployableGraphics2D- Returns:
- true or false
-
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy)- Overrides:
copyAreain classAbstractDeployableGraphics2D
-
drawBytes
public void drawBytes(byte[] data, int offset, int length, int x, int y)- Overrides:
drawBytesin classAbstractDeployableGraphics2D
-
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)- Overrides:
drawImagein classAbstractDeployableGraphics2D
-
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)- Overrides:
drawImagein classAbstractDeployableGraphics2D
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)- Overrides:
drawImagein classAbstractDeployableGraphics2D
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)- Overrides:
drawImagein classAbstractDeployableGraphics2D
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Overrides:
drawImagein classAbstractDeployableGraphics2D
-
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)- Overrides:
drawImagein classAbstractDeployableGraphics2D
-
drawImage
public boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver observer)- Overrides:
drawImagein classAbstractDeployableGraphics2D
-
drawImage
public void drawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)- Overrides:
drawImagein classAbstractDeployableGraphics2D
-
drawRenderedImage
public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)- Overrides:
drawRenderedImagein classAbstractDeployableGraphics2D
-
drawRenderableImage
public void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)- Overrides:
drawRenderableImagein classAbstractDeployableGraphics2D
-
getCode
public java.lang.String getCode()
- Overrides:
getCodein classAbstractDeployableGraphics2D- Returns:
- the code
-
setPaintObject
public void setPaintObject(java.lang.Object referenceObject)
Description copied from class:AbstractDeployableGraphics2DCall 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);
}
}- Specified by:
setPaintObjectin classAbstractDeployableGraphics2D- Parameters:
referenceObject- the paintObject to set
-
addComment
public void addComment(java.lang.String comment)
Description copied from class:AbstractDeployableGraphics2DSets 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.- Specified by:
addCommentin classAbstractDeployableGraphics2D- Parameters:
comment- the comment to set as a String
-
addCode
public void addCode(java.lang.String code)
Description copied from class:AbstractDeployableGraphics2DInserts user-specified code into the coded output at the current location.- Specified by:
addCodein classAbstractDeployableGraphics2D- Parameters:
code- fully formatted code string
-
prependCode
public void prependCode(java.lang.String code)
Description copied from class:AbstractDeployableGraphics2DInserts 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).- Specified by:
prependCodein classAbstractDeployableGraphics2D- Parameters:
code- fully formatted code string
-
appendCode
public void appendCode(java.lang.String code)
Description copied from class:AbstractDeployableGraphics2DAdds user-specified code to the end of the generated code.- Specified by:
appendCodein classAbstractDeployableGraphics2D- Parameters:
code- the code to append
-
isVerbose
public boolean isVerbose()
- Returns:
- the verbose
-
setVerbose
public void setVerbose(boolean verbose)
- Parameters:
verbose- the verbose to set
-
getUserHTML
public static java.lang.String getUserHTML()
- Returns:
- the userHTML
-
setUserHTML
public static void setUserHTML(java.lang.String aUserHTML)
- Parameters:
aUserHTML- the userHTML to set
-
-
DMelt 3.0 © DataMelt by jWork.ORG