ADC Home > Reference Library > Technical Q&As > QuickTime > Import & Export >

Graphics Importers and image files containing multiple layers


Q: I'm using Graphics Importers to display multiple layer Photoshop files. The layers in these files have smaller bounds then that of the entire image, but if I switch the layer then draw, the result is the layer being drawn at the full size of the entire image. How can I use the Graphics Importer APIs to get the bounds of each layer in the file then draw the individual layer at the correct size and position?

A: After you call GraphicsImportSetImageIndex to switch to layer index (n), call GraphicsImportGetNaturalBounds which will return the natural bounds of the currently selected layer.

Therefore, you can use GraphicsImportGetNaturalBounds to find out the width and height of the layer (the natural bounds returned from GraphicsImportGetNaturalBounds always has a top-left of (0, 0)), then use GraphicsImportGetDefaultMatrix to find out where it should be positioned.

References:

Graphics Importer Components


[Jun 18 2002]