- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- GetIndexes
- GetOnePixel
- GetPixelCache
- GetPixels
- ReadPixelCache
- SetPixelCache
- SyncPixelCache
- WritePixelCache

# NAME

pixel_cache - ImageMagick Pixel Cache Methods

page index

# SYNOPSIS

IndexPacket * GetIndexes( const Image *image );

PixelPacket * GetOnePixel( 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 );

PixelPacket * GetPixels( const Image image );

unsigned int ReadPixelCache( const Image *image, const QuantumType quantum, const unsigned char *source );

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

unsigned int SyncPixelCache( Image *image );

unsigned int WritePixelCache( const Image *, const QuantumType quantum, unsigned char *destination );

page index

# FUNCTION DESCRIPTIONS

## GetIndexes

Method GetIndexes returns the colormap indexes associated with the last call to the `SetPixelCache` or `GetPixelCache` 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 `SetPixelCache` or `GetPixelCache` methods.

image:
  The address of a structure of type 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.

image:
  The address of a structure of type Image.

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

## 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 address of a structure of type Image.

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

## GetPixels

Method GetPixels returns the pixels associated with the last call to the `SetPixelCache` or `GetPixelCache` 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 `SetPixelCache` or `GetPixelCache` methods.

image:
  The address of a structure of type Image.

## ReadPixelCache

Method ReadPixelCache transfers one or more pixel components from a buffer or file into the image pixel buffer of an image. It returns True if the pixels are successfully transferred, otherwise False.

The format of the ReadPixelCache method is:

> unsigned int ReadPixelCache ( const Image *image, const QuantumType quantum, const unsigned char *source );

A description of each parameter follows:

status:
  Method ReadPixelCache returns True if the pixels are successfully transferred, otherwise False.

image:
  The address of a structure of type Image.

quantum:
  Declare which pixel components to transfer (red, green, blue, opacity, RGB, or RGBA).

source:
  The pixel components are transferred from this buffer.

## 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 address of a structure of type Image.

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

## 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 address of a structure of type Image.

## WritePixelCache

Method WritePixelCache transfers one or more pixel components from the image pixel buffer to a buffer or file. It returns True if the pixels are successfully transferred, otherwise False.

The format of the WritePixelCache method is:

> unsigned int WritePixelCache ( const Image *, const QuantumType quantum, unsigned char *destination );

A description of each parameter follows:

status:
  Method WritePixelCache returns True if the pixels are successfully transferred, otherwise False.

image:
  The address of a structure of type Image.

quantum:
  Declare which pixel components to transfer (red, green, blue, opacity, RGB, or RGBA).

destination:
  The components are transferred to this buffer.

page index