java.lang.Object
de.grogra.imp.awt.ViewComponentAdapter
de.grogra.imp.awt.CanvasAdapter
- All Implemented Interfaces:
ViewComponent
,ComponentWrapper
,Selectable
,Disposable
,ImageObserver
,Runnable
- Direct Known Subclasses:
AWTCanvas2D
,WireframeCanvas
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected static final AffineTransform
protected ImageAndGraphics
Fields inherited from class de.grogra.imp.awt.ViewComponentAdapter
DISPOSED, DISPOSING, RENDER_OVERLAY, RENDER_OVERLAY_FINISHED, RENDERED_IMAGE, RENDERING, RENDERING_OVERLAY, REPAINT_MASK
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface de.grogra.imp.ViewComponent
ALL, CHANGED, MIN_USER_FLAG, SCENE, SELECTION, TOOLS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
final Graphics2D
protected ImageObserver
Returns an observer which receives the information about the rendered image from aRenderer
.boolean
imageUpdate
(Image img, int infoflags, int x, int y, int width, int height) void
initCanvas
(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 RenderedImage> callback) Instructs the view component to create a snapshot.protected void
optionValueChanged
(String name, Object object) protected abstract void
paintHighlight
(int flags, Graphics2D g) protected abstract void
paintScene
(int flags, Graphics2D g) protected void
render
(int flags) Performs rendering.void
void
setColor
(int color) void
setColor
(int color, int state, boolean showSel) abstract void
void
void
void
static void
Methods inherited from class de.grogra.imp.awt.ViewComponentAdapter
checkRepaint, checkRepaintWrapException, dispose, disposeRenderer, disposeView, getColor, getColor, getDisplayResolution, getFactory, getFontMetrics, getGlobalLOD, getIntColor, getInterruptedException, getOption, getRenderGraphState, getView, initFactory, installListeners, invokeRenderSync, isRenderingOverlay, render, render, renderUninterruptibly, repaint, run, toSelection, uninstallListeners, updateResolution
-
Field Details
-
IDENTITY
-
sceneBuffer
-
antialiasing
protected boolean antialiasing
-
-
Constructor Details
-
CanvasAdapter
public CanvasAdapter()
-
-
Method Details
-
initCanvas
-
initView
Description copied from interface:ViewComponent
Initializes this component. This method sets theview
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.- Specified by:
initView
in interfaceViewComponent
- Overrides:
initView
in classViewComponentAdapter
- Parameters:
view
- the containing viewlistener
- mouse and key events will be reported to this listener
-
optionValueChanged
- Overrides:
optionValueChanged
in classViewComponentAdapter
-
getObserverForRenderer
Description copied from class:ViewComponentAdapter
Returns an observer which receives the information about the rendered image from aRenderer
. The returned observer has to manage the drawing of the (partially) rendered image on the view component.- Specified by:
getObserverForRenderer
in classViewComponentAdapter
- Returns:
- an observer receiving the image, or
null
if this is not supported by this component
-
checkBuffers
protected void checkBuffers() -
initRender
protected void initRender(int flags) Description copied from class:ViewComponentAdapter
Performs initialization tasks in preparation for rendering. This method is invoked byViewComponentAdapter.run()
in thisViewComponent
's own thread.- Specified by:
initRender
in classViewComponentAdapter
- Parameters:
flags
- combination of bit masks
-
getComponent
- Specified by:
getComponent
in interfaceComponentWrapper
-
imageUpdate
- Specified by:
imageUpdate
in interfaceImageObserver
-
invokeRender
protected void invokeRender(int flags) Description copied from class:ViewComponentAdapter
Invoked to perform rendering. This method is invoked byViewComponentAdapter.run()
in thisViewComponent
's own thread. Its sole task is to invokeViewComponentAdapter.invokeRenderSync(int)
in the rendering thread (which may be thisViewComponent
'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 untilViewComponentAdapter.invokeRenderSync(int)
has completed.- Specified by:
invokeRender
in classViewComponentAdapter
- Parameters:
flags
- the flags to pass toViewComponentAdapter.invokeRenderSync(int)
-
render
Description copied from class:ViewComponentAdapter
Performs rendering. This method is invoked byViewComponentAdapter.invokeRenderSync(int)
in a context whereWorkbench.current()
returns the workbench of this view.- Specified by:
render
in classViewComponentAdapter
- Parameters:
flags
- combination of bit masks- Throws:
InterruptedException
- if the rendering has been interrupted
-
initPaint
protected abstract void initPaint(int flags, int width, int height) -
paintScene
- Throws:
InterruptedException
-
paintHighlight
-
makeSnapshot
Description copied from interface:ViewComponent
Instructs the view component to create a snapshot. The created snapshot has to be delivered to the providedcallback
as an instance ofRenderedImage
. This may happen asynchronously, i.e., in an arbitrary thread.- Specified by:
makeSnapshot
in interfaceViewComponent
- Parameters:
callback
- callback which asynchronously receives the snapshot
-
writeEPS
-
getGraphics
-
resetGraphicsTransform
public void resetGraphicsTransform() -
setColor
-
setColor
public void setColor(int color) -
setColor
-
setColor
-
setColor
public void setColor(int color, int state, boolean showSel) -
setColor
-