www/api/Magick++/Geometry_8h_source.html
| Magick++ 7.1.0 |
Geometry.h
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
4 //
5 // Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization
6 // dedicated to making software imaging solutions freely available.
7 //
8 // Geometry Definition
9 //
10 // Representation of an ImageMagick geometry specification
11 // X11 geometry specification plus hints
12
13 #if !defined (Magick_Geometry_header)
14 #define Magick_Geometry_header
15
16 #include "Magick++/Include.h"
17 #include <string>
18
19 namespace Magick
20 {
21class MagickPPExport Geometry;
22
23// Compare two Geometry objects regardless of LHS/RHS
24MagickPPExport int operator ==
25 (const Magick::Geometry& left_,const Magick::Geometry& right_);
26MagickPPExport int operator !=
27 (const Magick::Geometry& left_,const Magick::Geometry& right_);
28MagickPPExport int operator >
29 (const Magick::Geometry& left_,const Magick::Geometry& right_);
30MagickPPExport int operator <
31 (const Magick::Geometry& left_,const Magick::Geometry& right_);
32MagickPPExport int operator >=
33 (const Magick::Geometry& left_,const Magick::Geometry& right_);
34MagickPPExport int operator <=
35 (const Magick::Geometry& left_,const Magick::Geometry& right_);
36
37class MagickPPExport Geometry
38 {
39public:
40
41// Default constructor
42Geometry();
43
44// Construct Geometry from specified string
45Geometry(const char *geometry_);
46
47// Copy constructor
48Geometry(const Geometry &geometry_);
49
50// Construct Geometry from specified string
51Geometry(const std::string &geometry_);
52
53// Construct Geometry from specified dimensions
54Geometry(size_t width_,size_t height_,::ssize_t xOff_=0,
55 ::ssize_t yOff_=0);
56
57// Destructor
58 ~Geometry(void);
59
60// Set via geometry string
61const Geometry& operator=(const char *geometry_);
62
63// Assignment operator
64Geometry& operator=(const Geometry& Geometry_);
65
66// Set via geometry string
67const Geometry& operator=(const std::string &geometry_);
68
69// Return geometry string
70operator std::string() const;
71
72// Resize without preserving aspect ratio (!)
73void aspect(bool aspect_);
74bool aspect(void) const;
75
76// Resize the image based on the smallest fitting dimension (^)
77void fillArea(bool fillArea_);
78bool fillArea(void) const;
79
80// Resize if image is greater than size (>)
81void greater(bool greater_);
82bool greater(void) const;
83
84// Height
85void height(size_t height_);
86size_t height(void) const;
87
88// Does object contain valid geometry?
89void isValid(bool isValid_);
90bool isValid(void) const;
91
92// Resize if image is less than size (<)
93void less(bool less_);
94bool less(void) const;
95
96// Resize using a pixel area count limit (@)
97void limitPixels(bool limitPixels_);
98bool limitPixels(void) const;
99
100// Width and height are expressed as percentages
101void percent(bool percent_);
102bool percent(void) const;
103
104// Width
105void width(size_t width_);
106size_t width(void) const;
107
108// X offset from origin
109void xOff(::ssize_t xOff_);
110 ::ssize_t xOff(void) const;
111
112// Y offset from origin
113void yOff(::ssize_t yOff_);
114 ::ssize_t yOff(void) const;
115
116//
117// Public methods below this point are for Magick++ use only.
118//
119
120// Construct from RectangleInfo
121Geometry(const MagickCore::RectangleInfo &rectangle_);
122
123// Set via RectangleInfo
124const Geometry& operator=(const MagickCore::RectangleInfo &rectangle_);
125
126// Return an ImageMagick RectangleInfo struct
127operator MagickCore::RectangleInfo() const;
128
129private:
130size_t _width;
131size_t _height;
132 ::ssize_t _xOff;
133 ::ssize_t _yOff;
134bool _isValid;
135bool _percent; // Interpret width & height as percentages (%)
136bool _aspect; // Force exact size (!)
137bool _greater; // Resize only if larger than geometry (>)
138bool _less; // Resize only if smaller than geometry (<)
139bool _fillArea; // Resize the image based on the smallest fitting dimension (^)
140bool _limitPixels; // Resize using a pixel area count limit (@)
141 };
142
143class MagickPPExport Offset;
144
145// Compare two Offset objects
146MagickPPExport int operator ==
147 (const Magick::Offset& left_,const Magick::Offset& right_);
148MagickPPExport int operator !=
149 (const Magick::Offset& left_,const Magick::Offset& right_);
150
151class MagickPPExport Offset
152 {
153public:
154
155// Default constructor
156Offset();
157
158// Construct Offset from specified string
159Offset(const char *offset_);
160
161// Copy constructor
162Offset(const Offset &offset_);
163
164// Construct Offset from specified string
165Offset(const std::string &offset_);
166
167// Construct Offset from specified x and y
168Offset(ssize_t x_,ssize_t y_);
169
170// Destructor
171 ~Offset(void);
172
173// Set via offset string
174const Offset& operator=(const char *offset_);
175
176// Assignment operator
177Offset& operator=(const Offset& offset_);
178
179// Set via offset string
180const Offset& operator=(const std::string &offset_);
181
182// X offset from origin
183 ssize_t x(void) const;
184
185// Y offset from origin
186 ssize_t y(void) const;
187
188//
189// Public methods below this point are for Magick++ use only.
190//
191
192// Return an ImageMagick OffsetInfo struct
193operator MagickCore::OffsetInfo() const;
194
195private:
196 ssize_t _x;
197 ssize_t _y;
198 };
199
200class MagickPPExport Point;
201
202// Compare two Point objects
203MagickPPExport int operator ==
204 (const Magick::Point& left_,const Magick::Point& right_);
205MagickPPExport int operator !=
206 (const Magick::Point& left_,const Magick::Point& right_);
207
208class MagickPPExport Point
209 {
210public:
211
212// Default constructor
213Point();
214
215// Construct Point from specified string
216Point(const char *point_);
217
218// Copy constructor
219Point(const Point &point_);
220
221// Construct Point from specified string
222Point(const std::string &point_);
223
224// Construct Point from specified x and y
225Point(double x_,double y_);
226
227// Construct Point from specified x y
228Point(double xy_);
229
230// Destructor
231 ~Point(void);
232
233// Set via point string
234const Point& operator=(const char *point_);
235
236// Set via double value
237const Point& operator=(double xy_);
238
239// Assignment operator
240Point& operator=(const Point& point_);
241
242// Set via point string
243const Point& operator=(const std::string &point_);
244
245// Return point string
246operator std::string() const;
247
248// Does object contain valid point?
249bool isValid() const;
250
251// X offset from origin
252double x(void) const;
253
254// Y offset from origin
255double y(void) const;
256
257private:
258double _x;
259double _y;
260 };
261 } // namespace Magick
262
263 #endif // Magick_Geometry_header
Definition: Geometry.h:208
class MagickPPExport Offset
Definition: Geometry.h:143
#define MagickPPExport
Definition: Include.h:297
class MagickPPExport Geometry
Definition: Geometry.h:21
Definition: Geometry.h:151
Definition: Geometry.h:37
class MagickPPExport Point
Definition: Geometry.h:200
Definition: Blob.h:17