github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/graphics-magick/include/Magick++/Pixels.h (about) 1 // This may look like C code, but it is really -*- C++ -*- 2 // 3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002 4 // 5 // Representation of a pixel view. 6 // 7 8 #if !defined(Magick_Pixels_header) 9 #define Magick_Pixels_header 10 11 #include "Magick++/Include.h" 12 #include "Magick++/Color.h" 13 #include "Magick++/Image.h" 14 15 namespace Magick 16 { 17 class MagickDLLDecl Pixels 18 { 19 public: 20 21 // Construct pixel view using specified image. 22 Pixels( Magick::Image &image_ ); 23 24 // Destroy pixel view 25 ~Pixels( void ); 26 27 // Transfer pixels from the image to the pixel view as defined by 28 // the specified region. Modified pixels may be subsequently 29 // transferred back to the image via sync. 30 PixelPacket* get ( const int x_, const int y_, 31 const unsigned int columns_,const unsigned int rows_ ); 32 33 // Transfer read-only pixels from the image to the pixel view as 34 // defined by the specified region. 35 const PixelPacket* getConst ( const int x_, const int y_, 36 const unsigned int columns_, 37 const unsigned int rows_ ); 38 39 // Transfers the image view pixels to the image. 40 void sync ( void ); 41 42 // Allocate a pixel view region to store image pixels as defined 43 // by the region rectangle. This area is subsequently transferred 44 // from the pixel view to the image via sync. 45 PixelPacket* set ( const int x_, const int y_, 46 const unsigned int columns_, const unsigned int rows_ ); 47 48 // Return pixel colormap index array 49 IndexPacket* indexes ( void ); 50 51 // Left ordinate of view 52 int x ( void ) const; 53 54 // Top ordinate of view 55 int y ( void ) const; 56 57 // Width of view 58 unsigned int columns ( void ) const; 59 60 // Height of view 61 unsigned int rows ( void ) const; 62 63 #if 0 64 // Transfer one or more pixel components from a buffer or file 65 // into the image pixel view of an image. Used to support image 66 // decoders. 67 void decode ( const QuantumType quantum_, 68 const unsigned char *source_ ) 69 { 70 MagickLib::ReadPixelCache( _image.image(), quantum_, source_ ); 71 } 72 73 // Transfer one or more pixel components from the image pixel 74 // view to a buffer or file. Used to support image encoders. 75 void encode ( const QuantumType quantum_, 76 const unsigned char *destination_ ) 77 { 78 MagickLib::WritePixelCache( _image.image(), quantum_, destination_ ); 79 } 80 #endif 81 private: 82 83 // Copying and assigning Pixels is not supported. 84 Pixels( const Pixels& pixels_ ); 85 const Pixels& operator=( const Pixels& pixels_ ); 86 87 Magick::Image _image; // Image reference 88 MagickLib::ViewInfo* _view; // Image view handle 89 int _x; // Left ordinate of view 90 int _y; // Top ordinate of view 91 unsigned int _columns; // Width of view 92 unsigned int _rows; // Height of view 93 MagickLib:: ExceptionInfo _exception; // Any thrown exception 94 95 }; // class Pixels 96 97 } // Magick namespace 98 99 // 100 // Inline methods 101 // 102 103 // Left ordinate of view 104 inline int Magick::Pixels::x ( void ) const 105 { 106 return _x; 107 } 108 109 // Top ordinate of view 110 inline int Magick::Pixels::y ( void ) const 111 { 112 return _y; 113 } 114 115 // Width of view 116 inline unsigned int Magick::Pixels::columns ( void ) const 117 { 118 return _columns; 119 } 120 121 // Height of view 122 inline unsigned int Magick::Pixels::rows ( void ) const 123 { 124 return _rows; 125 } 126 127 #endif // Magick_Pixels_header