[ImageMagick] [sponsor]

AcquireImagePixels

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 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 type is CMYK or the storage class is PseudoClass, call GetIndexes() after invoking GetImagePixels() to access the black color component or to obtain the colormap indexes (of type IndexPacket) corresponding to the region.

If you plan to modify the pixels, use GetImagePixels() instead.

Note, the AcquireImagePixels() and GetImagePixels() methods are not thread- safe. In a threaded environment, use AcquireCacheView() or GetCacheView() 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)

A description of each parameter follows:

image

    The image.

x,y,columns,rows

    These values define the perimeter of a region of pixels.

exception

    Return any errors or warnings in this structure.

AcquireOneMagickPixel

AcquireOneMagickPixel() returns a single pixel at the specified (x,y) location. The image background color is returned if an error occurs. If you plan to modify the pixel, use GetOnePixel() instead.

The format of the AcquireOneMagickPixel() method is:

  MagickPixelPacket AcquireOneMagickPixel(const Image image,const long x,
    const long y,ExceptionInfo exception)

A description of each parameter follows:

pixels

    AcquireOneMagickPixel() returns a pixel at the specified (x,y) location.

image

    The image.

x,y

    These values define the location of the pixel to return.

exception

    Return any errors or warnings in this structure.

AcquireOnePixel

AcquireOnePixel() returns a single pixel at the specified (x,y) location. The image background color is returned if an error occurs. If you plan to modify the pixel, use GetOnePixel() instead.

The format of the AcquireOnePixel() method is:

  PixelPacket AcquireOnePixel(const Image image,const long x,
    const long y,ExceptionInfo exception)

A description of each parameter follows:

pixels

    AcquireOnePixel() returns a pixel at the specified (x,y) location.

image

    The image.

x,y

    These values define the location of the pixel to return.

exception

    Return any errors or warnings in this structure.

AcquireOneVirtualPixel

AcquireOneVirtualPixel() returns a single pixel at the specified (x,y) location as defined by specified pixel method. The image background color is returned if an error occurs. If you plan to modify the pixel, use GetOnePixel() instead.

The format of the AcquireOneVirtualPixel() method is:

  PixelPacket AcquireOneVirtualPixel(const Image image,
    const VirtualPixelMethod virtual_pixel_method,const long x,
    const long y,ExceptionInfo exception)

A description of each parameter follows:

pixels

    AcquireOneVirtualPixel() returns a pixel at the specified (x,y) location.

virtual_pixel_method

    The virtual pixel method.

image

    The image.

x,y

    These values define the location of the pixel to return.

exception

    Return any errors or warnings in this structure.

DestroyCacheInfo

DestroyCacheInfo() deallocates memory associated with the pixel cache.

The format of the DestroyCacheInfo() method is:

  Cache DestroyCacheInfo(Cache cache)

A description of each parameter follows:

cache

    The pixel cache.

DestroyImagePixels

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:

image

    The image.

GetImagePixels

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 type is CMYK or if the storage class is PseduoClass, call GetIndexes() after invoking GetImagePixels() to obtain the black color component or 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)

A description of each parameter follows:

image

    The image.

x,y,columns,rows

    These values define the perimeter of a region of pixels.

GetImageVirtualPixelMethod

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:

image

    The image.

GetIndexes

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:

indexes

    GetIndexes() returns the indexes associated with the last call to SetImagePixels() or GetImagePixels().

image

    The image.

GetOnePixel

GetOnePixel() returns a single pixel at the specified (x,y) location. The image background color is returned if an error occurs.

The format of the GetOnePixel() method is:

  PixelPacket GetOnePixel(const Image image,const long x,const long y)

A description of each parameter follows:

image

    The image.

x,y

    These values define the location of the pixel to return.

GetPixels

GetPixels() returns the pixels associated with the last call to SetImagePixels() or GetImagePixels().

The format of the GetPixels() method is:

  PixelPacket *GetPixels(const Image image)

A description of each parameter follows:

pixels

    GetPixels() returns the pixels associated with the last call to SetImagePixels() or GetImagePixels().

image

    The image.

ReferenceCache

ReferenceCache() increments the reference count associated with the pixel cache returning a pointer to the cache.

The format of the ReferenceCache method is:

  Cache ReferenceCache(Cache cache_info)

A description of each parameter follows:

cache_info

    The pixel cache.

SetImagePixels

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 type is CMYK or the storage class is PseudoClass, call GetIndexes() after invoking GetImagePixels() to obtain the black color component or 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 SetImagePixels() method is:

  PixelPacket *SetImagePixels(Image *image,const long x,const long y,
    const unsigned long columns,const unsigned long rows)

A description of each parameter follows:

pixels

    SetImagePixels returns a pointer to the pixels if they are transferred, otherwise a NULL is returned.

image

    The image.

x,y,columns,rows

    These values define the perimeter of a region of pixels.

SetImageVirtualPixelMethod

SetImageVirtualPixelMethod() sets the "virtual pixels" method for the image and returns the previous setting. A virtual pixel is any pixel access that is outside the boundaries of the image cache.

The format of the SetImageVirtualPixelMethod() method is:

  VirtualPixelMethod SetImageVirtualPixelMethod(const Image *image,
    const VirtualPixelMethod method)

A description of each parameter follows:

image

    The image.

method

    choose the type of virtual pixel.

SyncImagePixels

SyncImagePixels() saves the image pixels to the in-memory or disk cache. The method returns MagickTrue if the pixel region is synced, otherwise MagickFalse.

The format of the SyncImagePixels() method is:

  MagickBooleanType SyncImagePixels(Image *image)

A description of each parameter follows:

image

    The image.