cache - Methods to Get or Set Image Pixels

- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- CloseImagePixels
- ClosePixelCache
- CompressCache
- DestroyCache
- DestroyImagePixels
- DestroyPixelCache
- GetImagePixels
- GetIndexes
- GetIndexesFromCache
- GetOnePixel
- GetOnePixelFromCache
- GetPixels
- GetPixelCache
- GetPixelsFromCache
- SetImagePixels
- SetPixelCache
- SyncImagePixels
- SyncPixelCache
- UncompressCache
- WriteCacheInfo

# NAME

cache - Methods to Get or Set Image Pixels

# SYNOPSIS

void CloseImagePixels( Image *image );

void ClosePixelCache( Image *image );

unsigned int CompressCache( Cache cache );

DestroyCache( void );

void DestroyImagePixels( Image *image );

void DestroyPixelCache( Image *image );

status: Method GetImagePixels( )returns a pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.;

indexes: Method GetIndexes( )returns the colormap indexes associated with the last call to the SetImagePixels( )or GetImagePixels( )methods.;

indexes: Method GetIndexesFromCache( )returns the colormap indexes associated with the last call to the SetPixelCache( )or GetPixelCache( )methods.;

pixels: Method GetOnePixel( )returns a pixel at the specified( x, y );

PixelPacket * GetOnePixelFromCache( const Image image, const int x, const int y );

PixelPacket * GetPixelCache( Image *image, const int x, const int y, const unsigned int columns, const unsigned int rows );

pixels: Method GetPixels( )returns the pixels associated with the last call to the SetImagePixels( )or GetImagePixels( )methods.;

PixelPacket * GetPixelsFromCache( const Image image );

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

PixelPacket * SetPixelCache( Image *image, const int x, const int y, const unsigned int columns, const unsigned int rows );

unsigned int SyncImagePixels( Image *image );

unsigned int SyncPixelCache( Image *image );

unsigned int UncompressCache( Cache cache );

unsigned int WriteCacheInfo( Image *image );

# FUNCTION DESCRIPTIONS

## CloseImagePixels

Method CloseImagePixels closes the pixel cache. Use this method to prevent too many file descriptors from being allocated when reading an image sequence. File descriptors are only used for a disk-based cache. This is essentially a no-op for a memory-based cache.

The format of the CloseImagePixels method is:

> void CloseImagePixels ( Image *image );

A description of each parameter follows:

image:
  The image.

## ClosePixelCache

Method ClosePixelCache closes the pixel cache. Use this method to prevent too many file descriptors from being allocated when reading an image sequence. File descriptors are only used for a disk-based cache. This is essentially a no-op for a memory-based cache.

The format of the ClosePixelCache method is:

> void ClosePixelCache ( Image *image );

A description of each parameter follows:

image:
  The image.

## CompressCache

Method CompressCache compresses the disk-based pixel cache.

The format of the CompressCache method is:

> unsigned int CompressCache ( Cache cache );

A description of each parameter follows:

cache:
  Specifies a pointer to a Cache structure.

## DestroyCache

Method DestroyCache destroys the cache environment.

The format of the DestroyCache method is:

> DestroyCache ( void );

## DestroyImagePixels

Method 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.

## DestroyPixelCache

Method DestroyPixelCache deallocates memory associated with the pixel cache.

The format of the DestroyPixelCache method is:

> void DestroyPixelCache ( Image *image );

A description of each parameter follows:

image:
  The image.

## GetImagePixels

> Method GetImagePixels ( ) gets pixels from the in-memory or disk pixel cacheas defined by the geometry parameters. A pointer to the pixels is returnedif the pixels are transferred, otherwise a NULL is returned.;

The format of the GetImagePixels method is:

> PixelPacket *GetImagePixels ( Image *image, const int x, const int y, const unsigned int columns, const unsigned int rows );

A description of each parameter follows:

> status: Method GetImagePixels ( ) returns a pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.;

image:
  The image.

x,y,columns,rows:
  These values define the perimeter of a region of pixels.

## GetIndexes

> Method GetIndexes ( ) returns the colormap indexes associated with the lastcall to the SetImagePixels ( ) or GetImagePixels ( ) methods.;

The format of the GetIndexes method is:

> IndexPacket *GetIndexes ( const Image *image );

A description of each parameter follows:

> indexes: Method GetIndexes ( ) returns the colormap indexes associated with the last call to the SetImagePixels ( ) or GetImagePixels ( ) methods.;

image:
  The image.

## GetIndexesFromCache

Method GetIndexesFromCache returns the colormap indexes associated with the last call to the `SetPixelCache()` or `GetPixelCache()` methods.

The format of the GetIndexesFromCache method is:

> IndexPacket *GetIndexesFromCache ( const Image *image );

A description of each parameter follows:

> indexes: Method GetIndexesFromCache ( ) returns the colormap indexes associated with the last call to the SetPixelCache ( ) or GetPixelCache ( ) methods.;

image:
  The image.

## GetOnePixel

> Method 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 int x, const int y );

A description of each parameter follows:

> pixels: Method GetOnePixel ( ) returns a pixel at the specified ( x, y );

        location.
    =over 4

image:
  The image.

x,y:
  These values define the location of the pixel to return.

## GetOnePixelFromCache

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

The format of the GetOnePixelFromCache method is:

> PixelPacket *GetOnePixelFromCache ( const Image image, const int x, const int y );

A description of each parameter follows:

pixels:
  Method GetOnePixelFromCache returns a pixel at the specified (x,y) location.

image:
  The image.

x,y:
  These values define the location of the pixel to return.

## GetPixels

> Method GetPixels ( ) returns the pixels associated with the last call to theSetImagePixels ( ) or GetImagePixels ( ) methods.;

The format of the GetPixels method is:

> PixelPacket *GetPixels ( const Image image );

A description of each parameter follows:

> pixels: Method GetPixels ( ) returns the pixels associated with the last call to the SetImagePixels ( ) or GetImagePixels ( ) methods.;

image:
  The image.

## GetPixelCache

Method GetPixelCache 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 GetPixelCache method is:

> PixelPacket *GetPixelCache ( Image *image, const int x, const int y, const unsigned int columns, const unsigned int rows );

A description of each parameter follows:

status:
  Method GetPixelCache returns a pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.

image:
  The image.

x,y,columns,rows:
  These values define the perimeter of a region of pixels.

## GetPixelsFromCache

Method GetPixelsFromCache returns the pixels associated with the last call to the `SetPixelCache()` or `GetPixelCache()` methods.

The format of the GetPixelsFromCache method is:

> PixelPacket *GetPixelsFromCache ( const Image image );

A description of each parameter follows:

pixels:
  Method GetPixelsFromCache returns the pixels associated with the last call to the `SetPixelCache()` or `GetPixelCache()` methods.

image:
  The image.

## SetImagePixels

Method SetImagePixels allocates an area to store image pixels as defined by the region rectangle and returns a pointer to the area. This area is subsequently transferred from the pixel cache with method SyncImagePixels. A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.

The format of the SetImagePixels method is:

> PixelPacket *SetImagePixels ( Image *image, const int x, const int y, const unsigned int columns, const unsigned int rows );

A description of each parameter follows:

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

image:
  The image.

x,y,columns,rows:
  These values define the perimeter of a region of pixels.

## SetPixelCache

Method SetPixelCache allocates an area to store image pixels as defined by the region rectangle and returns a pointer to the area. This area is subsequently transferred from the pixel cache with method SyncPixelCache. A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.

The format of the SetPixelCache method is:

> PixelPacket *SetPixelCache ( Image *image, const int x, const int y, const unsigned int columns, const unsigned int rows );

A description of each parameter follows:

pixels:
  Method SetPixelCache returns a pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.

image:
  The image.

x,y,columns,rows:
  These values define the perimeter of a region of pixels.

## SyncImagePixels

> Method SyncImagePixels ( ) saves the image pixels to the in-memory or diskcache. The method returns True if the pixel region is synced, otherwiseFalse.;

The format of the SyncImagePixels method is:

> unsigned int SyncImagePixels ( Image *image );

A description of each parameter follows:

status:
  Method SyncImagePixels returns True if the image pixels are transferred to the in-memory or disk cache otherwise False.

image:
  The image.

## SyncPixelCache

Method SyncPixelCache saves the image pixels to the in-memory or disk cache. The method returns True if the pixel region is synced, otherwise False.

The format of the SyncPixelCache method is:

> unsigned int SyncPixelCache ( Image *image );

A description of each parameter follows:

status:
  Method SyncPixelCache returns True if the image pixels are transferred to the in-memory or disk cache otherwise False.

image:
  The image.

## UncompressCache

Method UncompressCache uncompresses the disk-based pixel cache.

The format of the UncompressCache method is:

> unsigned int UncompressCache ( Cache cache );

A description of each parameter follows:

cache:
  Specifies a pointer to a Cache structure.

## WriteCacheInfo

Method WriteCacheInfo writes the persistent cache meta information to a file on disk.

The format of the WriteCacheInfo method is:

> unsigned int WriteCacheInfo ( Image *image );

A description of each parameter follows:

status:
  Method WriteCacheInfo returns True if the cache meta information is written to the specified file, otherwise False.

image:
  The image.