The drawing methods which are guaranteed to work for the various output formats of the VectorGraphics system on the Java 2 platform. All methods are re-declared abstract, since this class inherits from Graphics2D and we would not want to actually or accidentally use any of those methods, except for the ones noted. Some int methods need to call their super.methods otherwise the compiler cannot make a distinction if it needs to convert int to doubles or call the super int method. Note that many of these routines modify the current transformation matrix. To guard against unintended side effects the following method should be used:
Graphics2D tempGraphics = (Graphics2D) originalGraphics.create(); tempGraphics.setStroke(originalGraphics.getStroke()); tempGraphics.rotate(...); tempGraphics.translate(...); ...drawing methods on tempGraphics... tempGraphics.dispose();
where
originalGraphics
is the original
Graphics2D
object. Note that
dispose
must be called when the drawing finishes on
tempGraphics
and that no drawing should be done on
originalGraphics
until
dispose
has been called.
@author Charles Loomis
@author Mark Donszelmann
@version $Id: VectorGraphics.java 10258 2007-01-05 22:51:59Z duns $