QPx_NewImporterForFile
QPx_NewImporterForFile(importerRef; importerRef):error | |||
---|---|---|---|
![]() |
importerRef | Longint | Reference to a new graphics importer |
![]() |
imagePath | Text | Full path name to the image file |
![]() |
error | Longint | Error result |
Create a graphics importer instance for the image stored in a file
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.
This reference can be used with all QPix commands in this group to refer to the graphics importer instance and its associated data.
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 When done working with an importer instance, you must destroy it by calling QPx_FreeImporter (unless you have assigned the importer to a QPix area, in which case its destruction will be handled by the area).
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 | Assign an image file to a graphics importer |
QPx_GetImporterFile | Get the path of the file associated with a graphics importer |
QPx_FreeImporter | Destroy an existing importer instance |
QPx_SetAreaImporter | Assign a graphics importer instance to a QPix area |