Powered by Pair ImageMagick logo
Image Magick
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

Magick::Geometry Class Reference

#include <Geometry.h>

Collaboration diagram for Magick::Geometry:

Collaboration graph
[legend]

Public Member Functions

 Geometry (unsigned int width_, unsigned int height_, unsigned int xOff_=0, unsigned int yOff_=0, bool xNegative_=false, bool yNegative_=false)
 Geometry (const std::string &geometry_)
 Geometry (const char *geometry_)
 Geometry (const Geometry &geometry_)
 Geometry ()
 ~Geometry (void)
void width (unsigned int width_)
unsigned int width (void) const
void height (unsigned int height_)
unsigned int height (void) const
void xOff (unsigned int xOff_)
unsigned int xOff (void) const
void yOff (unsigned int yOff_)
unsigned int yOff (void) const
void xNegative (bool xNegative_)
bool xNegative (void) const
void yNegative (bool yNegative_)
bool yNegative (void) const
void percent (bool percent_)
bool percent (void) const
void aspect (bool aspect_)
bool aspect (void) const
void greater (bool greater_)
bool greater (void) const
void less (bool less_)
bool less (void) const
void isValid (bool isValid_)
bool isValid (void) const
const Geometryoperator= (const std::string &geometry_)
const Geometryoperator= (const char *geometry_)
Geometryoperator= (const Geometry &Geometry_)
 operator std::string () const
 Geometry (const MagickLib::RectangleInfo &rectangle_)
 operator MagickLib::RectangleInfo () const
 Geometry (unsigned int width_, unsigned int height_, unsigned int xOff_=0, unsigned int yOff_=0, bool xNegative_=false, bool yNegative_=false)
 Geometry (const std::string &geometry_)
 Geometry (const char *geometry_)
 Geometry (const Geometry &geometry_)
 Geometry ()
 ~Geometry (void)
void width (unsigned int width_)
unsigned int width (void) const
void height (unsigned int height_)
unsigned int height (void) const
void xOff (unsigned int xOff_)
unsigned int xOff (void) const
void yOff (unsigned int yOff_)
unsigned int yOff (void) const
void xNegative (bool xNegative_)
bool xNegative (void) const
void yNegative (bool yNegative_)
bool yNegative (void) const
void percent (bool percent_)
bool percent (void) const
void aspect (bool aspect_)
bool aspect (void) const
void greater (bool greater_)
bool greater (void) const
void less (bool less_)
bool less (void) const
void isValid (bool isValid_)
bool isValid (void) const
const Geometryoperator= (const std::string &geometry_)
const Geometryoperator= (const char *geometry_)
Geometryoperator= (const Geometry &Geometry_)
 operator std::string () const
 Geometry (const MagickLib::RectangleInfo &rectangle_)
 operator MagickLib::RectangleInfo () const

Private Attributes

unsigned int _width
unsigned int _height
unsigned int _xOff
unsigned int _yOff
bool _xNegative
bool _yNegative
bool _isValid
bool _percent
bool _aspect
bool _greater
bool _less

Constructor & Destructor Documentation

Magick::Geometry::Geometry unsigned int  width_,
unsigned int  height_,
unsigned int  xOff_ = 0,
unsigned int  yOff_ = 0,
bool  xNegative_ = false,
bool  yNegative_ = false
 

Definition at line 69 of file Geometry.cpp.

00075 : _width( width_ ), 00076 _height( height_ ), 00077 _xOff( xOff_ ), 00078 _yOff( yOff_ ), 00079 _xNegative( xNegative_ ), 00080 _yNegative( yNegative_ ), 00081 _isValid( true ), 00082 _percent( false ), 00083 _aspect( false ), 00084 _greater( false ), 00085 _less( false ) 00086 { 00087 }

Magick::Geometry::Geometry const std::string &  geometry_  ) 
 

Definition at line 90 of file Geometry.cpp.

00091 : _width( 0 ), 00092 _height( 0 ), 00093 _xOff( 0 ), 00094 _yOff( 0 ), 00095 _xNegative( false ), 00096 _yNegative( false ), 00097 _isValid( false ), 00098 _percent( false ), 00099 _aspect( false ), 00100 _greater( false ), 00101 _less( false ) 00102 { 00103 *this = geometry_; // Use assignment operator 00104 }

Magick::Geometry::Geometry const char *  geometry_  ) 
 

Definition at line 108 of file Geometry.cpp.

00109 : _width( 0 ), 00110 _height( 0 ), 00111 _xOff( 0 ), 00112 _yOff( 0 ), 00113 _xNegative( false ), 00114 _yNegative( false ), 00115 _isValid( false ), 00116 _percent( false ), 00117 _aspect( false ), 00118 _greater( false ), 00119 _less( false ) 00120 { 00121 *this = geometry_; // Use assignment operator 00122 }

Magick::Geometry::Geometry const Geometry geometry_  ) 
 

Definition at line 125 of file Geometry.cpp.

00126 : _width( geometry_._width ), 00127 _height( geometry_._height ), 00128 _xOff( geometry_._xOff ), 00129 _yOff( geometry_._yOff ), 00130 _xNegative( geometry_._xNegative ), 00131 _yNegative( geometry_._yNegative ), 00132 _isValid ( geometry_._isValid ), 00133 _percent( geometry_._percent ), 00134 _aspect( geometry_._aspect ), 00135 _greater( geometry_._greater ), 00136 _less( geometry_._less ) 00137 { 00138 }

Magick::Geometry::Geometry  ) 
 

Definition at line 141 of file Geometry.cpp.

Referenced by operator=().

00142 : _width( 0 ), 00143 _height( 0 ), 00144 _xOff( 0 ), 00145 _yOff( 0 ), 00146 _xNegative( false ), 00147 _yNegative( false ), 00148 _isValid ( false ), 00149 _percent( false ), 00150 _aspect( false ), 00151 _greater( false ), 00152 _less( false ) 00153 { 00154 }

Magick::Geometry::~Geometry void   ) 
 

Definition at line 156 of file Geometry.cpp.

00157 { 00158 // Nothing to do 00159 }

Magick::Geometry::Geometry const MagickLib::RectangleInfo rectangle_  ) 
 

Definition at line 328 of file Geometry.cpp.

References AbsoluteValue.

00329 : _width(static_cast<unsigned int>(rectangle_.width)), 00330 _height(static_cast<unsigned int>(rectangle_.height)), 00331 _xOff(static_cast<unsigned int>(AbsoluteValue(rectangle_.x))), 00332 _yOff(static_cast<unsigned int>(AbsoluteValue(rectangle_.y))), 00333 _xNegative(rectangle_.x < 0 ? true : false), 00334 _yNegative(rectangle_.y < 0 ? true : false), 00335 _isValid(true), 00336 _percent(false), 00337 _aspect(false), 00338 _greater(false), 00339 _less(false) 00340 { 00341 }

Magick::Geometry::Geometry unsigned int  width_,
unsigned int  height_,
unsigned int  xOff_ = 0,
unsigned int  yOff_ = 0,
bool  xNegative_ = false,
bool  yNegative_ = false
 

Magick::Geometry::Geometry const std::string &  geometry_  ) 
 

Magick::Geometry::Geometry const char *  geometry_  ) 
 

Magick::Geometry::Geometry const Geometry geometry_  ) 
 

Magick::Geometry::Geometry  ) 
 

Magick::Geometry::~Geometry void   ) 
 

Magick::Geometry::Geometry const MagickLib::RectangleInfo rectangle_  ) 
 


Member Function Documentation

bool Magick::Geometry::aspect void   )  const
 

void Magick::Geometry::aspect bool  aspect_  ) 
 

bool Magick::Geometry::aspect void   )  const [inline]
 

Definition at line 215 of file Geometry.h.

References _aspect.

00216 { 00217 return _aspect; 00218 }

void Magick::Geometry::aspect bool  aspect_  )  [inline]
 

Definition at line 211 of file Geometry.h.

References _aspect.

Referenced by Magick::operator==().

00212 { 00213 _aspect = aspect_; 00214 }

bool Magick::Geometry::greater void   )  const
 

void Magick::Geometry::greater bool  greater_  ) 
 

bool Magick::Geometry::greater void   )  const [inline]
 

Definition at line 225 of file Geometry.h.

References _greater.

00226 { 00227 return _greater; 00228 }

void Magick::Geometry::greater bool  greater_  )  [inline]
 

Definition at line 221 of file Geometry.h.

References _greater.

Referenced by Magick::operator==().

00222 { 00223 _greater = greater_; 00224 }

unsigned int Magick::Geometry::height void   )  const
 

void Magick::Geometry::height unsigned int  height_  ) 
 

unsigned int Magick::Geometry::height void   )  const [inline]
 

Definition at line 155 of file Geometry.h.

References _height.

00156 { 00157 return _height; 00158 }

void Magick::Geometry::height unsigned int  height_  )  [inline]
 

Definition at line 151 of file Geometry.h.

References _height.

Referenced by Magick::Image::annotate(), Magick::Image::density(), Magick::Image::frame(), Magick::operator<(), Magick::operator==(), and Magick::Image::size().

00152 { 00153 _height = height_; 00154 }

bool Magick::Geometry::isValid void   )  const
 

void Magick::Geometry::isValid bool  isValid_  ) 
 

bool Magick::Geometry::isValid void   )  const [inline]
 

Definition at line 134 of file Geometry.h.

References _isValid.

Referenced by operator std::string(), operator=(), and width().

00135 { 00136 return _isValid; 00137 }

void Magick::Geometry::isValid bool  isValid_  )  [inline]
 

Definition at line 129 of file Geometry.h.

References _isValid.

Referenced by Magick::Image::annotate(), Magick::Options::density(), Magick::Image::density(), Magick::transformImage::operator()(), Magick::operator==(), Magick::Options::page(), Magick::Options::size(), Magick::MontageFramed::updateMontageInfo(), and Magick::Montage::updateMontageInfo().

00130 { 00131 _isValid = isValid_; 00132 }

bool Magick::Geometry::less void   )  const
 

void Magick::Geometry::less bool  less_  ) 
 

bool Magick::Geometry::less void   )  const [inline]
 

Definition at line 235 of file Geometry.h.

References _less.

00236 { 00237 return _less; 00238 }

void Magick::Geometry::less bool  less_  )  [inline]
 

Definition at line 231 of file Geometry.h.

References _less.

Referenced by Magick::operator==().

00232 { 00233 _less = less_; 00234 }

Magick::Geometry::operator MagickLib::RectangleInfo  )  const
 

Magick::Geometry::operator MagickLib::RectangleInfo  )  const
 

Definition at line 344 of file Geometry.cpp.

References _height, _width, _xNegative, _xOff, _yNegative, _yOff, _RectangleInfo::height, RectangleInfo, _RectangleInfo::width, _RectangleInfo::x, and _RectangleInfo::y.

00345 { 00346 RectangleInfo rectangle; 00347 rectangle.width = _width; 00348 rectangle.height = _height; 00349 _xNegative ? rectangle.x = static_cast<long>(0-_xOff) : rectangle.x = static_cast<long>(_xOff); 00350 _yNegative ? rectangle.y = static_cast<long>(0-_yOff) : rectangle.y = static_cast<long>(_yOff); 00351 return rectangle; 00352 }

Magick::Geometry::operator std::string  )  const
 

Magick::Geometry::operator std::string  )  const
 

Definition at line 270 of file Geometry.cpp.

References _aspect, _greater, _height, _less, _percent, _width, _xNegative, _xOff, _yNegative, _yOff, FormatString(), isValid(), OptionError, and Magick::throwExceptionExplicit().

00271 { 00272 if (!isValid()) 00273 { 00274 throwExceptionExplicit( OptionError, "Invalid geometry argument" ); 00275 } 00276 00277 string geometry; 00278 char buffer[32]; 00279 00280 if ( _width ) 00281 { 00282 FormatString( buffer, "%u", _width ); 00283 geometry += buffer; 00284 } 00285 00286 if ( _width && _height ) 00287 { 00288 FormatString( buffer, "%u", _height); 00289 geometry += 'x'; 00290 geometry += buffer; 00291 } 00292 00293 if ( _xOff || _yOff ) 00294 { 00295 if ( _xNegative ) 00296 geometry += '-'; 00297 else 00298 geometry += '+'; 00299 00300 FormatString( buffer, "%u", _xOff); 00301 geometry += buffer; 00302 00303 if ( _yNegative ) 00304 geometry += '-'; 00305 else 00306 geometry += '+'; 00307 00308 FormatString( buffer, "%u", _yOff); 00309 geometry += buffer; 00310 } 00311 00312 if ( _percent ) 00313 geometry += '%'; 00314 00315 if ( _aspect ) 00316 geometry += '!'; 00317 00318 if ( _greater ) 00319 geometry += '>'; 00320 00321 if ( _less ) 00322 geometry += '<'; 00323 00324 return geometry; 00325 }

Here is the call graph for this function:

Geometry& Magick::Geometry::operator= const Geometry Geometry_  ) 
 

const Geometry& Magick::Geometry::operator= const char *  geometry_  ) 
 

const Geometry& Magick::Geometry::operator= const std::string &  geometry_  ) 
 

Magick::Geometry & Magick::Geometry::operator= const Geometry Geometry_  ) 
 

Definition at line 161 of file Geometry.cpp.

References _aspect, _greater, _height, _isValid, _less, _percent, _width, _xNegative, _xOff, _yNegative, and _yOff.

00162 { 00163 // If not being set to ourself 00164 if ( this != &geometry_ ) 00165 { 00166 _width = geometry_._width; 00167 _height = geometry_._height; 00168 _xOff = geometry_._xOff; 00169 _yOff = geometry_._yOff; 00170 _xNegative = geometry_._xNegative; 00171 _yNegative = geometry_._yNegative; 00172 _isValid = geometry_._isValid; 00173 _percent = geometry_._percent; 00174 _aspect = geometry_._aspect; 00175 _greater = geometry_._greater; 00176 _less = geometry_._less; 00177 } 00178 return *this; 00179 }

const Magick::Geometry & Magick::Geometry::operator= const char *  geometry_  ) 
 

Definition at line 263 of file Geometry.cpp.

00264 { 00265 *this = std::string(geometry_); 00266 return *this; 00267 }

const Magick::Geometry & Magick::Geometry::operator= const std::string &  geometry_  ) 
 

Definition at line 183 of file Geometry.cpp.

References _aspect, _greater, _height, _less, _percent, _width, _xNegative, _xOff, _yNegative, _yOff, AbsoluteValue, AspectValue, Geometry(), GetGeometry(), GetPageGeometry(), GreaterValue, HeightValue, isValid(), LessValue, MaxTextExtent, NoValue, PercentValue, RelinquishMagickMemory(), WidthValue, XNegative, XValue, YNegative, and YValue.

00184 { 00185 char 00186 geom[MaxTextExtent]; 00187 00188 // If argument does not start with digit, presume that it is a 00189 // page-size specification that needs to be converted to an 00190 // equivalent geometry specification using PostscriptGeometry() 00191 strcpy(geom,geometry_.c_str()); 00192 if ( geom[0] != '-' && 00193 geom[0] != '+' && 00194 geom[0] != 'x' && 00195 !isdigit(static_cast<int>(geom[0]))) 00196 { 00197 char *pageptr = GetPageGeometry( geom ); 00198 if ( pageptr != 0 ) 00199 { 00200 strcpy(geom,pageptr); 00201 pageptr=(char *) RelinquishMagickMemory( pageptr ); 00202 } 00203 } 00204 00205 long x = 0; 00206 long y = 0; 00207 unsigned long width_val = 0; 00208 unsigned long height_val = 0; 00209 int flags = GetGeometry (geom, &x, &y, &width_val, &height_val ); 00210 00211 if (flags == NoValue) 00212 { 00213 // Total failure! 00214 *this=Geometry(); 00215 isValid( false ); 00216 return *this; 00217 } 00218 00219 if ( ( flags & WidthValue ) != 0 ) 00220 { 00221 _width = width_val; 00222 isValid( true ); 00223 } 00224 00225 if ( ( flags & HeightValue ) != 0 ) 00226 _height = height_val; 00227 00228 if ( ( flags & XValue ) != 0 ) 00229 { 00230 _xOff = static_cast<unsigned int>(AbsoluteValue(x)); 00231 isValid( true ); 00232 } 00233 00234 if ( ( flags & YValue ) != 0 ) 00235 { 00236 _yOff = static_cast<unsigned int>(AbsoluteValue(y)); 00237 isValid( true ); 00238 } 00239 00240 if ( ( flags & XNegative ) != 0 ) 00241 _xNegative = true; 00242 00243 if ( ( flags & YNegative ) != 0 ) 00244 _yNegative = true; 00245 00246 if ( ( flags & PercentValue ) != 0 ) 00247 _percent = true; 00248 00249 if ( ( flags & AspectValue ) != 0 ) 00250 _aspect = true; 00251 00252 if ( ( flags & LessValue ) != 0 ) 00253 _less = true; 00254 00255 if ( ( flags & GreaterValue ) != 0 ) 00256 _greater = true; 00257 00258 return *this; 00259 }

Here is the call graph for this function:

bool Magick::Geometry::percent void   )  const
 

void Magick::Geometry::percent bool  percent_  ) 
 

bool Magick::Geometry::percent void   )  const [inline]
 

Definition at line 205 of file Geometry.h.

References _percent.

00206 { 00207 return _percent; 00208 }

void Magick::Geometry::percent bool  percent_  )  [inline]
 

Definition at line 201 of file Geometry.h.

References _percent.

Referenced by Magick::operator==().

00202 { 00203 _percent = percent_; 00204 }

unsigned int Magick::Geometry::width void   )  const
 

void Magick::Geometry::width unsigned int  width_  ) 
 

unsigned int Magick::Geometry::width void   )  const [inline]
 

Definition at line 145 of file Geometry.h.

References _width.

00146 { 00147 return _width; 00148 }

void Magick::Geometry::width unsigned int  width_  )  [inline]
 

Definition at line 140 of file Geometry.h.

References _width, and isValid().

Referenced by Magick::Image::annotate(), Magick::Image::density(), Magick::Image::frame(), Magick::operator<(), Magick::operator==(), and Magick::Image::size().

00141 { 00142 _width = width_; 00143 isValid( true ); 00144 }

Here is the call graph for this function:

bool Magick::Geometry::xNegative void   )  const
 

void Magick::Geometry::xNegative bool  xNegative_  ) 
 

bool Magick::Geometry::xNegative void   )  const [inline]
 

Definition at line 185 of file Geometry.h.

References _xNegative.

00186 { 00187 return _xNegative; 00188 }

void Magick::Geometry::xNegative bool  xNegative_  )  [inline]
 

Definition at line 181 of file Geometry.h.

References _xNegative.

Referenced by Magick::operator==(), and Magick::Image::roll().

00182 { 00183 _xNegative = xNegative_; 00184 }

unsigned int Magick::Geometry::xOff void   )  const
 

void Magick::Geometry::xOff unsigned int  xOff_  ) 
 

unsigned int Magick::Geometry::xOff void   )  const [inline]
 

Definition at line 165 of file Geometry.h.

References _xOff.

00166 { 00167 return _xOff; 00168 }

void Magick::Geometry::xOff unsigned int  xOff_  )  [inline]
 

Definition at line 161 of file Geometry.h.

References _xOff.

Referenced by Magick::Image::annotate(), Magick::Image::composite(), Magick::Image::floodFillTexture(), Magick::Image::frame(), Magick::operator==(), and Magick::Image::roll().

00162 { 00163 _xOff = xOff_; 00164 }

bool Magick::Geometry::yNegative void   )  const
 

void Magick::Geometry::yNegative bool  yNegative_  ) 
 

bool Magick::Geometry::yNegative void   )  const [inline]
 

Definition at line 195 of file Geometry.h.

References _yNegative.

00196 { 00197 return _yNegative; 00198 }

void Magick::Geometry::yNegative bool  yNegative_  )  [inline]
 

Definition at line 191 of file Geometry.h.

References _yNegative.

Referenced by Magick::operator==(), and Magick::Image::roll().

00192 { 00193 _yNegative = yNegative_; 00194 }

unsigned int Magick::Geometry::yOff void   )  const
 

void Magick::Geometry::yOff unsigned int  yOff_  ) 
 

unsigned int Magick::Geometry::yOff void   )  const [inline]
 

Definition at line 175 of file Geometry.h.

References _yOff.

00176 { 00177 return _yOff; 00178 }

void Magick::Geometry::yOff unsigned int  yOff_  )  [inline]
 

Definition at line 171 of file Geometry.h.

References _yOff.

Referenced by Magick::Image::annotate(), Magick::Image::composite(), Magick::Image::floodFillTexture(), Magick::Image::frame(), Magick::operator==(), and Magick::Image::roll().

00172 { 00173 _yOff = yOff_; 00174 }


Field Documentation

bool Magick::Geometry::_aspect [private]
 

Definition at line 118 of file Geometry.h.

Referenced by aspect(), operator std::string(), and operator=().

bool Magick::Geometry::_greater [private]
 

Definition at line 119 of file Geometry.h.

Referenced by greater(), operator std::string(), and operator=().

unsigned int Magick::Geometry::_height [private]
 

Definition at line 111 of file Geometry.h.

Referenced by