quicktime.std.image
Class GraphicsImporter

java.lang.Object
  |
  +--quicktime.QTObject
        |
        +--quicktime.std.comp.ComponentIdentifier
              |
              +--quicktime.std.comp.Component
                    |
                    +--quicktime.std.image.GraphicsImporter
All Implemented Interfaces:
quicktime.jdirect.InterfaceLib, quicktime.jdirect.PrimitivesLib, quicktime.jdirect.QuickTimeLib, quicktime.jdirect.SharedLibrary, com.apple.jdirect.SharedLibrary

public final class GraphicsImporter
extends Component
implements quicktime.jdirect.QuickTimeLib

Assists in managing still images. Allows display and manipulation of various types of image data. This is regardless of file format or compression used in the document. The QIF(QuickTime File Format, 'qtif') accepts gif, jfif, pict, photoshop, and sgi.rgb files. This class implements methods for a corresponding QuickTime ComponentInstance structure. refer to GraphicsImportComponent in QuickTime


Fields inherited from interface quicktime.jdirect.QuickTimeLib
JDirect_MacOSX, libraryInstance, name
 
Constructor Summary
GraphicsImporter(DataRef dataRef)
          Determines and opens the component to use for the given data reference and data type.
GraphicsImporter(DataRef dataRef, int flags)
          Locates and opens a graphics importer component that can be used to draw the specified dataRef.
GraphicsImporter(int subType)
          Opens the specified graphics import component,'grip', with the given subType.
GraphicsImporter(QTFile file)
          Determines and opens the graphics import component to use for the given file.
GraphicsImporter(QTFile file, int flags)
          Determines and opens the graphics import component to use for the given file.
 
Method Summary
 int doesDrawAllPixels()
          Determines if the GraphicsImporter will draw all the pixels that are contained in the image data that it is presenting.
 GraphicsImporterInfo doExportImageFileDialog(QTFile inDefaultSpec, java.lang.String prompt)
          Presents a dialog box letting the user save an image in a foreign file format.
 void draw()
          Draws an image.
 void exportImageFile(int fileType, int fileCreator, QTFile theFile, int scriptTag)
          Saves an image in a foreign file format.
static GraphicsImporter fromGraphicsExporter(GraphicsExporter ge)
          Determines the GraphicsImporter that is the source for input images to graphics export component

QuickTime::GraphicsExportGetInputGraphicsImporter

 QTHandle getAliasedDataReference()
          Determines the aliased data reference.
 int getAliasedDataType()
          Determines the aliased data type.
 Pict getAsPicture()
          Creates a new Pict containing the image currently in use by this import component.
 QDRect getBoundsRect()
          Determines the bounding rectangle for drawing.
 Region getClip()
          Determines the current clipping region.
 QTFile getDataFile()
          Determines the file that the graphics resides in.
 QTHandle getDataHandle()
          Determines the data reference that the graphics resides in.
 int getDataOffset()
          Determines the data offset.
 int[] getDataReferenceOffsetAndLimit()
          Returns the data reference starting offset and data size limit.
 int getDataReferenceType()
          Determines the type of the data reference that the graphics resides in.
 int getDataSize()
          Determines the data size.
 Region getDefaultClip()
          Returns the default matrix.
 GraphicsMode getDefaultGraphicsMode()
          Returns the default graphics mode, if one is stored in the image.
 Matrix getDefaultMatrix()
          Returns the default matrix.
 QDRect getDefaultSourceRect()
          Returns the default source rect, if one is stored in the image.
 QDRect getDestRect()
          Returns the destination rectangle.
 AtomContainer getExportImageTypeList()
          Returns information about available export formats.
 AtomContainer getExportSettingsAsAtomContainer()
          Returns the Export settings as an Atom Container.
 int getFlags()
          Returns the current flags..
 GraphicsMode getGraphicsMode()
          Determines the graphics mode for an image.
 QDGraphics getGWorld()
          Call this method to obtain the QDGraphics of the object.
 int getImageCount()
          Returns the number of images in the image file.
 ImageDescription getImageDescription()
          Determines the image description information.
 int getImageIndex()
          Returns the current image index.
 Matrix getMatrix()
          Determines the matrix to be used for drawing.
 UserData getMetaData(GraphicsImporter gi)
          Gets metadata from an image file and adds it to a user data structure.
 AtomContainer getMIMETypeList()
          Returns a list of MIME types supported by the graphics import component.
 QDRect getNaturalBounds()
          Determines the bounding rectangle of an image.
 int getQuality()
          Determines the image quality value.
 QDRect getSourceRect()
          Determines the current source rectangle for an image.
 void readData(EncodedImage data, int dataOffset, int dataSize)
          Reads image data.
 void saveAsPicture(QTFile file, int scriptTag)
          Creates a QuickDraw picture file.
 void saveAsQuickTimeImageFile(QTFile file, int scriptTag)
          Creates a QuickDraw image file.
 void setBoundsRect(QDRect bounds)
          Defines the rectangle in which to draw an image.
 void setClip(Region clipRgn)
          Defines the clipping region for drawing.
 void setDataFile(QTFile fileIn)
          Specifies the file that the graphics resides in.
 void setDataHandle(QTHandleRef dataRef)
          Specifies the data handle that the graphics resides in.
 void setDataReference(DataRef dataRef)
          Specifies the data reference that the graphics resides in.
 void setDataReferenceOffsetAndLimit(int offset, int limit)
          Specifies the data reference starting offset and data size limit.
 void setDestRect(QDRect destRect)
          Sets the destination rectangle.
 void setExportSettingsFromAtomContainer(AtomContainer qtAtomContainer)
          Export settings from a QuickTime atom container.
 void setFlags(int flags)
          Sets the current flags.
 void setGraphicsMode(GraphicsMode graphicsMode)
          Sets the graphics mode and color for an image.
 void setGWorld(QDGraphics port, GDevice gdh)
          Call this method to give the client the QDGraphics object it should use to do its drawing.
 void setImageIndex(int imageIndex)
          The default image index is 1.
 void setMatrix(Matrix matrix)
          Defines the matrix to use for drawing.
 void setQuality(int quality)
          Sets the image quality value.
 void setSourceRect(QDRect srcRect)
          Sets the source rectangle to use for an image.
 boolean validate()
          Determines if the current graphics importer data reference contains valid image data.
 
Methods inherited from class quicktime.std.comp.Component
count
 
Methods inherited from class quicktime.std.comp.ComponentIdentifier
find, find, getInfo, toString
 
Methods inherited from class quicktime.QTObject
disposeQTObject, equals, ID
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphicsImporter

public GraphicsImporter(int subType)
                 throws QTException
Opens the specified graphics import component,'grip', with the given subType.

QuickTime::OpenADefaultComponent

Parameters:
subType - The graphics import component sub type

GraphicsImporter

public GraphicsImporter(QTFile file)
                 throws QTException
Determines and opens the graphics import component to use for the given file.

QuickTime::GetGraphicsImporterForFile QuickTime::GetGraphicsImporterForFile

Parameters:
file - Specifies the source file.

GraphicsImporter

public GraphicsImporter(QTFile file,
                        int flags)
                 throws QTException
Determines and opens the graphics import component to use for the given file.

QuickTime::GetGraphicsImporterForFile QuickTime::GetGraphicsImporterForFile

Parameters:
file - Specifies the source file.
flags - options passed in when opening the component

GraphicsImporter

public GraphicsImporter(DataRef dataRef)
                 throws QTException
Determines and opens the component to use for the given data reference and data type.

QuickTime::GetGraphicsImporterForDataRef QuickTime::GetGraphicsImporterForDataRef

Parameters:
dataRef - Specifies the data reference.

GraphicsImporter

public GraphicsImporter(DataRef dataRef,
                        int flags)
                 throws QTException
Locates and opens a graphics importer component that can be used to draw the specified dataRef.

QuickTime::GetGraphicsImporterForDataRefWithFlags

Parameters:
dataRef - Specifies the data reference.
flags - options passed in when opening the component
Method Detail

fromGraphicsExporter

public static final GraphicsImporter fromGraphicsExporter(GraphicsExporter ge)
                                                   throws QTException
Determines the GraphicsImporter that is the source for input images to graphics export component

QuickTime::GraphicsExportGetInputGraphicsImporter

Returns:
a GraphicsImporter object that has the source of input images to the Graphics exporter.

setDataReference

public final void setDataReference(DataRef dataRef)
                            throws StdQTException
Specifies the data reference that the graphics resides in.

QuickTime::GraphicsImportSetDataReference

Parameters:
dataRef - Specifies the handle to a QuickTime data reference.

getDataReferenceType

public final int getDataReferenceType()
                               throws StdQTException
Determines the type of the data reference that the graphics resides in.

QuickTime::GraphicsImportGetDataReference

Returns:
The data reference type.

setDataFile

public final void setDataFile(QTFile fileIn)
                       throws QTException
Specifies the file that the graphics resides in.

QuickTime::GraphicsImportSetDataFile

Parameters:
fileIn - Specifies the source file containing the graphics data.

getDataFile

public final QTFile getDataFile()
                         throws QTException
Determines the file that the graphics resides in.

QuickTime::GraphicsImportGetDataFile

Returns:
The file that contains the graphics data.

setDataHandle

public final void setDataHandle(QTHandleRef dataRef)
                         throws StdQTException
Specifies the data handle that the graphics resides in.

QuickTime::GraphicsImportSetDataHandle

Parameters:
dataRef - Specifies the handle to a QuickTime data reference.

getDataHandle

public final QTHandle getDataHandle()
                             throws QTException
Determines the data reference that the graphics resides in.

QuickTime::GraphicsImportGetDataHandle

Returns:
The handle to a QuickTime data reference.

getImageDescription

public final ImageDescription getImageDescription()
                                           throws StdQTException
Determines the image description information.

QuickTime::GraphicsImportGetImageDescription


getDataOffset

public final int getDataOffset()
                        throws StdQTException
Determines the data offset.

QuickTime::GraphicsImportGetDataOffsetAndSize

Returns:
The offset for the data.

getDataSize

public final int getDataSize()
                      throws StdQTException
Determines the data size.

QuickTime::GraphicsImportGetDataOffsetAndSize

Returns:
The size of the data.

readData

public final void readData(EncodedImage data,
                           int dataOffset,
                           int dataSize)
                    throws StdQTException
Reads image data. The pointer must be at least offset + size big.

QuickTime::GraphicsImportReadData

Parameters:
data - The EncodedImage that the data is read into.
dataOffset - Specifies the offset within the pointer where the data is placed. This offset is in bytes.
dataSize - Specifies the size of the data to be read.

setClip

public final void setClip(Region clipRgn)
                   throws StdQTException
Defines the clipping region for drawing.

QuickTime::GraphicsImportSetClip

Parameters:
clipRgn - Specifies clipping region.

getClip

public final Region getClip()
                     throws QTException
Determines the current clipping region.

QuickTime::GraphicsImportGetClip

Returns:
The current clip region or null, if not possible

setSourceRect

public final void setSourceRect(QDRect srcRect)
                         throws StdQTException
Sets the source rectangle to use for an image.

QuickTime::GraphicsImportSetSourceRect

Parameters:
sourceRect - Specifies source rectangle

getSourceRect

public final QDRect getSourceRect()
                           throws StdQTException
Determines the current source rectangle for an image.

QuickTime::GraphicsImportGetSourceRect

Returns:
The current source rectangle for an image.

getNaturalBounds

public final QDRect getNaturalBounds()
                              throws StdQTException
Determines the bounding rectangle of an image.

QuickTime::GraphicsImportGetNaturalBounds

Returns:
The size of the bounding rectangle for an image.

draw

public final void draw()
                throws StdQTException
Draws an image.

QuickTime::GraphicsImportDraw


setMatrix

public final void setMatrix(Matrix matrix)
                     throws StdQTException
Defines the matrix to use for drawing.

QuickTime::GraphicsImportSetMatrix

Parameters:
matrix - Specifies the drawing matrix.

getMatrix

public final Matrix getMatrix()
                       throws StdQTException
Determines the matrix to be used for drawing.

QuickTime::GraphicsImportGetMatrix

Returns:
The matrix specification to use for drawing.

setBoundsRect

public final void setBoundsRect(QDRect bounds)
                         throws StdQTException
Defines the rectangle in which to draw an image.

QuickTime::GraphicsImportSetBoundsRect

Parameters:
bounds - Specifies the bounding rectangle.

getBoundsRect

public final QDRect getBoundsRect()
                           throws StdQTException
Determines the bounding rectangle for drawing.

QuickTime::GraphicsImportGetBoundsRect

Returns:
The bounding rectangle.

saveAsPicture

public final void saveAsPicture(QTFile file,
                                int scriptTag)
                         throws QTException
Creates a QuickDraw picture file.

QuickTime::GraphicsImportSaveAsPicture

Parameters:
file - The destination output file of the compressed image
scriptTag - Specifies the depth at which the image is to be compressed.

saveAsQuickTimeImageFile

public final void saveAsQuickTimeImageFile(QTFile file,
                                           int scriptTag)
                                    throws QTException
Creates a QuickDraw image file.

QuickTime::GraphicsImportSaveAsQuickTimeImageFile

Parameters:
fss - Specifies the destination file.
scriptTag - Specifies

setGraphicsMode

public final void setGraphicsMode(GraphicsMode graphicsMode)
                           throws StdQTException
Sets the graphics mode and color for an image.

QuickTime::GraphicsImportSetGraphicsMode

Parameters:
graphicsMode - Specifies the graphics transfer mode.

getGraphicsMode

public final GraphicsMode getGraphicsMode()
                                   throws StdQTException
Determines the graphics mode for an image.

QuickTime::GraphicsImportGetGraphicsMode

Returns:
The graphics transfer mode.

setQuality

public final void setQuality(int quality)
                      throws StdQTException
Sets the image quality value.

QuickTime::GraphicsImportSetQuality

Parameters:
quality - Specifies a quality CodecQ value

getQuality

public final int getQuality()
                     throws StdQTException
Determines the image quality value.

QuickTime::GraphicsImportGetQuality

Returns:
The image quality value.

getAliasedDataReference

public final QTHandle getAliasedDataReference()
                                       throws QTException
Determines the aliased data reference.

QuickTime::GraphicsImportGetAliasedDataReference

Returns:
The handle to the aliased data reference

getAliasedDataType

public final int getAliasedDataType()
                             throws StdQTException
Determines the aliased data type.

QuickTime::GraphicsImportGetAliasedDataReference

Returns:
The aliased data type

setGWorld

public final void setGWorld(QDGraphics port,
                            GDevice gdh)
                     throws StdQTException
Call this method to give the client the QDGraphics object it should use to do its drawing.

QuickTime::GraphicsImportSetGWorld

Parameters:
port - a QDGraphics object or null to use current port
gdh - a GDevice object or null to use current device

getGWorld

public final QDGraphics getGWorld()
                           throws StdQTException
Call this method to obtain the QDGraphics of the object.

QuickTime::GraphicsImportGetGWorld

Returns:
The current destination graphics port

validate

public final boolean validate()
                       throws StdQTException
Determines if the current graphics importer data reference contains valid image data. Not all graphics importers implement this method.

QuickTime::GraphicsImportValidate

Returns:
True if a valid operation, false otherwise.

doesDrawAllPixels

public final int doesDrawAllPixels()
                            throws StdQTException
Determines if the GraphicsImporter will draw all the pixels that are contained in the image data that it is presenting. Some image formats (for example GIF) allow a color to be set as invisible or transparent.

QuickTime::GraphicsImportDoesDrawAllPixels

Returns:
a value that indicates if this instance of the importer will draw all pixels

getAsPicture

public Pict getAsPicture()
                  throws QTException
Creates a new Pict containing the image currently in use by this import component.

QuickTime::GraphicsImportGetAsPicture

Returns:
a pict

getMetaData

public UserData getMetaData(GraphicsImporter gi)
                     throws QTException
Gets metadata from an image file and adds it to a user data structure.

QuickTime::GraphicsImportGetMetaData

Returns:
a UserData structure

getMIMETypeList

public AtomContainer getMIMETypeList()
                              throws StdQTException
Returns a list of MIME types supported by the graphics import component.

QuickTime::GraphicsImportGetMIMETypeList

Returns:
a QT atom container that contains a list of MIME types supported by the graphics import component.

exportImageFile

public void exportImageFile(int fileType,
                            int fileCreator,
                            QTFile theFile,
                            int scriptTag)
                     throws QTException
Saves an image in a foreign file format.

QuickTime::GraphicsImportExportImageFile

Parameters:
fileType - the file type
fileCreator - the fie creator
theFile - the output file to write to.

getExportImageTypeList

public final AtomContainer getExportImageTypeList()
                                           throws StdQTException
Returns information about available export formats.

QuickTime::GraphicsImportGetExportImageTypeList

Returns:
a QT atom container that contains a list of available export formats. supported by the graphics import component.

getExportSettingsAsAtomContainer

public final AtomContainer getExportSettingsAsAtomContainer()
                                                     throws StdQTException
Returns the Export settings as an Atom Container.

QuickTime::GraphicsImportGetExportSettingsAsAtomContainer

Returns:
a QT atom container that contains Export settings.

setExportSettingsFromAtomContainer

public final void setExportSettingsFromAtomContainer(AtomContainer qtAtomContainer)
                                              throws StdQTException
Export settings from a QuickTime atom container. These settings configure how images will be saved by the GraphicsImportExportImageFile function..

QuickTime::GraphicsImportSetExportSettingsFromAtomContainer

Parameters:
qtAtomContainer - the atomcontainer with the export settings.

doExportImageFileDialog

public final GraphicsImporterInfo doExportImageFileDialog(QTFile inDefaultSpec,
                                                          java.lang.String prompt)
                                                   throws QTException
Presents a dialog box letting the user save an image in a foreign file format.

QuickTime::GraphicsImportDoExportImageFileDialog

Parameters:
inDefaultSpec - suggests the default name for the file. If you do not want to suggest a default name, pass null.
prompt - A prompt that appears in the standard put dialog box; it may be nil, in which case a default string is used.

setDataReferenceOffsetAndLimit

public final void setDataReferenceOffsetAndLimit(int offset,
                                                 int limit)
                                          throws StdQTException
Specifies the data reference starting offset and data size limit.

QuickTime::GraphicsImportSetDataReferenceOffsetAndLimit

Parameters:
offset - The byte offset of the image data from the beginning of the data reference.
limit - the offset of the byte following the last byte of the image data.

getDataReferenceOffsetAndLimit

public final int[] getDataReferenceOffsetAndLimit()
                                           throws StdQTException
Returns the data reference starting offset and data size limit.

QuickTime::GraphicsImportGetDataReferenceOffsetAndLimit

Returns:
an array of length 2 with 1st element as the offset and 2nd element as the limit.

getImageCount

public final int getImageCount()
                        throws StdQTException
Returns the number of images in the image file. The base graphics importer returns a count of 1. Format-specific importers for multiple-image formats should override this function; other importers should delegate it.

QuickTime::GraphicsImportGetImageCount

Returns:
the number of images.

setImageIndex

public final void setImageIndex(int imageIndex)
                         throws StdQTException
The default image index is 1. Image indexes are one-based; zero is considered a special index by some importers, and treated the same as one by others.

QuickTime::GraphicsImportSetImageIndex

Parameters:
imageIndex - Specifies the image index.

getImageIndex

public final int getImageIndex()
                        throws StdQTException
Returns the current image index.

QuickTime::GraphicsImportGetImageIndex

Returns:
the image index.

getDefaultMatrix

public final Matrix getDefaultMatrix()
                              throws StdQTException
Returns the default matrix.

QuickTime::GraphicsImportGetDefaultMatrix

Returns:
the default matrix

getDefaultClip

public final Region getDefaultClip()
                            throws QTException
Returns the default matrix.

QuickTime::GraphicsImportGetDefaultClip

Returns:
the default matrix

getDefaultGraphicsMode

public final GraphicsMode getDefaultGraphicsMode()
                                          throws QTException
Returns the default graphics mode, if one is stored in the image. If this method returns badComponentSelector , you should assume a mode of ditherCopy .

QuickTime::GraphicsImportGetDefaultGraphicsMode

Returns:
the default mode

getDefaultSourceRect

public final QDRect getDefaultSourceRect()
                                  throws QTException
Returns the default source rect, if one is stored in the image. If this function returns badComponentSelector , you should assume a source rect equal to the natural bounds.

QuickTime::GraphicsImportGetDefaultSourceRect

Returns:
the default Rect

setDestRect

public final void setDestRect(QDRect destRect)
                       throws QTException
Sets the destination rectangle. You can use this function to define the rectangle into which the extracted source rectangle should be drawn.

QuickTime::GraphicsImportSetDestRect

Parameters:
the - dest Rect

getDestRect

public final QDRect getDestRect()
                         throws QTException
Returns the destination rectangle.

QuickTime::GraphicsImportGetDestRect

Returns:
the destination rectangle.

setFlags

public final void setFlags(int flags)
                    throws QTException
Sets the current flags.

QuickTime::GraphicsImportSetFlags

Parameters:
flags - the flag

getFlags

public final int getFlags()
                   throws QTException
Returns the current flags..

QuickTime::GraphicsImportGetFlags

Returns:
Returns the current flags.