next up previous
Next: The QTFactory Class Up: The QTDrawable Interface Previous: The QTDrawable Interface

Working with the QTDrawable interface

As we've seen, the QTDrawable interface is used to handle the negotiation between the QTCanvas and one of several QuickTime objects. The QuickTime objects that implement the QTDrawable interface are extensive and include the following:

The QTDrawable interface is designed to work hand-in-hand with a QTCanvas object. The class that implements this interface draws into the supplied QDGraphics object. The QTCanvas will call the methods of its client (setting its destination QDGraphics, setting display bounds, and redrawing it) as required.

These methods are used by the QTCanvas to notify the client object that it has been added to or removed from the QTCanvas. Various clients require this notification:

The QTDrawable interface also extends the Transformable interface.

The Transformable interface expresses the ability of QuickTime drawers to have a matrix applied that will map the source pixels of a drawing object to some transformed destination appearance. A matrix allows the following transformations to be applied in the rendering process:

Your application can freely mix and match these different transformations at its own discretion.

All QTDrawable objects can have a matrix applied to them that will transform their visual appearance. A Sprite in a SpriteWorld can also have matrix transformations applied to it, as can a 3D model. The TwoDSprite also implements the Transformable interface.

The Transformable interface allows for applications to define behaviors that can be applied to any of these objects. For example, the
quicktime.app.actions.Dragger, which will position objects in response to a mouseDragged event, is defined totally in terms of the Transformable interface. Thus, the Dragger can reposition any TwoDSprite in a SWCompositor or any QTDrawable in a GroupDrawable. Using interfaces to express common functionality is a powerful concept and is relied upon extensively in the QuickTime for Java Application Framework.


next up previous
Next: The QTFactory Class Up: The QTDrawable Interface Previous: The QTDrawable Interface
Dave Marshall
10/4/2001