next up previous
Next: Visual Effects Up: QuickTime for Java Previous: Image Producing

Using the QTImageDrawer Class

The QTImageDrawer class enables standard Java drawing commands and graphics objects to have their content rendered by QuickTime within a QuickTime graphics space (QDGraphics). Standard AWT paint() calls can be made on the Graphics object supplied to the paint() callQTImageDrawer implements the ImageSpec interface, you can add it to a quicktime.app.display.Compositor object and thus draw into the same display space as QuickTime-generated content. It also implements the QTDrawable interface and can thus also be a client of a QTCanvas. A QTImageDrawer object is used to convert the results of painting into a java.awt.Image object using a java.awt.Graphics object to a format that QuickTime can render.

When the java.awt.Image object is created and painted into (using the QTImageDrawer Paintable object) the QTImageDrawer uses Java's PixelGrabber to grab the raw pixel values that resulted from this painting. It then constructs an ImageDescription object that describes to Quick-Time the format, width, and height of this pixel data, and an ImagePresenter is used internally to render the image using QuickTime imaging services.

If the QTImageDrawer is used to grab the results of a single paint, then it can make optimizations on the amount of memory that it uses. A single frame is indicated by the kSingleFrame flag when constructing it. In this case, your application can grab the resultant image data (getImage()) and its description (getDescription()) and then discard the QTImageDrawer object completely. This is preferable in many situations where both performance and memory usage are a consideration:

The paint() method of the QTImageDrawer Paintable object returns an array of rectangles that tells the drawer which areas of its drawing area were drawn. This optimizes the amount of copying and can greatly increase performance when composited.


next up previous
Next: Visual Effects Up: QuickTime for Java Previous: Image Producing
Dave Marshall
10/4/2001