github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/graphics-magick/include/Magick++/Geometry.h (about) 1 // This may look like C code, but it is really -*- C++ -*- 2 // 3 // Copyright Bob Friesenhahn, 1999 - 2014 4 // 5 // Geometry Definition 6 // 7 // Representation of an ImageMagick geometry specification 8 // X11 geometry specification plus hints 9 10 #if !defined (Magick_Geometry_header) 11 #define Magick_Geometry_header 12 13 #include "Magick++/Include.h" 14 #include <string> 15 16 namespace Magick 17 { 18 19 class MagickDLLDecl Geometry; 20 21 // Compare two Geometry objects regardless of LHS/RHS 22 int MagickDLLDecl operator == ( const Magick::Geometry& left_, const Magick::Geometry& right_ ); 23 int MagickDLLDecl operator != ( const Magick::Geometry& left_, const Magick::Geometry& right_ ); 24 int MagickDLLDecl operator > ( const Magick::Geometry& left_, const Magick::Geometry& right_ ); 25 int MagickDLLDecl operator < ( const Magick::Geometry& left_, const Magick::Geometry& right_ ); 26 int MagickDLLDecl operator >= ( const Magick::Geometry& left_, const Magick::Geometry& right_ ); 27 int MagickDLLDecl operator <= ( const Magick::Geometry& left_, const Magick::Geometry& right_ ); 28 29 class MagickDLLDecl Geometry 30 { 31 public: 32 33 Geometry ( unsigned int width_, 34 unsigned int height_, 35 unsigned int xOff_ = 0, 36 unsigned int yOff_ = 0, 37 bool xNegative_ = false, 38 bool yNegative_ = false ); 39 Geometry ( const std::string &geometry_ ); 40 Geometry ( const char * geometry_ ); 41 Geometry ( const Geometry &geometry_ ); 42 Geometry ( ); 43 ~Geometry ( void ); 44 45 // Width 46 void width ( unsigned int width_ ); 47 unsigned int width ( void ) const; 48 49 // Height 50 void height ( unsigned int height_ ); 51 unsigned int height ( void ) const; 52 53 // X offset from origin 54 void xOff ( unsigned int xOff_ ); 55 unsigned int xOff ( void ) const; 56 57 // Y offset from origin 58 void yOff ( unsigned int yOff_ ); 59 unsigned int yOff ( void ) const; 60 61 // Sign of X offset negative? (X origin at right) 62 void xNegative ( bool xNegative_ ); 63 bool xNegative ( void ) const; 64 65 // Sign of Y offset negative? (Y origin at bottom) 66 void yNegative ( bool yNegative_ ); 67 bool yNegative ( void ) const; 68 69 // Width and height are expressed as percentages 70 void percent ( bool percent_ ); 71 bool percent ( void ) const; 72 73 // Resize without preserving aspect ratio (!) 74 void aspect ( bool aspect_ ); 75 bool aspect ( void ) const; 76 77 // Resize if image is greater than size (>) 78 void greater ( bool greater_ ); 79 bool greater ( void ) const; 80 81 // Resize if image is less than size (<) 82 void less ( bool less_ ); 83 bool less ( void ) const; 84 85 // Resize image to fit total pixel area specified by dimensions (@). 86 void limitPixels ( bool limitPixels_ ); 87 bool limitPixels ( void ) const; 88 89 // Dimensions are treated as minimum rather than maximum values (^) 90 void fillArea ( bool fillArea_ ); 91 bool fillArea ( void ) const; 92 93 // Does object contain valid geometry? 94 void isValid ( bool isValid_ ); 95 bool isValid ( void ) const; 96 97 // Set via geometry string 98 const Geometry& operator = ( const std::string &geometry_ ); 99 const Geometry& operator = ( const char * geometry_ ); 100 101 // Assignment operator 102 Geometry& operator= ( const Geometry& Geometry_ ); 103 104 // Return geometry string 105 operator std::string() const; 106 107 // 108 // Public methods below this point are for Magick++ use only. 109 // 110 111 // Construct from RectangleInfo 112 Geometry ( const MagickLib::RectangleInfo &rectangle_ ); 113 114 // Return an ImageMagick RectangleInfo struct 115 operator MagickLib::RectangleInfo() const; 116 117 private: 118 unsigned int _width; 119 unsigned int _height; 120 unsigned int _xOff; 121 unsigned int _yOff; 122 union 123 { 124 struct 125 { 126 // Bit-field for compact boolean storage 127 bool _xNegative : 1; 128 bool _yNegative : 1; 129 bool _isValid : 1; 130 bool _percent : 1; // Interpret width & height as percentages (%) 131 bool _aspect : 1; // Force exact size (!) 132 bool _greater : 1; // Re-size only if larger than geometry (>) 133 bool _less : 1; // Re-size only if smaller than geometry (<) 134 bool _limitPixels : 1;// Resize image to fit total pixel area (@). 135 bool _fillArea : 1; // Dimensions are treated as 136 // minimum rather than maximum 137 // values (^) 138 } _b; 139 struct 140 { 141 // Padding for future use. 142 unsigned int pad[2]; 143 } _padding; 144 } _flags; // union 145 }; // class Geometry; 146 } // namespace Magick 147 148 // 149 // Inlines 150 // 151 152 153 #endif // Magick_Geometry_header