Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:11:38

0001 // This may look like C code, but it is really -*- C++ -*-
0002 //
0003 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
0004 //
0005 // Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization
0006 // dedicated to making software imaging solutions freely available.
0007 //
0008 // Geometry Definition
0009 //
0010 // Representation of an ImageMagick geometry specification
0011 // X11 geometry specification plus hints
0012 
0013 #if !defined (Magick_Geometry_header)
0014 #define Magick_Geometry_header
0015 
0016 #include "Magick++/Include.h"
0017 #include <string>
0018 
0019 namespace Magick
0020 {
0021   class MagickPPExport Geometry;
0022 
0023   // Compare two Geometry objects regardless of LHS/RHS
0024   MagickPPExport int operator ==
0025     (const Magick::Geometry& left_,const Magick::Geometry& right_);
0026   MagickPPExport int operator !=
0027     (const Magick::Geometry& left_,const Magick::Geometry& right_);
0028   MagickPPExport int operator >
0029     (const Magick::Geometry& left_,const Magick::Geometry& right_);
0030   MagickPPExport int operator <
0031     (const Magick::Geometry& left_,const Magick::Geometry& right_);
0032   MagickPPExport int operator >=
0033     (const Magick::Geometry& left_,const Magick::Geometry& right_);
0034   MagickPPExport int operator <=
0035     (const Magick::Geometry& left_,const Magick::Geometry& right_);
0036 
0037   class MagickPPExport Geometry
0038   {
0039   public:
0040 
0041     // Default constructor
0042     Geometry();
0043 
0044     // Construct Geometry from specified string
0045     Geometry(const char *geometry_);
0046 
0047     // Copy constructor
0048     Geometry(const Geometry &geometry_);
0049 
0050     // Construct Geometry from specified string
0051     Geometry(const std::string &geometry_);
0052 
0053     // Construct Geometry from specified dimensions
0054     Geometry(size_t width_,size_t height_,::ssize_t xOff_=0,
0055       ::ssize_t yOff_=0);
0056 
0057     // Destructor
0058     ~Geometry(void);
0059 
0060     // Set via geometry string
0061     const Geometry& operator=(const char *geometry_);
0062 
0063     // Assignment operator
0064     Geometry& operator=(const Geometry& Geometry_);
0065 
0066     // Set via geometry string
0067     const Geometry& operator=(const std::string &geometry_);
0068 
0069     // Return geometry string
0070     operator std::string() const;
0071 
0072     // Resize without preserving aspect ratio (!)
0073     void aspect(bool aspect_);
0074     bool aspect(void) const;
0075 
0076     // Resize the image based on the smallest fitting dimension (^)
0077     void fillArea(bool fillArea_);
0078     bool fillArea(void) const;
0079 
0080     // Resize if image is greater than size (>)
0081     void greater(bool greater_);
0082     bool greater(void) const;
0083 
0084     // Height
0085     void height(size_t height_);
0086     size_t height(void) const;
0087 
0088     // Does object contain valid geometry?
0089     void isValid(bool isValid_);
0090     bool isValid(void) const;
0091 
0092     // Resize if image is less than size (<)
0093     void less(bool less_);
0094     bool less(void) const;
0095 
0096     // Resize using a pixel area count limit (@)
0097     void limitPixels(bool limitPixels_);
0098     bool limitPixels(void) const;
0099 
0100     // Width and height are expressed as percentages
0101     void percent(bool percent_);
0102     bool percent(void) const;
0103 
0104     // Width
0105     void width(size_t width_);
0106     size_t width(void) const;
0107 
0108     // X offset from origin
0109     void xOff(::ssize_t xOff_);
0110     ::ssize_t xOff(void) const;
0111 
0112     // Y offset from origin
0113     void yOff(::ssize_t yOff_);
0114     ::ssize_t yOff(void) const;
0115 
0116     //
0117     // Public methods below this point are for Magick++ use only.
0118     //
0119 
0120     // Construct from RectangleInfo
0121     Geometry(const MagickCore::RectangleInfo &rectangle_);
0122 
0123     // Set via RectangleInfo
0124     const Geometry& operator=(const MagickCore::RectangleInfo &rectangle_);
0125 
0126     // Return an ImageMagick RectangleInfo struct
0127     operator MagickCore::RectangleInfo() const;
0128 
0129   private:
0130     size_t _width;
0131     size_t _height;
0132     ::ssize_t _xOff;
0133     ::ssize_t _yOff;
0134     bool _isValid;
0135     bool _percent;     // Interpret width & height as percentages (%)
0136     bool _aspect;      // Force exact size (!)
0137     bool _greater;     // Resize only if larger than geometry (>)
0138     bool _less;        // Resize only if smaller than geometry (<)
0139     bool _fillArea;    // Resize the image based on the smallest fitting dimension (^)
0140     bool _limitPixels; // Resize using a pixel area count limit (@)
0141   };
0142 
0143   class MagickPPExport Offset;
0144 
0145   // Compare two Offset objects
0146   MagickPPExport int operator ==
0147     (const Magick::Offset& left_,const Magick::Offset& right_);
0148   MagickPPExport int operator !=
0149     (const Magick::Offset& left_,const Magick::Offset& right_);
0150 
0151   class MagickPPExport Offset
0152   {
0153   public:
0154 
0155     // Default constructor
0156     Offset();
0157 
0158     // Construct Offset from specified string
0159     Offset(const char *offset_);
0160 
0161     // Copy constructor
0162     Offset(const Offset &offset_);
0163 
0164     // Construct Offset from specified string
0165     Offset(const std::string &offset_);
0166 
0167     // Construct Offset from specified x and y
0168     Offset(ssize_t x_,ssize_t y_);
0169 
0170     // Destructor
0171     ~Offset(void);
0172 
0173     // Set via offset string
0174     const Offset& operator=(const char *offset_);
0175 
0176     // Assignment operator
0177     Offset& operator=(const Offset& offset_);
0178 
0179     // Set via offset string
0180     const Offset& operator=(const std::string &offset_);
0181 
0182     // X offset from origin
0183     ssize_t x(void) const;
0184 
0185     // Y offset from origin
0186     ssize_t y(void) const;
0187 
0188     //
0189     // Public methods below this point are for Magick++ use only.
0190     //
0191 
0192     // Return an ImageMagick OffsetInfo struct
0193     operator MagickCore::OffsetInfo() const;
0194 
0195   private:
0196     ssize_t _x;
0197     ssize_t _y;
0198   };
0199 
0200   class MagickPPExport Point;
0201 
0202   // Compare two Point objects
0203   MagickPPExport int operator ==
0204     (const Magick::Point& left_,const Magick::Point& right_);
0205   MagickPPExport int operator !=
0206     (const Magick::Point& left_,const Magick::Point& right_);
0207 
0208   class MagickPPExport Point
0209   {
0210   public:
0211 
0212     // Default constructor
0213     Point();
0214 
0215     // Construct Point from specified string
0216     Point(const char *point_);
0217 
0218     // Copy constructor
0219     Point(const Point &point_);
0220 
0221     // Construct Point from specified string
0222     Point(const std::string &point_);
0223 
0224     // Construct Point from specified x and y
0225     Point(double x_,double y_);
0226 
0227     // Construct Point from specified x y
0228     Point(double xy_);
0229 
0230     // Destructor
0231     ~Point(void);
0232 
0233     // Set via point string
0234     const Point& operator=(const char *point_);
0235 
0236     // Set via double value
0237     const Point& operator=(double xy_);
0238 
0239     // Assignment operator
0240     Point& operator=(const Point& point_);
0241 
0242     // Set via point string
0243     const Point& operator=(const std::string &point_);
0244 
0245     // Return point string
0246     operator std::string() const;
0247 
0248     // Does object contain valid point?
0249     bool isValid() const;
0250 
0251     // X offset from origin
0252     double x(void) const;
0253 
0254     // Y offset from origin
0255     double y(void) const;
0256 
0257   private:
0258     double _x;
0259     double _y;
0260   };
0261 } // namespace Magick
0262 
0263 #endif // Magick_Geometry_header