|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--quicktime.app.image.QTImageDrawer
Enables standard java drawing commands and graphics objects to have their content rendered by QuickTime within a QuickTime graphics space. The QTImageDrawer is a parent container for an object that implements the Paintable interface - which is the object that actually does the drawing using standard java.awt paint commands and graphics objects. The QTImageDrawer implements the DynamicImage interface so can be added to the quicktime.app.display.Compositor object and thus used to draw into the same display space as other QuickTime generated content, or can be a direct client of a QTCanvas.
The isSingleFrame flag that is specified in the constructor allows optimisations to be made by the QTImageDrawer. If this flag is set to Redrawable.kSingleFrame then the QTImageDrawer will only call its Paintable object once to capture the image it Paintable draws. It will then discard all of the objects it has acquired to allow the paint call to the Paintable. If kMultiFrame is specified then on each redraw call the Paintable's paint call is called and the result is redrawn. If the QTImageDrawer is a member of the SWCompositor a similar efficiency can be achieved - if kSingleFrame is specified then when the drawer is added to the Compositor it does not require invalidation so does not create an invalidator as its image data is static. If kMultiFrame is specified then an invalidator is created.
An application can explicitly call prepaint - which is the method that calls the Paintable's paint method at any time. If the application is itself controlling the prepaint call then it will probably want to set and reset the isRedrawing flag as the redraw method determines whether to call prepaint or not based on the value of this flag. Once image data has been captured using the prepaint call to see the results in destination QDGraphics redraw must be called. Thus if an application is calling prepaint itself it will likely want to then setRedrawing to false and would only require redrawing to be set to true if it requires any consequent calls of the redraw method to re-capture image data from a call to prepaint.
The Invalidator determines if the QTImageDrawer requires redrawing and invalidation based on the value of the isRedrawing flag - it redraws and invalidates if isRedrawing returns true. If the application is controlling the prepaint calls (and thus would typically set redrawing to false) then it should invalidate the sprite presenter of the QTImageDrawer.
quicktime.app.display.Compositor
,
quicktime.app.display.Paintable
Field Summary | |
static int |
kMultiFrameRetain
This flag modifies the behaviour of the multiFrame flag in that it will retain resources that are used between invocations of the attached Paintables paint method. |
Fields inherited from interface quicktime.app.image.Redrawable |
kMultiFrame, kSingleFrame |
Constructor Summary | |
QTImageDrawer(java.awt.Image image)
This creates a QTImageDrawer that will grab the pixel data that results from drawing the specified image at its full size. |
|
QTImageDrawer(java.awt.Image image,
java.awt.Dimension initialSize)
This creates a QTImageDrawer that will grab the pixel data that results from a scaled drawing of the specified image at the specified size. |
|
QTImageDrawer(Paintable painter,
java.awt.Dimension initialSize,
int isSingleFrame)
This creates the QTImageDrawer object which is the parent container of the Paintable object. |
Method Summary | |
void |
addedTo(java.lang.Object interest)
This method is called by the specified object when the instance of the class that implements this interface is added to the object that is the source of the interest. |
Invalidator |
addedToCompositor(SWCompositor c,
TwoDSprite s)
Returns an object that invalidates a sprite. |
boolean |
addNotifyListener(NotifyListener nl)
This registers the deferred listener. |
int |
export(GraphicsExporter exporter)
This method uses the supplied GraphicsExporter to export the current image that is being presented by the QTImageDrawer and its Paintable client. |
int |
export(GraphicsExporter exporter,
QDGraphics offscreenGWorld)
This method uses the supplied GraphicsExporter to export the current image that is being presented by the QTImageDrawer and its Paintable client. |
Region |
getClip()
Returns a region that defines the current clipping region for the object. |
ImageDescription |
getDescription()
This method should return an ImageDescription that describes the image data that the class contains. |
QDRect |
getDisplayBounds()
QTCanvas calls this method when it needs to ask the client for its boundary. |
GraphicsMode |
getGraphicsMode()
This gets the current GraphicsMode for the compositor. |
QDGraphics |
getGWorld()
QTCanvas calls this method to get the destination QDGraphics of its client. |
EncodedImage |
getImage()
This method returns the actual image data. |
java.awt.Dimension |
getInitialSize()
Deprecated. since QTJava 4.0 |
Matrix |
getMatrix()
This will return the client's current display transformations |
QDDimension |
getOriginalSize()
Deprecated. since QTJava 4.0 |
Paintable |
getPaintable()
Returns the Paintable object that is the client of the QTImageDrawer. |
java.awt.Dimension |
getSize()
Returns the current size of the offscreen Image that the Painter object will draw into. |
boolean |
isRedrawing()
Returns true if the image data may be altered or different upon different calls of the redraw method of the QTDrawable interface |
boolean |
isSingleFrame()
Returns true if the Redrawable only has a single frame to render and thus will never need to re-acquire or redraw its image. |
Region |
prepaint()
This method is used to paint the painter object's image and to grab the resulting pixels into a format that the QTImageDrawer can then draw using the quicktime drawing commands. |
void |
redraw(Region invalidRgn)
QTCanvas calls this method when the client should redraw itself. |
void |
removedFrom(java.lang.Object interest)
This method is called by the specified object when the instance of the class that implements this interface is removed from the object that is the source of the interest. |
void |
removedFromCompositor(SWCompositor c)
When a dynamic image class is removed from a SWCompositor this method is called to allow the class to cleanup any of the invalidation processes it had established in the addedToCompositor call. |
void |
setClip(Region reg)
Sets a region that will define the clipping region for the object |
void |
setDisplayBounds(QDRect bounds)
QTCanvas calls this method when it needs to tell the client to adjust its location, width and/or height. |
void |
setGraphicsMode(GraphicsMode mode)
This sets the GraphicsMode for the Compositor when it draws its composited contents to its destination QDGraphics (typically the QTCanvas). |
void |
setGWorld(QDGraphics cgp)
QTCanvas calls this method to give the client the QDGraphics object it should use to do its drawing. |
void |
setLocation(int x,
int y)
A convenience method to set the position of a QTDrawable object. |
void |
setMatrix(Matrix matrix)
This method assigns a mapping matrix to the sequence. |
void |
setRedrawing(boolean redrawFlag)
If true then the redraw method of the object will fetch new image data from its image source. |
ImagePresenter |
toImagePresenter()
This will return an ImagePresenter object from the drawing that has been done by the Paintable object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int kMultiFrameRetain
Constructor Detail |
public QTImageDrawer(Paintable painter, java.awt.Dimension initialSize, int isSingleFrame)
painter
- the java object that will paint into the space reserved by the QTImageDrawerinitialSize
- the size (with origin of 0, 0) that defines the drawing size available to the painter.isSingleFrame
- if the kSingleFrame flag is set the Redrawable will capture the
the results of the Paintable's paint call and then discard all of the resources required
to call its Paintable (and the Paintable itself). In this case the Paintable's paint method
will only be called once. If kSingleFrame is not set the Paintable's paint call will be called
whenever redraw() is called and the isRedrawing flag is true.public QTImageDrawer(java.awt.Image image) throws QTAppException
image
- the java.awt.Image to capture. The size of this image must be known before
this constructor can be used.JImagePainter
public QTImageDrawer(java.awt.Image image, java.awt.Dimension initialSize)
image
- the java.awt.Image to capture.initialSize
- the scaled drawing size of the image.JImagePainter
Method Detail |
public Paintable getPaintable()
public int export(GraphicsExporter exporter) throws QTException
exporter
- the GraphicsExporter that will be used to export the pixel imagepublic int export(GraphicsExporter exporter, QDGraphics offscreenGWorld) throws QTException
exporter
- the GraphicsExporter that will be used to export the pixel imageoffscreenGWorld
- the destination QDGraphics that is used to export (ie. the pixel image).public java.awt.Dimension getSize()
public final Region getClip() throws QTException
getClip
in interface QTDrawable
public final void setClip(Region reg) throws StdQTException
setClip
in interface QTDrawable
reg
- the new clipping regionpublic ImagePresenter toImagePresenter() throws QTException
public ImageDescription getDescription() throws QTException
getDescription
in interface ImageSpec
public EncodedImage getImage() throws QTException
getImage
in interface ImageSpec
public final Matrix getMatrix() throws StdQTException
getMatrix
in interface Transformable
public final void setMatrix(Matrix matrix) throws QTException
setMatrix
in interface Transformable
matrix
- a Matrix object that specifies how to transform the image during
decompressionpublic java.awt.Dimension getInitialSize() throws QTException
()
public QDDimension getOriginalSize() throws QTException
getOriginalSize
in interface Transformable
()
public final QDGraphics getGWorld()
getGWorld
in interface QTDrawable
public void setGWorld(QDGraphics cgp) throws QTException
setGWorld
in interface QTDrawable
cgp
- a QDGraphics objectpublic void setDisplayBounds(QDRect bounds) throws StdQTException
setDisplayBounds
in interface Drawable
bounds
- the new size and location.public void setLocation(int x, int y) throws QTException
setLocation
in interface QTDrawable
x
- the new x locationy
- the new y locationpublic QDRect getDisplayBounds()
getDisplayBounds
in interface Drawable
public void redraw(Region invalidRgn) throws QTException
This call will just redraw the current image. If you want to have the Paintable client repaint itself then you must set the redrawing flag to true.
redraw
in interface Drawable
invalidRgn
- the invalidRgn that the client should redrawsetRedrawing(boolean)
public void setRedrawing(boolean redrawFlag)
setRedrawing
in interface Redrawable
redrawFlag
- boolean determining whether the current image is redrawn (false)
of fresh or updated image data is first retrieved (true).public boolean isSingleFrame()
isSingleFrame
in interface Redrawable
quicktime.app.image.Redrawable
public boolean isRedrawing()
isRedrawing
in interface Redrawable
public Region prepaint() throws QTException
public void setGraphicsMode(GraphicsMode mode) throws QTException
setGraphicsMode
in interface Compositable
quicktime.app.image.Compositable
gMode
- Specifies the graphics mode.public GraphicsMode getGraphicsMode()
getGraphicsMode
in interface Compositable
quicktime.app.image.Compositable
public Invalidator addedToCompositor(SWCompositor c, TwoDSprite s)
The Invalidators provided with objects that implement the DynamicImage interface will execute at the scale and period of the Compositor when they are created.
This call will not return an Invalidator if the QTImageDrawer is presenting a single frame image as the assumption is made that the image data is not changing.
addedToCompositor
in interface DynamicImage
c
- the Compositor in which the DynamicImage is a members
- the TwoDSprite that is presenting the DynamicImage's image in
the Compositor. This is the sprite that must be invalidated.quicktime.app.display.SWCompositor
public void removedFromCompositor(SWCompositor c)
removedFromCompositor
in interface DynamicImage
c
- the SWCompositor it is being removed frompublic void addedTo(java.lang.Object interest)
addedTo
in interface Listener
interest
- the object that is to be the source of interest for the
the object that implements this interface.public void removedFrom(java.lang.Object interest)
removedFrom
in interface Listener
interest
- the object that was the source of interest for the
the object that implements this interface.public boolean addNotifyListener(NotifyListener nl)
addNotifyListener
in interface Notifier
dl
- the listener that the DeferredListener notifies when
its listen source becomes valid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |