Image pixel cache (working pixels).
Contents
PixelPacket *AccessCacheViewPixels( const ViewInfo *view );
Method AccessCacheViewPixels returns writeable pixels associated with the specified view.
The format of the AccessCacheViewPixels method is:
PixelPacket *AccessCacheViewPixels( const ViewInfo *view );
A description of each parameter follows:
Method AccessCacheViewPixels returns the pixels associated with the specified view.
The address of a structure of type ViewInfo.
const IndexPacket *AccessImmutableIndexes( const Image *image );
AccessImmutableIndexes() returns the colormap indexes associated with the last call to AcquireImagePixels(). NULL is returned if colormap indexes are not available.
The format of the AccessImmutableIndexes() method is:
const IndexPacket *AccessImmutableIndexes( const Image *image );
A description of each parameter follows:
The indexes associated with the last call to AcquireImagePixels().
The image.
IndexPacket *AccessMutableIndexes( Image *image );
AccessMutableIndexes() returns the colormap indexes associated with the last call to SetImagePixels() or GetImagePixels(). NULL is returned if colormap indexes are not available.
The format of the AccessMutagleIndexes() method is:
IndexPacket *AccessMutableIndexes( Image *image );
A description of each parameter follows:
The indexes associated with the last call to AcquireImagePixels().
The image.
PixelPacket *AccessMutablePixels( Image image );
AccessMutablePixels() returns the pixels associated with the last call to SetImagePixels() or GetImagePixels(). This is useful in order to access an already selected region without passing the geometry of the region.
The format of the AccessMutablePixels() method is:
PixelPacket *AccessMutablePixels( Image image );
A description of each parameter follows:
The pixels associated with the last call to SetImagePixels() or GetImagePixels().
The image.
const PixelPacket *AcquireCacheViewPixels( ViewInfo *view, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
Method AcquireCacheViewPixels gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters for read-only access. A pointer to the pixels is returned if the pixels are transferred, otherwise NULL is returned.
The format of the AcquireCacheViewPixels method is:
const PixelPacket *AcquireCacheViewPixels( ViewInfo *view, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
Method AcquireCacheViewPixels returns a null pointer if an error occurs, otherwise a pointer to the view pixels.
The address of a structure of type ViewInfo.
These values define the perimeter of a region of pixels.
Return any errors or warnings in this structure.
const IndexPacket *AcquireCacheViewIndexes( const ViewInfo *view );
Method AcquireCacheViewIndexes returns read-only indexes associated with the specified view.
The format of the AcquireCacheViewIndexes method is:
const IndexPacket *AcquireCacheViewIndexes( const ViewInfo *view );
A description of each parameter follows:
Method AcquireCacheViewIndexes returns the indexes associated with the specified view.
The address of a structure of type ViewInfo.
const PixelPacket *AcquireImagePixels( const Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
AcquireImagePixels() obtains a pixel region for read-only access. If the region is successfully accessed, a pointer to it is returned, otherwise NULL is returned. The returned pointer may point to a temporary working copy of the pixels or it may point to the original pixels in memory. Performance is maximized if the selected area is part of one row, or one or more full rows, since then there is opportunity to access the pixels in-place (without a copy) if the image is in RAM, or in a memory-mapped file. The returned pointer should never be deallocated by the user.
Pixels accessed via the returned pointer represent a simple array of type PixelPacket. If the image storage class is PsudeoClass, call GetIndexes() after invoking GetImagePixels() to obtain the colormap indexes (of type IndexPacket) corresponding to the region.
If you plan to modify the pixels, use GetImagePixels() instead.
The format of the AcquireImagePixels() method is:
const PixelPacket *AcquireImagePixels( const Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
AcquireImagePixels() returns a pointer to the pixels if they are transferred, otherwise a NULL is returned.
The image.
These values define the perimeter of a region of pixels.
Return any errors or warnings in this structure.
MagickPassFail AcquireOneCacheViewPixel( const ViewInfo *view, PixelPacket *pixel, const long x, const long y, ExceptionInfo *exception );
Method AcquireOneCacheViewPixel gets one pixel from the in-memory or disk pixel cache as defined by the geometry parameters for read-only access. The image background color is returned if there is an error retrieving the pixel.
The format of the AcquireOneCacheViewPixel method is:
MagickPassFail AcquireOneCacheViewPixel( const ViewInfo *view, PixelPacket *pixel, const long x, const long y, ExceptionInfo *exception );
The address of a structure of type ViewInfo.
Pointer to PixelPacket to update.
Coordinate of pixel to retrieve
Return any errors or warnings in this structure.
PixelPacket AcquireOnePixel( const Image image, const long x, const long y, ExceptionInfo exception );
AcquireOnePixel() returns a single pixel at the specified (x,y) location. The image background color is returned if an error occurs. If errors are to be returned to the image, use GetOnePixel() instead. This function is convenient but performance will be poor if it is used too often.
The format of the AcquireOnePixel() method is:
PixelPacket AcquireOnePixel( const Image image, const long x, const long y, ExceptionInfo exception );
AcquireOnePixel() returns a pixel at the specified (x,y) location.
The image.
These values define the location of the pixel to return.
Return any errors or warnings in this structure.
MagickPassFail AcquireOnePixelByReference( const Image *image, PixelPacket *pixel, const long x, const long y, ExceptionInfo *exception );
AcquireOnePixelByReference() returns a single pixel at the specified (x,y) location. The image background color is returned if an error occurs. This function is convenient but performance will be poor if it is used too often.
The format of the AcquireOnePixelByReference() method is:
MagickPassFail AcquireOnePixelByReference( const Image *image, PixelPacket *pixel, const long x, const long y, ExceptionInfo *exception );
AcquireOnePixel() returns a pixel at the specified (x,y) location.
The image.
A reference to the pixel to update.
These values define the location of the pixel to return.
Return any errors or warnings in this structure.
MagickPassFail CheckImagePixelLimits( const Image *image, ExceptionInfo *exception );
CheckImagePixelLimits() verifies that image dimensions are within current limits. Returns MagickPass if image dimensions are within limits, or MagickFail (and updates exception) if dimensions exceed a limit.
While this function is used within the pixel cache to prevent allocating an image which exceeds the limits, it may also be used to validate image dimensions obtained from file headers prior to allocating memory or doing further processing of the image. Such additional limits should be after any 'ping' mode processing so that the image dimensions can still be shown by 'identify'.
The format of the CheckImagePixelLimits() method is:
MagickPassFail CheckImagePixelLimits( const Image *image, ExceptionInfo *exception );
Image to verify rows/columns.
Throw exception into this ExceptionInfo structure.
void DestroyCacheInfo( Cache cache );
DestroyCacheInfo() deallocates memory associated with the pixel cache.
The format of the DestroyCacheInfo() method is:
void DestroyCacheInfo( Cache cache );
A description of each parameter follows:
Specifies a pointer to a Cache structure.
void DestroyImagePixels( Image *image );
DestroyImagePixels() deallocates memory associated with the pixel cache.
The format of the DestroyImagePixels() method is:
void DestroyImagePixels( Image *image );
A description of each parameter follows:
The image.
PixelPacket *GetCacheViewPixels( ViewInfo *view, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
GetCacheViewPixels() gets writeable pixels from the in-memory or disk pixel cache as defined by the geometry parameters. A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.
The format of the GetCacheViewPixels method is:
PixelPacket *GetCacheViewPixels( ViewInfo *view, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
Method GetCacheViewPixels returns a null pointer if an error occurs, otherwise a pointer to the view pixels.
The address of a structure of type ViewInfo.
These values define the perimeter of a region of pixels.
Any errors are reported here.
Method GetCacheViewImage returns the image which allocated the view.
The format of the GetCacheViewImage method is:
Image *GetCacheViewImage( const ViewInfo *view );
A description of each parameter follows:
Method GetCacheViewImage returns the image which allocated the view.
The address of a structure of type ViewInfo.
IndexPacket *GetCacheViewIndexes( const ViewInfo *view );
Method GetCacheViewIndexes returns writeable indexes associated with the specified view.
The format of the GetCacheViewIndexes method is:
IndexPacket *GetCacheViewIndexes( const ViewInfo *view );
A description of each parameter follows:
Method GetCacheViewIndexes returns the indexes associated with the specified view.
The address of a structure of type ViewInfo.
PixelPacket *GetImagePixels( Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows );
GetImagePixels() obtains a pixel region for read/write access. If the region is successfully accessed, a pointer to a PixelPacket array representing the region is returned, otherwise NULL is returned.
The returned pointer may point to a temporary working copy of the pixels or it may point to the original pixels in memory. Performance is maximized if the selected area is part of one row, or one or more full rows, since then there is opportunity to access the pixels in-place (without a copy) if the image is in RAM, or in a memory-mapped file. The returned pointer should never be deallocated by the user.
Pixels accessed via the returned pointer represent a simple array of type PixelPacket. If the image storage class is PsudeoClass, call GetIndexes() after invoking GetImagePixels() to obtain the colormap indexes (of type IndexPacket) corresponding to the region. Once the PixelPacket (and/or IndexPacket) array has been updated, the changes must be saved back to the underlying image using SyncImagePixels() or they may be lost.
The format of the GetImagePixels() method is:
PixelPacket *GetImagePixels( Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows );
GetImagePixels() returns a pointer to the pixels if they are transferred, otherwise a NULL is returned.
The image.
These values define the perimeter of a region of pixels.
PixelPacket *GetImagePixelsEx( Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
GetImagePixelsEx() obtains a pixel region for read/write access. It is similar to GetImagePixels() except that it reports any error information to a user provided exception structure.
The format of the GetImagePixelsEx() method is:
PixelPacket *GetImagePixelsEx( Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
GetImagePixelsEx() returns a pointer to the pixels if they are transferred, otherwise a NULL is returned.
The image.
These values define the perimeter of a region of pixels.
Any error details are reported here.
VirtualPixelMethod GetImageVirtualPixelMethod( const Image *image );
GetImageVirtualPixelMethod() gets the "virtual pixels" method for the image. A virtual pixel is any pixel access that is outside the boundaries of the image cache.
The format of the GetImageVirtualPixelMethod() method is:
VirtualPixelMethod GetImageVirtualPixelMethod( const Image *image );
A description of each parameter follows:
The image.
IndexPacket *GetIndexes( const Image *image );
GetIndexes() returns the colormap indexes associated with the last call to SetImagePixels() or GetImagePixels(). NULL is returned if colormap indexes are not available.
The format of the GetIndexes() method is:
IndexPacket *GetIndexes( const Image *image );
A description of each parameter follows:
GetIndexes() returns the indexes associated with the last call to SetImagePixels() or GetImagePixels().
The image.
PixelPacket GetOnePixel( const Image image, const long x, const long y );
GetOnePixel() returns a single pixel at the specified (x,y) location. The image background color is returned if an error occurs. This function is convenient but performance will be poor if it is used too often. GetOnePixel() is identical to AcquireOnePixel() except that exceptions are implicitly delivered to the image.
The format of the GetOnePixel() method is:
PixelPacket GetOnePixel( const Image image, const long x, const long y );
A description of each parameter follows:
The image.
These values define the location of the pixel to return.
PixelPacket *GetPixels( const Image image );
GetPixels() returns the pixels associated with the last call to SetImagePixels() or GetImagePixels(). This is useful in order to access an already selected region without passing the geometry of the region.
The format of the GetPixels() method is:
PixelPacket *GetPixels( const Image image );
A description of each parameter follows:
GetPixels() returns the pixels associated with the last call to SetImagePixels() or GetImagePixels().
The image.
MagickPassFail ModifyCache( Image *image, ExceptionInfo *exception );
ModifyCache() ensures that there is only a single reference to the pixel cache to be modified, updating the provided cache pointer to point to a clone of the original pixel cache if necessary. This is used to implement copy on write.
The format of the ModifyCache method is:
MagickPassFail ModifyCache( Image *image, ExceptionInfo *exception );
A description of each parameter follows:
The image.
Errors are reported here.
PixelPacket *SetCacheViewPixels( ViewInfo *view, const long x, const long y, const unsigned long columns, const unsigned long rows );
SetCacheViewPixels() gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters. A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.
The format of the SetCacheViewPixels method is:
PixelPacket *SetCacheViewPixels( ViewInfo *view, const long x, const long y, const unsigned long columns, const unsigned long rows );
The address of a structure of type ViewInfo.
These values define the perimeter of a region of pixels.
Any errors are reported here.
PixelPacket *SetImagePixels( Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows );
SetImagePixels() initializes a pixel region for write-only access. If the region is successfully intialized a pointer to a PixelPacket array representing the region is returned, otherwise NULL is returned. The returned pointer may point to a temporary working buffer for the pixels or it may point to the final location of the pixels in memory.
Write-only access means that any existing pixel values corresponding to the region are ignored. This is useful while the initial image is being created from scratch, or if the existing pixel values are to be completely replaced without need to refer to their pre-existing values. The application is free to read and write the pixel buffer returned by SetImagePixels() any way it pleases. SetImagePixels() does not initialize the pixel array values. Initializing pixel array values is the application's responsibility.
Performance is maximized if the selected area is part of one row, or one or more full rows, since then there is opportunity to access the pixels in-place (without a copy) if the image is in RAM, or in a memory-mapped file. The returned pointer should never be deallocated by the user.
Pixels accessed via the returned pointer represent a simple array of type PixelPacket. If the image storage class is PsudeoClass, call GetIndexes() after invoking GetImagePixels() to obtain the colormap indexes (of type IndexPacket) corresponding to the region. Once the PixelPacket (and/or IndexPacket) array has been updated, the changes must be saved back to the underlying image using SyncCacheNexus() or they may be lost.
The format of the SetImagePixels() method is:
PixelPacket *SetImagePixels( Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows );
SetImagePixels returns a pointer to the pixels if they are transferred, otherwise a NULL is returned.
The image.
These values define the perimeter of a region of pixels.
PixelPacket *SetImagePixelsEx( Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
SetImagePixelsEx() initializes a pixel region for write-only access. It is similar to SetImagePixels() except that any exception information is written to a user provided exception structure.
The format of the SetImagePixelsEx() method is:
PixelPacket *SetImagePixelsEx( Image *image, const long x, const long y, const unsigned long columns, const unsigned long rows, ExceptionInfo *exception );
SetImagePixelsEx returns a pointer to the pixels if they are transferred, otherwise a NULL is returned.
The image.
These values define the perimeter of a region of pixels.
Any error details are reported here.
SetImageVirtualPixelMethod( const Image *image, const VirtualPixelMethod method );
SetImageVirtualPixelMethod() sets the "virtual pixels" method for the image. A virtual pixel is any pixel access that is outside the boundaries of the image cache.
The format of the SetImageVirtualPixelMethod() method is:
SetImageVirtualPixelMethod( const Image *image, const VirtualPixelMethod method );
The image.
choose from these access types:
EdgeVPType: the edge pixels of the image extend infinitely. Any pixel outside the image is assigned the same value as the pixel at the edge closest to it.
TileVPType: the image extends periodically or tiled. The pixels wrap around the edges of the image.
MirrorVPType: mirror the image at the boundaries.
ConstantVPType: every value outside the image is a constant as defines by the pixel parameter.
MagickPassFail SyncCacheViewPixels( const ViewInfo *view, ExceptionInfo *exception );
SyncCacheViewPixels() saves the view pixels to the in-memory or disk cache. The method returns MagickPass if the pixel region is synced, otherwise MagickFail.
The format of the SyncCacheViewPixels method is:
MagickPassFail SyncCacheViewPixels( const ViewInfo *view, ExceptionInfo *exception );
The address of a structure of type ViewInfo.
Any errors are reported here.
MagickPassFail SyncImagePixels( Image *image );
SyncImagePixels() saves the image pixels to the in-memory or disk cache. The method returns MagickPass if the pixel region is synced, otherwise MagickFail.
The format of the SyncImagePixels() method is:
MagickPassFail SyncImagePixels( Image *image );
A description of each parameter follows:
SyncImagePixels() returns MagickPass if the image pixels are transferred to the in-memory or disk cache otherwise MagickFail.
The image.
MagickPassFail SyncImagePixelsEx( Image *image, ExceptionInfo *exception );
SyncImagePixelsEx() saves the image pixels to the in-memory or disk cache. The method returns MagickPass if the pixel region is synced, otherwise MagickFail.
The format of the SyncImagePixelsEx() method is:
MagickPassFail SyncImagePixelsEx( Image *image, ExceptionInfo *exception );
A description of each parameter follows:
SyncImagePixelsEx() returns MagickPass if the image pixels are transferred to the in-memory or disk cache otherwise MagickFail.
The image.
Any error details are reported here.
Copyright © GraphicsMagick Group 2002 - 2023