6cache - ImageMagick Pixel Cache Methods9/


NAME



'cache - ImageMagick Pixel Cache Methods




(

SYNOPSIS



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

pvoid ReadPixelCache( Image *image, QuantumTypes quantum, unsigned char *source );

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

Kunsigned int SyncPixelCache( Image *image );

qvoid WritePixelCache( Image *, QuantumTypes quantum, unsigned char *destination );




B

FUNCTION DESCRIPTIONS






2

GetPixelCache



oMethod GetPixelCache gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters. dA pointer to the pixels is returned if the pixels are transferred, otherwise a &NULL is returned.\

This example illustrates the use of the GetPixelCache ( ) method:;


2

  for (y=0; y < (int) image->rows; y++)  {@=for html <blockquote>q=GetPixelCache ( image, 0, y, image->columns, 1 ); if ( q == ( <A HREF="types/PixelPacket.html">PixelPacket</A> *) NULL ) break; for ( x=0; x < ( int ) image->columns; x++ ) { if ( image->class == PseudoClass ) index=image->indexes[x]; red=q->red; green=q->green; blue=q->blue; q++; } if ( image->previous == ( <A HREF="types/Image.html">Image</A> *) NULL ) if ( QuantumTick ( y, image->rows ) ) ProgressMonitor ( LoadImageText, y, image->rows ) ; }; </blockquote>


*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:

8

status:


lMethod 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:


8These values define the perimeter of a region of pixels.






4

ReadPixelCache



JMethod ReadPixelCache transfers one or more pixel components from a buffer0or file into the image pixel buffer of an image.

+The format of the ReadPixelCache method is:‹

void ReadPixelCache ( Image *image, QuantumTypes quantum, unsigned char *source );


=A description of each parameter follows:

"

image:


)The address of a structure of type Image.$

quantum:


GDeclare which pixel components to transfer (red, green, blue, opacity, RGB, or RGBA).#

source:


6The pixel components are transferred from this buffer.






2

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 the SyncPixelCache. dA pointer to the pixels is returned if the pixels are transferred, otherwise a &NULL is returned.

=This example illustrates the use of the SetPixelCache method:

2

  for (y=0; y < (int) image->rows; y++)  {[=for html <blockquote>q=SetPixelCache ( image, 0, y, image->columns, 1 ); if ( q == ( <A HREF="types/PixelPacket.html">PixelPacket</A> *) NULL ) break; for ( x=0; x < ( int ) image->columns; x++ ) { if ( image->class == PseudoClass ) image->indexes[x]=0; q->red=0; q->green=0; q->blue=0; q++; } if ( !SyncPixelCache ( image ) ) break; if ( image->previous == ( <A HREF="types/Image.html">Image</A> *) NULL ) if ( QuantumTick ( y, image->rows ) ) ProgressMonitor ( LoadImageText, y, image->rows ) ; }; </blockquote>


*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:

#

status:


lMethod 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:


8These values define the perimeter of a region of pixels.






4

SyncPixelCache



EMethod SyncPixelCache saves the image pixels to the in-memory or diskKcache. The method returns True if the pixel region is set, otherwise False.DSee the SetPixelCache method for an example usage of SyncPixelCache.

+The format of the SyncPixelCache method is:f

unsigned int SyncPixelCache ( Image *image );


=A description of each parameter follows:

#

status:


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






6

WritePixelCache



FMethod WritePixelCache transfers one or more pixel components from the'image pixel buffer to a buffer or file.

,The format of the WritePixelCache method is:Œ

void WritePixelCache ( Image *, QuantumTypes quantum, unsigned char *destination );


=A description of each parameter follows:

"

image:


)The address of a structure of type Image.$

quantum:


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

destination:


.The components are transferred to this buffer.