### QPx_NewImporterForFile

QPx_NewImporterForFile(importerRef; imagePath):error
| importerRef | Longint | Reference to a new graphics importer
| imagePath | Text | Full path name to the image file
| error | Longint | Error result

Creates a graphics importer instance for the image stored in the specified file and returns a reference to this importer instance. This reference is used with all QPix commands in this group to refer to the graphics importer instance and its associated data.

The reference to the importer instance is returned in the importerRef parameter. QPix calls QuickTime to identify the image and create an instance of the proper graphics importer. QuickTime iterates over all available importers, checking the importer type and flags, until it finds an importer that can handle the specified graphics file. If the specified file format is not supported by any importer, importerRef is set to 0 and the qpx_paramErr error code is returned.

If imagePath is empty, QPix presents a file selection dialog where the user can preview and select an image file. If the user selects a file, the full pathname is returned in imagePath, otherwise error qpx_userCancelErr is returned.

Note: After you have finished working with an importer instance, you should destroy it by calling QPx_FreeImporter.

Example

``Create an importer for an image file` `` `C_LONGINT($error)` `C_TEXT($imagePath)` `C_LONGINT(gQPixImporter)` `` `$imagePath:="Hard disk:images:croc.psd"` `` `$error:=QPx_NewImporterForFile (gQPixImporter;$imagePath)` `` `If ($error=qpx_noErr)` ``Importer created successfully` `End if`

Related commands

QPx_SetImporterFile | Assigns an image file to a graphics importer
QPx_GetImporterFile | Returns the pathname of the file associated with a graphics importer

QPix © Escape
Generated by QDoc 2.8 on Wed, Feb 17, 2010 17:44:40