All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class quicktime.app.image.QTImageDrawer

java.lang.Object
   |
   +----quicktime.app.image.QTImageDrawer

public class QTImageDrawer
extends Object
implements Notifier, QTDrawable, DynamicImage, Redrawable
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.

See Also:
Compositor, Paintable

Constructor Index

 o QTImageDrawer(Paintable, Dimension, int)
This creates the QTImageDrawer object which is the parent container of the Paintable object.

Method Index

 o addedTo(Object)
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.
 o addedToCompositor(SWCompositor, TwoDSprite)
Returns an object that invalidates a sprite.
 o addNotifyListener(NotifyListener)
This registers the deferred listener.
 o getClip()
Returns a region that defines the current clipping region for the object.
 o getDescription()
This method should return an ImageDescription that describes the image data that the class contains.
 o getDisplayBounds()
QTCanvas calls this method when it needs to ask the client for its boundary.
 o getGraphicsMode()
This gets the current GraphicsMode for the compositor.
 o getGWorld()
QTCanvas calls this method to get the destination QDGraphics of its client.
 o getImage()
This method returns the actual image data.
 o getInitialSize()
This method returns the original size before the transformations specified in the returned matrix are applied.
 o getMatrix()
This will return the client's current display transformations
 o getSize()
Returns the current size of the offscreen Image that the Painter object will draw into.
 o isRedrawing()
Returns true if the image data may be altered or different upon different calls of the redraw method of the QTDrawable interface
 o 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.
 o 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.
 o redraw(Region)
QTCanvas calls this method when the client should redraw itself.
 o removedFrom(Object)
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.
 o removedFromCompositor(SWCompositor)
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.
 o setClip(Region)
Sets a region that will define the clipping region for the object
 o setDisplayBounds(QDRect)
QTCanvas calls this method when it needs to tell the client to adjust its location, width and/or height.
 o setGraphicsMode(GraphicsMode)
This sets the GraphicsMode for the Compositor when it draws its composited contents to its destination QDGraphics (typically the QTCanvas).
 o setGWorld(QDGraphics)
QTCanvas calls this method to give the client the QDGraphics object it should use to do its drawing.
 o setLocation(int, int)
A convenience method to set the position of a QTDrawable object.
 o setMatrix(Matrix)
This method assigns a mapping matrix to the sequence.
 o setRedrawing(boolean)
If true then the redraw method of the object will fetch new image data from its image source.
 o toImagePresenter()
This will return an ImagePresenter object from the drawing that has been done by the Paintable object.

Constructors

 o QTImageDrawer
 public QTImageDrawer(Paintable painter,
                      Dimension initialSize,
                      int isSingleFrame) throws QTException
This creates the QTImageDrawer object which is the parent container of the Paintable object. You supply an initial size - which defines the drawing area that the paintable object has to draw into. Once created a paintable object's drawing area cannot be resized as far as its relationship to its parent container. If the display area of the QTImageDrawer is changed then the iamge that the Paintable object paints will be scaled accordingly.

Parameters:
painter - the java object that will paint into the space reserved by the QTImageDrawer
initialSize - 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.

Methods

 o getSize
 public Dimension getSize()
Returns the current size of the offscreen Image that the Painter object will draw into.

Returns:
the size
 o getClip
 public final Region getClip() throws QTException
Returns a region that defines the current clipping region for the object.

Returns:
the clipping region
 o setClip
 public final void setClip(Region reg) throws StdQTException
Sets a region that will define the clipping region for the object

Parameters:
reg - the new clipping region
 o toImagePresenter
 public ImagePresenter toImagePresenter() throws QTException
This will return an ImagePresenter object from the drawing that has been done by the Paintable object. This will copy the image data that has been created. You will have to have attached the QTImageDrawer object to a canvas and called redraw() before this will contain a valid image due to the restriction in java.awt 1.1 that offscreen java Images cannot be created unless the java.awt.Component is attached to a container with an existing native graphics environment.

Returns:
an ImagePresenter object of the drawn java image.
 o getDescription
 public ImageDescription getDescription() throws QTException
This method should return an ImageDescription that describes the image data that the class contains.

Returns:
the ImageDescription of an Image
 o getImage
 public synchronized EncodedImage getImage() throws QTException
This method returns the actual image data.

Returns:
the image data
 o getMatrix
 public final Matrix getMatrix() throws StdQTException
This will return the client's current display transformations

Returns:
the display transformations of the client
 o setMatrix
 public final void setMatrix(Matrix matrix) throws QTException
This method assigns a mapping matrix to the sequence.

QuickTime::SetDSequenceMatrix

Parameters:
matrix - a Matrix object that specifies how to transform the image during decompression
 o getInitialSize
 public Dimension getInitialSize() throws QTException
This method returns the original size before the transformations specified in the returned matrix are applied.

 o getGWorld
 public final QDGraphics getGWorld()
QTCanvas calls this method to get the destination QDGraphics of its client.

Returns:
a QDGraphics object or null
 o setGWorld
 public void setGWorld(QDGraphics cgp) throws QTException
QTCanvas calls this method to give the client the QDGraphics object it should use to do its drawing. If the incoming QDGraphics is the QDGraphics.scratch then the drawable will not be visible and can disable itself. If a client is unable to set the graphics world it should throw an exception.

Parameters:
cgp - a QDGraphics object
 o setDisplayBounds
 public synchronized void setDisplayBounds(QDRect bounds) throws StdQTException
QTCanvas calls this method when it needs to tell the client to adjust its location, width and/or height. All values are in pixels.

Parameters:
bounds - the new size and location.
 o setLocation
 public void setLocation(int x,
                         int y) throws QTException
A convenience method to set the position of a QTDrawable object.

Parameters:
x - the new x location
y - the new y location
 o getDisplayBounds
 public QDRect getDisplayBounds()
QTCanvas calls this method when it needs to ask the client for its boundary. All values are in pixels.

Returns:
the boundary of the client
 o redraw
 public synchronized void redraw(Region invalidRgn) throws QTException
QTCanvas calls this method when the client should redraw itself. If the canvas is able to discern that only a part of the client's drawing area needs to be redrawn - then this area shall be passed in using the invalidRgn. Otherwise this will be null in which case the client should redraw itself entirely.

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.

Parameters:
invalidRgn - the invalidRgn that the client should redraw
See Also:
setRedrawing
 o setRedrawing
 public void setRedrawing(boolean redrawFlag)
If true then the redraw method of the object will fetch new image data from its image source.

Parameters:
redrawFlag - boolean determining whether the current image is redrawn (false) of fresh or updated image data is first retrieved (true).
 o isSingleFrame
 public 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. Certain Redrawable objects are able to optimise their resources knowing this constraint.

 o isRedrawing
 public boolean isRedrawing()
Returns true if the image data may be altered or different upon different calls of the redraw method of the QTDrawable interface

Returns:
s true if redrawing otherwise false if draws exsiting data
 o prepaint
 public Region prepaint() throws QTException
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. It returns a Region that defins the areas of the pixel data that were changed from the call. It will call the Paintable's paint method.

Returns:
a Region or null if the QTImageDrawer does not yet have an offscreen java.awt.Image object to paint too.
 o setGraphicsMode
 public void setGraphicsMode(GraphicsMode mode) throws QTException
This sets the GraphicsMode for the Compositor when it draws its composited contents to its destination QDGraphics (typically the QTCanvas).

 o getGraphicsMode
 public GraphicsMode getGraphicsMode()
This gets the current GraphicsMode for the compositor.

 o addedToCompositor
 public Invalidator addedToCompositor(SWCompositor c,
                                      TwoDSprite s)
Returns an object that invalidates a sprite. When a DynamicImage is a member of a SWompositor and the DynamicImage presents a changing image (for example a movie), the TwoDSprite that presents that image in the SWCompositor must be invalidated so that it will redraw the Sprites image in the next composit cycle. The Invalidator object is used to perform this function by the SWCompositor if the object itself cannot perform the invalidation. Can return null if the DynamicImage does not require the SWCompositor to invalidate it (or the object is in a state where its image won't change).

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.

Parameters:
c - the Compositor in which the DynamicImage is a member
s - the TwoDSprite that is presenting the DynamicImage's image in the Compositor. This is the sprite that must be invalidated.
Returns:
an Invalidator or null if invalidation is not required
See Also:
SWCompositor
 o removedFromCompositor
 public 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.

Parameters:
c - the SWCompositor it is being removed from
 o addedTo
 public synchronized void addedTo(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. If the object is a kind of java.awt.Component then an offscreen image is created from this Component and this Image is used as the pixel resource for a java.awt.Graphics object that is passed to the attached Paintable object. If not nothing is done.

Parameters:
interest - the object that is to be the source of interest for the the object that implements this interface.
 o removedFrom
 public void removedFrom(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. If the object is a kind of java.awt.Component then the cached java.awt.Image object that was created in the addedTo method is disposed of.

Parameters:
interest - the object that was the source of interest for the the object that implements this interface.
 o addNotifyListener
 public boolean addNotifyListener(NotifyListener nl)
This registers the deferred listener.

Parameters:
dl - the listener that the DeferredListener notifies when its listen source becomes valid

All Packages  Class Hierarchy  This Package  Previous  Next  Index