CDTrimImage
Your component receives the CDTrimImage request whenever an application calls the TrimImage function. Your component adjusts a compressed image to the boundaries defined by a rectangle specified by your application. The resulting image data is still compressed and is in the same compression format as the source image.
- Note
- The
CDTrimImage function is optional. If your component doesn't support it, it should return the codecUnimpError result code.
pascal ComponentResult CDTrimImage
(ImageDescriptionHandle desc, Ptr inData,
long inBufferSize, DataProcRecordPtr dataProc,
Ptr outData, long outBufferSize,
FlushProcRecordPtr flushProc, Rect *trimRect,
ProgressProcRecordPtr progressProc);
desc
- Contains a handle to the image description structure that describes the compressed image. Your component updates this image description to refer to the resized image.
inData
- Points to the compressed image data. If the entire compressed image cannot be stored at this location, the application may provide a data-loading function (see the description of the
dataProc parameter to this function for details). This is a 32-bit clean address.
inBufferSize
- Specifies the size of the buffer to be used by the data-loading
function specified by the dataProc parameter. If the application did not specify a data-loading function, this parameter is nil.
dataProc
- Points to a data-loading function structure. If the data stream is not all in memory when the application calls the Image Compression Manager's
GetCompressedImageSize function, your component may call an application function that loads more compressed data (see the chapter "Image Compression Manager" in Inside Macintosh: QuickTime for more information about data-loading functions). This parameter contains a pointer to a structure that identifies the data-loading function. If the application did not provide a data-loading function, this parameter is nil. In this case, the entire image must be in memory at the location specified by the inData parameter.
outData
- Points to a buffer to receive the trimmed image. If there is not sufficient memory to store the compressed image, the application may choose to write the compressed data to mass storage during the compression operation. The
flushProc parameter identifies the data-unloading function. This is a 32-bit clean address.
-
- Your component should place the actual size of the resulting image into the
dataSize field of the image description referred to by the desc parameter.
outBufferSize
- Specifies the size of the buffer to be used by the data-unloading
function specified by the flushProc parameter. If the application did not specify a data-unloading function, this parameter is nil.
flushProc
- Points to a data-unloading function structure. If there is not enough memory to store the compressed image, your component may call an application function that unloads some of the compressed data (see the chapter "Image Compression Manager" in Inside Macintosh: QuickTime for more information about data-unloading functions). This parameter contains a pointer to a structure that identifies that data-unloading function. If the application did not provide a data-unloading function, this parameter is
nil. In this case, your component writes the entire compressed image into the memory location specified by the outData parameter.
trimRect
- Contains a pointer to a rectangle that defines the desired image dimensions. Your component adjusts the rectangle values so that they refer to the same rectangle in the resulting image (this is necessary whenever data is removed from the beginning of the image).
progressProc
- Points to a progress function structure. During the operation, your component should occasionally call an application function to report its progress (see the chapter "Image Compression Manager" in Inside Macintosh: QuickTime for more information about progress functions). This parameter contains a pointer to a structure that identifies that progress function. If the application did not provide a progress function, this parameter is
nil.
DESCRIPTION
Only decompressors receive this request. If the TrimImage function has been called by an application, the resulting picture should be modified.
RESULT CODES
| noErr | 0 | No error |
| paramErr | -50 | Invalid parameter specified |
| memFullErr | -108 | Not enough memory available |
| noCodecErr | -8961 | Image Compression Manager could not find the specified compressor |
| codecUnimpErr | -8962 | Feature not implemented by this compressor |
| codecSpoolErr | -8966 | Error loading or unloading data |
| codecAbortErr | -8967 | Operation aborted by the progress function |