net.groboclown.gui.paintpipe.v1
Class ZOrderPainter
java.lang.Object
|
+--net.groboclown.gui.paintpipe.v1.PainterThread
|
+--net.groboclown.gui.paintpipe.v1.OutputPainter
|
+--net.groboclown.gui.paintpipe.v1.PipePainter
|
+--net.groboclown.gui.paintpipe.v1.SortingPainter
|
+--net.groboclown.gui.paintpipe.v1.ZOrderPainter
- public abstract class ZOrderPainter
- extends SortingPainter
The ZOrderPainter works like a SortingPainter, but sends the subclass
methods waiting on events, the events in correct Z-Order.
The basis for Z-Ordering is the ZDepth attribute associated with
several events (ImageDoneEvent
and ZDepthDoneEvent
).
The lower the number, the lower in Z-Order, and so the higher the
priority for drawing. This follows the Painter's Algorithm for
back-to-forward painting. Other algorithms require more indepth knowledge
of the data being processed, and so cannot be covered in a generic way
such as this.
These are all dependent upon the threads which draw each z-depth.
If a lower depth takes longer then a higher depth, then all depths above
the slow depth will be idly waiting. But that's the cost of Z-Ordering.
There are two methods for implementing Z-Order. The first way
is simple and straight-forward. The second, however, requires
help from the particular instance.
- Only one ImageDoneEvent is stored per Z-Depth. This allows for
fast processing, as the images are processed as quickly as they
come in order. So this is a single-key sorting, which is fast,
but isn't very flexible.
-
In order to enforce same-depth sorting, all passed-in ImageDoneEvents
must also implement Comparable
.
- Version:
- 1.0
- Author:
- Matt Albrecht
- See Also:
OutputPainter
,
PaintQueue
Fields inherited from class net.groboclown.gui.paintpipe.v1.PipePainter |
inQ |
Fields inherited from class net.groboclown.gui.paintpipe.v1.PainterThread |
frameNumber, group, isPainting, METRICS, metricsListeners, name, numberPaintAttempts, numberWaitForEvent, painter, priority, RUN_NEVER_STARTED, RUN_PAUSED, RUN_REQUESTED_PAUSE, RUN_REQUESTED_STOP, RUN_RUNNING, RUN_STOPPED, runState, sentPaintFinishedEvent, startTimeMillis, syncThis, totalPaintTimeMillis, totalWaitForEventTimeMillis |
Constructor Summary |
ZOrderPainter(PaintQueue in,
PaintQueue out,
int maxdepth)
Creates a new ZOrderPainter with a new input and output
PaintQueue, and a given maximum z-order depth. |
Method Summary |
protected boolean |
areMoreEvents()
Checks if any more events need to be pulled from the queue. |
Methods inherited from class net.groboclown.gui.paintpipe.v1.PainterThread |
addMetricsListener, canPause, canStop, cleanup, fireMetricsPaint, fireMetricsWait, getFrameNumber, getNumberPaintCalls, getNumberWaitForEventTimes, getStartTimeMillis, getTotalPaintTimeMillis, getTotalWaitForEventTimeMillis, initialize, isAlive, isInterrupted, isRunning, isStopImpending, isStopping, isSuspended, isWaitingForEvent, join, killPainting, removeMetricsListener, resume, start, stop, stopInterrupt, stopInterruptJoin, stopJoin, suspend, suspendInterrupt |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
zds
private ZOrderPainter.ZDepthStruct[] zds
ZOrderPainter
public ZOrderPainter(PaintQueue in,
PaintQueue out,
int maxdepth)
- Creates a new ZOrderPainter with a new input and output
PaintQueue, and a given maximum z-order depth.
areMoreEvents
protected final boolean areMoreEvents()
- Checks if any more events need to be pulled from the queue.
- Overrides:
areMoreEvents
in class SortingPainter
- Returns:
- true if it is believed that more PaintEvents are
going to be used in the current frame creation.
Written under the LGPL