| Log In | Not a Member? |
Contact ADC
|
|
![]() |
| Previous Section | Table of Contents | Next Section |
Graphics Importer / Exporter ComponentsContentsQuickTime QuickTime's graphics import and export components allow you to work with image data regardless of its file format or compression method. Graphics importer components provide a standard method for applications to open and display still images contained within graphics documents. Graphics importer components allow you to work with any type of supported image data, regardless of the file format or compression used in the file. You can use the graphics importer component functions to obtain a graphics importer component instance that can read graphics data from a particular file or area of memory. For example, GetGraphicsImporterForFile will attempt to locate and open a graphics importer component that can be used to draw the specified file. The component can then be used to find some characteristics of the image such as it's dimensions by using GraphicsImportGetNaturalBounds and can be drawn by simply calling GraphicsImportDraw. Some Quicktime supported file formats, such as TIFF, PNG and Photoshop, support alpha channels; some, such as JPEG and TGA, do not. However, even if a file format supports alpha channels, not every file will contain one. You can use graphics importers to find out whether a file has an alpha channel by calling GraphicsImportGetImageDescription and looking at the depth field in the image description. By convention, a depth of 24 means RGB without alpha, whereas 32 means ARGB. QuickTime will not synthesize an opaque alpha channel for an image that does not have one; if the depth is 24, the first byte of each pixel will probably be zero. Developers working with alpha channels should only depend on these values if the depth is 32.
Graphics Importers also support image formats containing multiple images in a single file. For example, TIFF files can support multiple images, Photoshop files can contain multiple layers and FlashPix files can contain multiple resolutions. You can use GraphicsImportGetImageCount to find out how many images are in a file, and GraphicsImportSetImageIndex to select a particular image. Graphics exporter components provide a standard interface for exporting graphics to image files in a variety of formats. QuickTime selects a graphic exporter component based on the desired output format, such as GIF or PNG. The image input for an export operation can come from a QuickDraw Picture, a GWorld or PixMap, a QuickTime graphics importer component instance, or a segment of compressed data described by a QuickTime image description. In the last case, the compressed data may be accessed via a pointer, handle, file or other data reference. The ouput image for an export operation can be stored in a handle, file, or other data reference. Different file formats support a wide range of configurable features, such as depth, resolution, and compression quality. To use a graphics exporter, you must first open a graphics exporter component instance, specify the source of the input image, its destination, set whatever parameters you want and then actually do the export. For example, if you want to write a GWorld out to a PNG image file you would would use OpenADefaultComponent to open an instance of the kQTFileTypePNG graphics exporter component, GraphicsExportSetInputGWorld to associate the input GWorld with the export operation, GraphicsExportSetOutputFile to associate the output FSSpec with the export operation and GraphicsExportDoExport to perform the export. Once you're finished with component instances you can simply close them using CloseComponent. |
| Previous Section | Table of Contents | Next Section |