public abstract class J3DGraphics2D extends Graphics2D
An application obtains a J3D 2D graphics context object from the Canvas3D object that the application wishes to render into by using the getGraphics2D method. A new J3DGraphics2D object is created if one does not already exist.
Note that the drawing methods in this class, including those
inherited from Graphics2D, are not necessarily executed
immediately. They may be buffered up for future execution.
Applications must call the flush(boolean)
method to ensure
that the rendering actually happens. The flush method is implicitly
called in the following cases:
Canvas3D.swap
method calls
flush(true)
flush(true)
prior to
swapping the buffer for a double buffered on-screen Canvas3Dflush(true)
prior to
copying into the off-screen buffer of an off-screen Canvas3Dflush(false)
after
calling the preRender, renderField, postRender, and postSwap
Canvas3D callback methods.A single-buffered, pure-immediate mode application must explicitly call flush to ensure that the graphics will be rendered to the Canvas3D.
Canvas3D.getGraphics2D()
Modifier and Type | Method and Description |
---|---|
void |
clearRect(int x,
int y,
int width,
int height)
This method is not supported.
|
Graphics |
create()
This method is not supported.
|
Graphics |
create(int x,
int y,
int width,
int height)
This method is not supported.
|
abstract void |
drawAndFlushImage(BufferedImage img,
int x,
int y,
ImageObserver observer)
Draws the specified image and flushes the buffer.
|
abstract void |
flush(boolean wait)
Flushes all previously executed rendering operations to the
drawing buffer for this 2D graphics object.
|
Color |
getBackground()
This method is not supported.
|
void |
setBackground(Color color)
This method is not supported.
|
addRenderingHints, clip, draw, draw3DRect, drawGlyphVector, drawImage, drawImage, drawRenderableImage, drawRenderedImage, drawString, drawString, drawString, drawString, fill, fill3DRect, getComposite, getDeviceConfiguration, getFontRenderContext, getPaint, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, rotate, rotate, scale, setComposite, setPaint, setRenderingHint, setRenderingHints, setStroke, setTransform, shear, transform, translate, translate
clipRect, copyArea, dispose, drawArc, drawBytes, drawChars, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawPolyline, drawRect, drawRoundRect, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillRoundRect, finalize, getClip, getClipBounds, getClipBounds, getClipRect, getColor, getFont, getFontMetrics, getFontMetrics, hitClip, setClip, setClip, setColor, setFont, setPaintMode, setXORMode, toString
public final Graphics create()
create
in class Graphics
UnsupportedOperationException
- this method is not supportedCanvas3D.getGraphics2D()
public final Graphics create(int x, int y, int width, int height)
create
in class Graphics
UnsupportedOperationException
- this method is not supportedCanvas3D.getGraphics2D()
public final void setBackground(Color color)
setBackground
in class Graphics2D
UnsupportedOperationException
- this method is not supportedBackground
,
GraphicsContext3D.setBackground(org.scijava.java3d.Background)
,
GraphicsContext3D.clear()
public final Color getBackground()
getBackground
in class Graphics2D
UnsupportedOperationException
- this method is not supportedBackground
,
GraphicsContext3D.getBackground()
,
GraphicsContext3D.clear()
public final void clearRect(int x, int y, int width, int height)
clearRect
in class Graphics
UnsupportedOperationException
- this method is not supportedBackground
,
GraphicsContext3D.setBackground(org.scijava.java3d.Background)
,
GraphicsContext3D.clear()
public abstract void flush(boolean wait)
wait
- flag indicating whether or not to wait for the
rendering to be complete before returning from this call.public abstract void drawAndFlushImage(BufferedImage img, int x, int y, ImageObserver observer)
drawImage(...)
followed by flush(false)
, but can avoid the cost
of making an extra copy of the image in some cases. Anything
previously drawn to this J3DGraphics2D will be flushed before
the image is drawn.img
- The image to drawx
- The x location to draw aty
- The y location to draw atobserver
- The ImageObserverCopyright © 2016–2022 SciJava. All rights reserved.