de.grogra.imp.awt
public abstract class CanvasAdapter extends ViewComponentAdapter implements java.awt.image.ImageObserver
| Modifier and Type | Class and Description |
|---|---|
class |
CanvasAdapter.CanvasComponent |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
antialiasing |
protected static java.awt.geom.AffineTransform |
IDENTITY |
protected ImageAndGraphics |
sceneBuffer |
DISPOSED, DISPOSING, RENDERED_IMAGE, RENDERING, REPAINT_MASKABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHALL, CHANGED, MIN_USER_FLAG, SCENE, SELECTION, TOOLS| Constructor and Description |
|---|
CanvasAdapter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkBuffers() |
java.lang.Object |
getComponent() |
java.awt.Graphics2D |
getGraphics() |
protected java.awt.image.ImageObserver |
getObserverForRenderer()
Returns an observer which receives the information about the
rendered image from a
Renderer. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height) |
void |
initCanvas(java.awt.Component canvas) |
protected abstract void |
initPaint(int flags,
int width,
int height) |
protected void |
initRender(int flags)
Performs initialization tasks in preparation for rendering.
|
void |
initView(View view,
EventListener listener)
Initializes this component.
|
protected void |
invokeRender(int flags)
Invoked to perform rendering.
|
void |
makeSnapshot(ObjectConsumer<? super java.awt.image.RenderedImage> callback)
Instructs the view component to create a snapshot.
|
protected void |
optionValueChanged(java.lang.String name,
java.lang.Object object) |
protected abstract void |
paintHighlight(int flags,
java.awt.Graphics2D g) |
protected abstract void |
paintScene(int flags,
java.awt.Graphics2D g) |
protected void |
render(int flags)
Performs rendering.
|
void |
resetGraphicsTransform() |
abstract void |
setColor(java.awt.Color color) |
void |
setColor(java.awt.Color color,
int state,
boolean showSel) |
void |
setColor(int color) |
void |
setColor(int color,
int state,
boolean showSel) |
void |
setColor(Tuple3f color) |
void |
setColor(Tuple3f color,
int state,
boolean showSel) |
static void |
writeEPS(Item item,
java.lang.Object info,
Context ctx) |
checkRepaint, checkRepaintWrapException, dispose, disposeRenderer, getColor, getColor, getFactory, getFontMetrics, getGlobalLOD, getIntColor, getInterruptedException, getOption, getRenderGraphState, getView, initFactory, installListeners, invokeRenderSync, render, render, renderUninterruptibly, repaint, run, toSelection, uninstallListenersprotected boolean antialiasing
protected static final java.awt.geom.AffineTransform IDENTITY
protected ImageAndGraphics sceneBuffer
protected void checkBuffers()
public java.lang.Object getComponent()
getComponent in interface ComponentWrapperpublic final java.awt.Graphics2D getGraphics()
protected java.awt.image.ImageObserver getObserverForRenderer()
ViewComponentAdapterRenderer. The returned observer
has to manage the drawing of the (partially) rendered image
on the view component.getObserverForRenderer in class ViewComponentAdapternull if
this is not supported by this componentpublic boolean imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
imageUpdate in interface java.awt.image.ImageObserverpublic void initCanvas(java.awt.Component canvas)
protected abstract void initPaint(int flags,
int width,
int height)
protected void initRender(int flags)
ViewComponentAdapterViewComponentAdapter.run() in this
ViewComponent's own thread.initRender in class ViewComponentAdapterflags - combination of bit maskspublic void initView(View view, EventListener listener)
ViewComponentview
within which this view component is used to display the graph.
It also sets an event listener. this has to be informed of
mouse and keys events within the view component by implementations
of this method.initView in interface ViewComponentinitView in class ViewComponentAdapterview - the containing viewlistener - mouse and key events will be reported to this listenerprotected void invokeRender(int flags)
ViewComponentAdapterViewComponentAdapter.run() in this ViewComponent's own thread.
Its sole task is to invoke ViewComponentAdapter.invokeRenderSync(int) in
the rendering thread (which may be this
ViewComponent's thread, the AWT-thread, or another
thread, depending on the implementation) in a write-protected
context. The invocation has to be
synchronously, i.e., if it is in another thread, the current thread
has to wait until ViewComponentAdapter.invokeRenderSync(int) has completed.invokeRender in class ViewComponentAdapterflags - the flags to pass to ViewComponentAdapter.invokeRenderSync(int)public void makeSnapshot(ObjectConsumer<? super java.awt.image.RenderedImage> callback)
ViewComponentcallback as an
instance of RenderedImage. This may happen asynchronously,
i.e., in an arbitrary thread.makeSnapshot in interface ViewComponentcallback - callback which asynchronously receives the snapshotprotected void optionValueChanged(java.lang.String name,
java.lang.Object object)
optionValueChanged in class ViewComponentAdapterprotected abstract void paintHighlight(int flags,
java.awt.Graphics2D g)
protected abstract void paintScene(int flags,
java.awt.Graphics2D g)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected void render(int flags)
throws java.lang.InterruptedException
ViewComponentAdapterViewComponentAdapter.invokeRenderSync(int) in a context where
Workbench.current() returns the workbench of this
view.render in class ViewComponentAdapterflags - combination of bit masksjava.lang.InterruptedException - if the rendering has been interruptedpublic void resetGraphicsTransform()
public abstract void setColor(java.awt.Color color)
public void setColor(java.awt.Color color,
int state,
boolean showSel)
public void setColor(int color)
public void setColor(int color,
int state,
boolean showSel)
public void setColor(Tuple3f color)
public void setColor(Tuple3f color, int state, boolean showSel)