cz.cuni.jagrlib.iface
Interface GraphicsViewer

All Superinterfaces:
Breakable, Property, Trigger
All Known Implementing Classes:
AWTWindow, DefaultGraphicsViewer, GLWindow, RasterImagePreview

public interface GraphicsViewer
extends Trigger, Property

Viewer for RasterGraphics, VectorGraphics etc. Typical implementation uses some GUI object to [pre]view graphic results.

Since:
0.13
See Also:
GraphicsViewer.java, VectorGraphics, RasterGraphics

Nested Class Summary
static class GraphicsViewer.PreviewThread
          Preview thread for background repainting of attached GraphicsViewer instance.
 
Field Summary
static java.lang.String BLACK_BACKGROUND
          Window-title property (String): title for frame window holding the graphic output.
static java.lang.String WINDOW_TITLE
          Window-title property (String): title for frame window holding the graphic output.
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Method Summary
 void addInputListener(InputListener list)
          Adds input listener object.
 void addSemaphore(Semaphore s)
          Adds a new semaphore - object which wants to be signaled after the viewer window is closed (by user interaction etc.).
 void destroy()
          Destroys the preview window.
 void hudClear()
          Removes all HUD primitives.
 int hudGetFreeId()
          Returns id of any free HUD slot.
 void hudRemove(int id)
          Removes existing HUD primitive.
 void hudSetLine(int id, int x1, int y1, int x2, int y2)
          Replaces the given HUD primitive slot with line from [x1,y1] to [x2,y2].
 void invalidate(int xMin, int xMax, int yMin, int yMax)
          Invalidates the given rectangular region of the graphics output.
 void removeInputListener(InputListener list)
          Removes (previously added) input listener object.
 void removeSemaphore(Semaphore s)
          Removes one of associated semaphores.
 void repaint()
          Causes the instant repainting of actual invalid region of the graphic output.
 void repaintAll()
          Causes the instant repainting of the whole graphic output (regardless of the actual invalid region).
 boolean repaintLoop()
          Start (potentially) infinite repaint loop.
 boolean stopRepaintLoop()
          Stops the running repaint loop.
 
Methods inherited from interface cz.cuni.jagrlib.iface.Trigger
fire
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 
Methods inherited from interface cz.cuni.jagrlib.Breakable
setProgressListener, stop
 

Field Detail

WINDOW_TITLE

static final java.lang.String WINDOW_TITLE
Window-title property (String): title for frame window holding the graphic output.

See Also:
Constant Field Values

BLACK_BACKGROUND

static final java.lang.String BLACK_BACKGROUND
Window-title property (String): title for frame window holding the graphic output.

See Also:
Constant Field Values
Method Detail

repaintLoop

boolean repaintLoop()
Start (potentially) infinite repaint loop. It can be terminated either by a stopRepaintLoop() call or by external user interaction (user break, window close, ..).

Returns:
true if the loop was terminated by a stopRepaintLoop() call.
See Also:
stopRepaintLoop()

stopRepaintLoop

boolean stopRepaintLoop()
Stops the running repaint loop.

Returns:
true if the loop was successfully stopped.
See Also:
repaintLoop()

destroy

void destroy()
Destroys the preview window. Stops repaint-loop eventually.


repaintAll

void repaintAll()
Causes the instant repainting of the whole graphic output (regardless of the actual invalid region). Trigger.fire(int) call has the same effect..

See Also:
invalidate(int, int, int, int), repaint(), Trigger.fire(int)

invalidate

void invalidate(int xMin,
                int xMax,
                int yMin,
                int yMax)
Invalidates the given rectangular region of the graphics output. Invalid regions will be repainted during the next repaint() call...

Parameters:
xMin - X coordinate of the upper left corner.
xMax - X coordinate of the lower right corner (outside pixel).
yMin - Y coordinate of the upper left corner.
yMax - Y coordinate of the upper left corner (outside pixel).
See Also:
repaint()

repaint

void repaint()
Causes the instant repainting of actual invalid region of the graphic output.

See Also:
repaintAll(), invalidate(int, int, int, int)

addSemaphore

void addSemaphore(Semaphore s)
Adds a new semaphore - object which wants to be signaled after the viewer window is closed (by user interaction etc.).

Parameters:
s - A new semaphore instance.
See Also:
removeSemaphore(cz.cuni.jagrlib.Semaphore)

removeSemaphore

void removeSemaphore(Semaphore s)
Removes one of associated semaphores.

Parameters:
s - Semaphore to be removed.
See Also:
addSemaphore(cz.cuni.jagrlib.Semaphore)

addInputListener

void addInputListener(InputListener list)
Adds input listener object.


removeInputListener

void removeInputListener(InputListener list)
Removes (previously added) input listener object.


hudClear

void hudClear()
Removes all HUD primitives.


hudGetFreeId

int hudGetFreeId()
Returns id of any free HUD slot.


hudSetLine

void hudSetLine(int id,
                int x1,
                int y1,
                int x2,
                int y2)
Replaces the given HUD primitive slot with line from [x1,y1] to [x2,y2].


hudRemove

void hudRemove(int id)
Removes existing HUD primitive.