public:
// Construct pixel view using specified image.
- Pixels( Magick::Image &image_ );
+ Pixels(Magick::Image &image_);
// Destroy pixel view
- ~Pixels( void );
+ ~Pixels(void);
// Transfer pixels from the image to the pixel view as defined by
// the specified region. Modified pixels may be subsequently
// transferred back to the image via sync.
- Quantum* get ( const ::ssize_t x_, const ::ssize_t y_,
- const size_t columns_,const size_t rows_ );
+ Quantum* get(const ::ssize_t x_,const ::ssize_t y_,
+ const size_t columns_,const size_t rows_);
// Transfer read-only pixels from the image to the pixel view as
// defined by the specified region.
- const Quantum* getConst ( const ::ssize_t x_, const ::ssize_t y_,
- const size_t columns_,
- const size_t rows_ );
-
- // Transfers the image view pixels to the image.
- void sync ( void );
-
+ const Quantum* getConst(const ::ssize_t x_,const ::ssize_t y_,
+ const size_t columns_,const size_t rows_);
+
+ // Return pixel colormap index array
+ //Quantum* metacontent(void);
+
// Allocate a pixel view region to store image pixels as defined
// by the region rectangle. This area is subsequently transferred
// from the pixel view to the image via sync.
- Quantum* set ( const ::ssize_t x_, const ::ssize_t y_,
- const size_t columns_, const size_t rows_ );
+ Quantum* set(const ::ssize_t x_,const ::ssize_t y_,const size_t columns_,
+ const size_t rows_ );
- // Return pixel colormap index array
- Quantum* metacontent ( void );
+ // Transfers the image view pixels to the image.
+ void sync(void);
// Left ordinate of view
- ::ssize_t x ( void ) const;
+ ::ssize_t x(void) const;
// Top ordinate of view
- ::ssize_t y ( void ) const;
+ ::ssize_t y(void) const;
// Width of view
- size_t columns ( void ) const;
+ size_t columns(void) const;
// Height of view
- size_t rows ( void ) const;
-
-#if 0
- // Transfer one or more pixel components from a buffer or file
- // into the image pixel view of an image. Used to support image
- // decoders.
- void decode ( const QuantumType quantum_,
- const unsigned char *source_ )
- {
- MagickCore::ReadPixelCache( _image.image(), quantum_, source_ );
- }
-
- // Transfer one or more pixel components from the image pixel
- // view to a buffer or file. Used to support image encoders.
- void encode ( const QuantumType quantum_,
- const unsigned char *destination_ )
- {
- MagickCore::WritePixelCache( _image.image(), quantum_, destination_ );
- }
-#endif
+ size_t rows(void) const;
+
private:
// Copying and assigning Pixels is not supported.
- Pixels( const Pixels& pixels_ );
- const Pixels& operator=( const Pixels& pixels_ );
+ Pixels(const Pixels& pixels_);
+ const Pixels& operator=(const Pixels& pixels_);
- Magick::Image _image; // Image reference
- MagickCore::CacheView* _view; // Image view handle
- ::ssize_t _x; // Left ordinate of view
- ::ssize_t _y; // Top ordinate of view
- size_t _columns; // Width of view
- size_t _rows; // Height of view
- MagickCore:: ExceptionInfo _exception; // Any thrown exception
+ Magick::Image _image; // Image reference
+ MagickCore::CacheView* _view; // Image view handle
+ ::ssize_t _x; // Left ordinate of view
+ ::ssize_t _y; // Top ordinate of view
+ size_t _columns; // Width of view
+ size_t _rows; // Height of view
+ MagickCore::ExceptionInfo _exception; // Any thrown exception
}; // class Pixels
//
// Left ordinate of view
-inline ::ssize_t Magick::Pixels::x ( void ) const
+inline ::ssize_t Magick::Pixels::x(void) const
{
return _x;
}
// Top ordinate of view
-inline ::ssize_t Magick::Pixels::y ( void ) const
+inline ::ssize_t Magick::Pixels::y(void) const
{
return _y;
}
// Width of view
-inline size_t Magick::Pixels::columns ( void ) const
+inline size_t Magick::Pixels::columns(void) const
{
return _columns;
}
// Height of view
-inline size_t Magick::Pixels::rows ( void ) const
+inline size_t Magick::Pixels::rows(void) const
{
return _rows;
}
#include "Magick++/Exception.h"
#include "Magick++/Pixels.h"
-namespace Magick
-{
-
-
-}
-
-// Construct pixel view using specified image.
-Magick::Pixels::Pixels( Magick::Image &image_ )
+Magick::Pixels::Pixels(Magick::Image &image_)
: _image(image_),
_view(AcquireVirtualCacheView(_image.image(),&_exception)),
_x(0),
_columns(0),
_rows(0)
{
- GetExceptionInfo( &_exception );
+ GetExceptionInfo(&_exception);
if (!_view)
_image.throwImageException();
}
-// Destroy pixel view
-Magick::Pixels::~Pixels( void )
+Magick::Pixels::~Pixels(void)
{
- if ( _view )
- _view = DestroyCacheView( _view );
+ if (_view)
+ _view=DestroyCacheView(_view);
- (void) DestroyExceptionInfo( &_exception );
+ (void) DestroyExceptionInfo(&_exception);
}
-// Transfer pixels from the image to the pixel view as defined by
-// the specified region. Modified pixels may be subsequently
-// transferred back to the image via sync.
-Magick::Quantum* Magick::Pixels::get ( const ssize_t x_,
- const ssize_t y_,
- const size_t columns_,
- const size_t rows_ )
+Magick::Quantum* Magick::Pixels::get(const ssize_t x_,const ssize_t y_,
+ const size_t columns_,const size_t rows_)
{
- _x = x_;
- _y = y_;
- _columns = columns_;
- _rows = rows_;
+ _x=x_;
+ _y=y_;
+ _columns=columns_;
+ _rows=rows_;
- Quantum* pixels = GetCacheViewAuthenticPixels( _view, x_, y_, columns_, rows_, &_exception);
+ Quantum* pixels=GetCacheViewAuthenticPixels(_view,x_,y_,columns_,rows_,
+ &_exception);
+
+ if (!pixels)
+ throwException(_exception);
- if ( !pixels )
- throwException( _exception );
-
return pixels;
}
-// Transfer read-only pixels from the image to the pixel view as
-// defined by the specified region.
-const Magick::Quantum* Magick::Pixels::getConst ( const ssize_t x_, const ssize_t y_,
- const size_t columns_,
- const size_t rows_ )
+const Magick::Quantum* Magick::Pixels::getConst(const ssize_t x_,
+ const ssize_t y_,const size_t columns_,const size_t rows_)
{
- _x = x_;
- _y = y_;
- _columns = columns_;
- _rows = rows_;
+ _x=x_;
+ _y=y_;
+ _columns=columns_;
+ _rows=rows_;
- const Quantum* pixels =
- GetCacheViewVirtualPixels(_view, x_, y_, columns_, rows_, &_exception );
+ const Quantum* pixels=GetCacheViewVirtualPixels(_view,x_,y_,columns_,rows_,
+ &_exception);
- if ( !pixels )
- throwException( _exception );
+ if (!pixels)
+ throwException(_exception);
- return pixels;
+ return pixels;
}
-// Transfers the image view pixels to the image.
-void Magick::Pixels::sync ( void )
+Magick::Quantum* Magick::Pixels::set(const ssize_t x_,const ssize_t y_,
+ const size_t columns_,const size_t rows_)
{
- if( !SyncCacheViewAuthenticPixels( _view, &_exception ) )
- throwException( _exception );
+ _x=x_;
+ _y=y_;
+ _columns=columns_;
+ _rows=rows_;
+
+ Quantum* pixels=QueueCacheViewAuthenticPixels(_view,x_,y_,columns_,rows_,
+ &_exception);
+
+ if (!pixels)
+ throwException(_exception);
+
+ return pixels;
}
-
-// Allocate a pixel view region to store image pixels as defined
-// by the region rectangle. This area is subsequently transferred
-// from the pixel view to the image via 'sync'.
-Magick::Quantum* Magick::Pixels::set ( const ssize_t x_,
- const ssize_t y_,
- const size_t columns_,
- const size_t rows_ )
+
+void Magick::Pixels::sync(void)
{
- _x = x_;
- _y = y_;
- _columns = columns_;
- _rows = rows_;
-
- Quantum* pixels = QueueCacheViewAuthenticPixels( _view, x_, y_,
- columns_, rows_, &_exception );
- if ( !pixels )
- throwException( _exception );
-
- return pixels;
+ if(!SyncCacheViewAuthenticPixels(_view,&_exception))
+ throwException(_exception);
}
// Return pixel colormap index array
/*
-Magick::void* Magick::Pixels::metacontent ( void )
+Magick::void* Magick::Pixels::metacontent(void)
{
- void* pixel_metacontent = GetCacheViewAuthenticMetacontent( _view );
+ void* pixel_metacontent=GetCacheViewAuthenticMetacontent(_view);
- if ( !pixel_metacontent )
+ if (!pixel_metacontent)
_image.throwImageException();
return pixel_metacontent;