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

ImageMagick-6.1.1/Magick++/lib/Magick++/Drawable.h

Go to the documentation of this file.
00001 // This may look like C code, but it is really -*- C++ -*- 00002 // 00003 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002 00004 // 00005 // Definition of Drawable (Graphic objects) 00006 // 00007 // The technique used for instantiating classes which derive from STL 00008 // templates is described in Microsoft MSDN Article ID: Q168958 00009 // "HOWTO: Exporting STL Components Inside & Outside of a Class". 00010 // 00011 00012 #if !defined(Magick_Drawable_header) 00013 #define Magick_Drawable_header 00014 00015 #include "Magick++/Include.h" 00016 00017 #include <functional> 00018 #include <string> 00019 #include <list> 00020 #include <utility> 00021 #include "Magick++/Color.h" 00022 #include "Magick++/Geometry.h" 00023 00024 #if defined(MagickDLLBuild) 00025 # if defined(MAGICK_DRAWABLE_IMPLEMENTATION) 00026 # define MagickDrawableExtern 00027 # else 00028 # pragma warning( disable: 4231 ) // Disable warning regarding using extern 00029 # define MagickDrawableExtern extern 00030 # endif // MAGICK_DRAWABLE_IMPLEMENTATION 00031 #else 00032 # define MagickDrawableExtern 00033 #endif // MagickDLLBuild 00034 00035 namespace Magick 00036 { 00037 00038 // 00039 // Representation of an x,y coordinate 00040 // 00041 class MagickDLLDecl Coordinate 00042 { 00043 public: 00044 Coordinate ( void ) 00045 : _x(0), 00046 _y(0) 00047 { } 00048 Coordinate ( double x_, double y_ ) 00049 : _x(x_), 00050 _y(y_) 00051 { } 00052 virtual ~Coordinate () 00053 { } 00054 00055 void x ( double x_ ) 00056 { 00057 _x = x_; 00058 } 00059 double x ( void ) const 00060 { 00061 return _x; 00062 } 00063 00064 void y ( double y_ ) 00065 { 00066 _y = y_; 00067 } 00068 double y ( void ) const 00069 { 00070 return _y; 00071 } 00072 00073 private: 00074 double _x; 00075 double _y; 00076 }; 00077 00078 typedef std::list<Magick::Coordinate> CoordinateList; 00079 00080 #if defined(MagickDLLBuild) 00081 00082 MagickDrawableExtern template class MagickDLLDecl 00083 std::allocator<Magick::Coordinate>; 00084 00085 MagickDrawableExtern template class MagickDLLDecl 00086 std::list<Magick::Coordinate, std::allocator<Magick::Coordinate> >; 00087 00088 #endif // MagickDLLBuild 00089 00090 // Compare two Coordinate objects regardless of LHS/RHS 00091 MagickDLLDeclExtern int operator == ( const Coordinate& left_, 00092 const Coordinate& right_ ); 00093 MagickDLLDeclExtern int operator != ( const Coordinate& left_, 00094 const Coordinate& right_ ); 00095 MagickDLLDeclExtern int operator > ( const Coordinate& left_, 00096 const Coordinate& right_ ); 00097 MagickDLLDeclExtern int operator < ( const Coordinate& left_, 00098 const Coordinate& right_ ); 00099 MagickDLLDeclExtern int operator >= ( const Coordinate& left_, 00100 const Coordinate& right_ ); 00101 MagickDLLDeclExtern int operator <= ( const Coordinate& left_, 00102 const Coordinate& right_ ); 00103 00104 // 00105 // Base class for all drawable objects 00106 // 00107 //struct MagickDLLDecl std::unary_function<MagickLib::DrawContext,void>; 00108 class MagickDLLDecl DrawableBase: 00109 public std::unary_function<MagickLib::DrawContext,void> 00110 { 00111 public: 00112 // Constructor 00113 DrawableBase ( void ) 00114 { } 00115 00116 // Destructor 00117 virtual ~DrawableBase ( void ); 00118 00119 // Operator to invoke equivalent draw API call 00120 virtual void operator()( MagickLib::DrawContext ) const = 0; 00121 00122 // Return polymorphic copy of object 00123 virtual DrawableBase* copy() const = 0; 00124 00125 private: 00126 }; 00127 00128 // 00129 // Representation of a drawable surrogate object to manage drawable objects 00130 // 00131 #undef Drawable // Conflict with <X11/Xproto.h> 00132 class MagickDLLDecl Drawable 00133 { 00134 public: 00135 00136 // Constructor 00137 Drawable ( void ); 00138 00139 // Construct from DrawableBase 00140 Drawable ( const DrawableBase& original_ ); 00141 00142 // Destructor 00143 ~Drawable ( void ); 00144 00145 // Copy constructor 00146 Drawable ( const Drawable& original_ ); 00147 00148 // Assignment operator 00149 Drawable& operator= (const Drawable& original_ ); 00150 00151 // Operator to invoke contained object 00152 void operator()( MagickLib::DrawContext context_ ) const; 00153 00154 private: 00155 DrawableBase* dp; 00156 }; 00157 00158 // Compare two Drawable objects regardless of LHS/RHS 00159 MagickDLLDeclExtern int operator == ( const Drawable& left_, 00160 const Drawable& right_ ); 00161 MagickDLLDeclExtern int operator != ( const Drawable& left_, 00162 const Drawable& right_ ); 00163 MagickDLLDeclExtern int operator > ( const Drawable& left_, 00164 const Drawable& right_ ); 00165 MagickDLLDeclExtern int operator < ( const Drawable& left_, 00166 const Drawable& right_ ); 00167 MagickDLLDeclExtern int operator >= ( const Drawable& left_, 00168 const Drawable& right_ ); 00169 MagickDLLDeclExtern int operator <= ( const Drawable& left_, 00170 const Drawable& right_ ); 00171 00172 typedef std::list<Magick::Drawable> DrawableList; 00173 00174 #if defined(MagickDLLBuild) 00175 00176 MagickDrawableExtern template class MagickDLLDecl 00177 std::allocator<Magick::Drawable>; 00178 00179 MagickDrawableExtern template class MagickDLLDecl 00180 std::list<Magick::Drawable, std::allocator<Magick::Drawable> >; 00181 00182 #endif // MagickDLLBuild 00183 00184 // 00185 // Base class for all drawable path elements for use with 00186 // DrawablePath 00187 // 00188 class MagickDLLDecl VPathBase 00189 { 00190 public: 00191 // Constructor 00192 VPathBase ( void ) 00193 { } 00194 00195 // Destructor 00196 virtual ~VPathBase ( void ); 00197 00198 // Assignment operator 00199 // const VPathBase& operator= (const VPathBase& original_ ); 00200 00201 // Operator to invoke equivalent draw API call 00202 virtual void operator()( MagickLib::DrawContext context_ ) const = 0; 00203 00204 // Return polymorphic copy of object 00205 virtual VPathBase* copy() const = 0; 00206 }; 00207 00208 // 00209 // Representation of a drawable path element surrogate object to 00210 // manage drawable path elements so they may be passed as a list to 00211 // DrawablePath. 00212 // 00213 class MagickDLLDecl VPath 00214 { 00215 public: 00216 // Constructor 00217 VPath ( void ); 00218 00219 // Construct from VPathBase 00220 VPath ( const VPathBase& original_ ); 00221 00222 // Destructor 00223 virtual ~VPath ( void ); 00224 00225 // Copy constructor 00226 VPath ( const VPath& original_ ); 00227 00228 // Assignment operator 00229 VPath& operator= (const VPath& original_ ); 00230 00231 // Operator to invoke contained object 00232 void operator()( MagickLib::DrawContext context_ ) const; 00233 00234 private: 00235 VPathBase* dp; 00236 }; 00237 00238 // Compare two VPath objects regardless of LHS/RHS 00239 MagickDLLDeclExtern int operator == ( const VPath& left_, 00240 const VPath& right_ ); 00241 MagickDLLDeclExtern int operator != ( const VPath& left_, 00242 const VPath& right_ ); 00243 MagickDLLDeclExtern int operator > ( const VPath& left_, 00244 const VPath& right_ ); 00245 MagickDLLDeclExtern int operator < ( const VPath& left_, 00246 const VPath& right_ ); 00247 MagickDLLDeclExtern int operator >= ( const VPath& left_, 00248 const VPath& right_ ); 00249 MagickDLLDeclExtern int operator <= ( const VPath& left_, 00250 const VPath& right_ ); 00251 00252 typedef std::list<Magick::VPath> VPathList; 00253 00254 #if defined(MagickDLLBuild) 00255 00256 MagickDrawableExtern template class MagickDLLDecl 00257 std::allocator<Magick::VPath>; 00258 00259 MagickDrawableExtern template class MagickDLLDecl 00260 std::list<Magick::VPath, std::allocator<Magick::VPath> >; 00261 00262 #endif // MagickDLLBuild 00263 00264 // 00265 // Drawable Objects 00266 // 00267 00268 // Affine (scaling, rotation, and translation) 00269 class MagickDLLDecl DrawableAffine : public DrawableBase 00270 { 00271 public: 00272 DrawableAffine ( double sx_, double sy_, 00273 double rx_, double ry_, 00274 double tx_, double ty_ ); 00275 00276 DrawableAffine ( void ); 00277 00278 /*virtual*/ ~DrawableAffine( void ); 00279 00280 // Operator to invoke equivalent draw API call 00281 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00282 00283 // Return polymorphic copy of object 00284 /*virtual*/ 00285 DrawableBase* copy() const; 00286 00287 void sx( const double sx_ ) 00288 { 00289 _affine.sx = sx_; 00290 } 00291 double sx( void ) const 00292 { 00293 return _affine.sx; 00294 } 00295 00296 void sy( const double sy_ ) 00297 { 00298 _affine.sy = sy_; 00299 } 00300 double sy( void ) const 00301 { 00302 return _affine.sy; 00303 } 00304 00305 void rx( const double rx_ ) 00306 { 00307 _affine.rx = rx_; 00308 } 00309 double rx( void ) const 00310 { 00311 return _affine.rx; 00312 } 00313 00314 void ry( const double ry_ ) 00315 { 00316 _affine.ry = ry_; 00317 } 00318 double ry( void ) const 00319 { 00320 return _affine.ry; 00321 } 00322 00323 void tx( const double tx_ ) 00324 { 00325 _affine.tx = tx_; 00326 } 00327 double tx( void ) const 00328 { 00329 return _affine.tx; 00330 } 00331 00332 void ty( const double ty_ ) 00333 { 00334 _affine.ty = ty_; 00335 } 00336 double ty( void ) const 00337 { 00338 return _affine.ty; 00339 } 00340 00341 private: 00342 MagickLib::AffineMatrix _affine; 00343 }; 00344 00345 // Arc 00346 class MagickDLLDecl DrawableArc : public DrawableBase 00347 { 00348 public: 00349 DrawableArc ( double startX_, double startY_, 00350 double endX_, double endY_, 00351 double startDegrees_, double endDegrees_ ) 00352 : _startX(startX_), 00353 _startY(startY_), 00354 _endX(endX_), 00355 _endY(endY_), 00356 _startDegrees(startDegrees_), 00357 _endDegrees(endDegrees_) 00358 { } 00359 00360 /*virtual*/ ~DrawableArc( void ); 00361 00362 // Operator to invoke equivalent draw API call 00363 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00364 00365 // Return polymorphic copy of object 00366 /*virtual*/ DrawableBase* copy() const; 00367 00368 void startX( double startX_ ) 00369 { 00370 _startX = startX_; 00371 } 00372 double startX( void ) const 00373 { 00374 return _startX; 00375 } 00376 00377 void startY( double startY_ ) 00378 { 00379 _startY = startY_; 00380 } 00381 double startY( void ) const 00382 { 00383 return _startY; 00384 } 00385 00386 void endX( double endX_ ) 00387 { 00388 _endX = endX_; 00389 } 00390 double endX( void ) const 00391 { 00392 return _endX; 00393 } 00394 00395 void endY( double endY_ ) 00396 { 00397 _endY = endY_; 00398 } 00399 double endY( void ) const 00400 { 00401 return _endY; 00402 } 00403 00404 void startDegrees( double startDegrees_ ) 00405 { 00406 _startDegrees = startDegrees_; 00407 } 00408 double startDegrees( void ) const 00409 { 00410 return _startDegrees; 00411 } 00412 00413 void endDegrees( double endDegrees_ ) 00414 { 00415 _endDegrees = endDegrees_; 00416 } 00417 double endDegrees( void ) const 00418 { 00419 return _endDegrees; 00420 } 00421 00422 private: 00423 double _startX; 00424 double _startY; 00425 double _endX; 00426 double _endY; 00427 double _startDegrees; 00428 double _endDegrees; 00429 }; 00430 00431 // Bezier curve (Coordinate list must contain at least three members) 00432 class MagickDLLDecl DrawableBezier : public DrawableBase 00433 { 00434 public: 00435 // Construct from coordinates 00436 DrawableBezier ( const CoordinateList &coordinates_ ); 00437 00438 // Copy constructor 00439 DrawableBezier ( const DrawableBezier& original_ ); 00440 00441 // Destructor 00442 /*virtual*/ ~DrawableBezier ( void ); 00443 00444 // Operator to invoke equivalent draw API call 00445 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00446 00447 // Return polymorphic copy of object 00448 /*virtual*/ DrawableBase* copy() const; 00449 00450 private: 00451 CoordinateList _coordinates; 00452 }; 00453 00454 00455 // Pop (terminate) clip path definition 00456 class MagickDLLDecl DrawablePopClipPath : public DrawableBase 00457 { 00458 public: 00459 DrawablePopClipPath ( void ) 00460 : _dummy(0) 00461 { 00462 } 00463 00464 /*virtual*/ ~DrawablePopClipPath ( void ); 00465 00466 // Operator to invoke equivalent draw API call 00467 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00468 00469 // Return polymorphic copy of object 00470 /*virtual*/ DrawableBase* copy() const; 00471 00472 private: 00473 int _dummy; 00474 }; 00475 00476 // Push (create) Clip path definition 00477 class MagickDLLDecl DrawablePushClipPath : public DrawableBase 00478 { 00479 public: 00480 DrawablePushClipPath ( const std::string &id_); 00481 00482 DrawablePushClipPath ( const DrawablePushClipPath& original_ ); 00483 00484 /*virtual*/ ~DrawablePushClipPath ( void ); 00485 00486 // Operator to invoke equivalent draw API call 00487 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00488 00489 // Return polymorphic copy of object 00490 /*virtual*/ DrawableBase* copy() const; 00491 00492 private: 00493 std::string _id; 00494 }; 00495 00496 // Named Clip Path 00497 class MagickDLLDecl DrawableClipPath : public DrawableBase 00498 { 00499 public: 00500 DrawableClipPath ( const std::string &id_ ); 00501 DrawableClipPath ( const DrawableClipPath& original_ ); 00502 00503 /*virtual*/ ~DrawableClipPath ( void ); 00504 00505 // Operator to invoke equivalent draw API call 00506 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00507 00508 // Return polymorphic copy of object 00509 /*virtual*/ DrawableBase* copy() const; 00510 00511 void clip_path( const std::string &id_ ) 00512 { 00513 _id = id_.c_str(); //multithread safe 00514 } 00515 std::string clip_path( void ) const 00516 { 00517 return _id; 00518 } 00519 00520 private: 00521 std::string _id; 00522 }; 00523 00524 // Circle 00525 class MagickDLLDecl DrawableCircle : public DrawableBase 00526 { 00527 public: 00528 DrawableCircle ( double originX_, double originY_, 00529 double perimX_, double perimY_ ) 00530 : _originX(originX_), 00531 _originY(originY_), 00532 _perimX(perimX_), 00533 _perimY(perimY_) 00534 { 00535 } 00536 00537 /*virtual*/ ~DrawableCircle ( void ); 00538 00539 // Operator to invoke equivalent draw API call 00540 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00541 00542 // Return polymorphic copy of object 00543 /*virtual*/ DrawableBase* copy() const; 00544 00545 void originX( double originX_ ) 00546 { 00547 _originX = originX_; 00548 } 00549 double originX( void ) const 00550 { 00551 return _originX; 00552 } 00553 00554 void originY( double originY_ ) 00555 { 00556 _originY = originY_; 00557 } 00558 double originY( void ) const 00559 { 00560 return _originY; 00561 } 00562 00563 void perimX( double perimX_ ) 00564 { 00565 _perimX = perimX_; 00566 } 00567 double perimX( void ) const 00568 { 00569 return _perimX; 00570 } 00571 00572 void perimY( double perimY_ ) 00573 { 00574 _perimY = perimY_; 00575 } 00576 double perimY( void ) const 00577 { 00578 return _perimY; 00579 } 00580 00581 private: 00582 double _originX; 00583 double _originY; 00584 double _perimX; 00585 double _perimY; 00586 }; 00587 00588 // Colorize at point using PaintMethod 00589 class MagickDLLDecl DrawableColor : public DrawableBase 00590 { 00591 public: 00592 DrawableColor ( double x_, double y_, 00593 PaintMethod paintMethod_ ) 00594 : _x(x_), 00595 _y(y_), 00596 _paintMethod(paintMethod_) 00597 { } 00598 00599 /*virtual*/ ~DrawableColor ( void ); 00600 00601 // Operator to invoke equivalent draw API call 00602 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00603 00604 // Return polymorphic copy of object 00605 /*virtual*/ DrawableBase* copy() const; 00606 00607 void x( double x_ ) 00608 { 00609 _x = x_; 00610 } 00611 double x( void ) const 00612 { 00613 return _x; 00614 } 00615 00616 void y( double y_ ) 00617 { 00618 _y = y_; 00619 } 00620 double y( void ) const 00621 { 00622 return _y; 00623 } 00624 00625 void paintMethod( PaintMethod paintMethod_ ) 00626 { 00627 _paintMethod = paintMethod_; 00628 } 00629 PaintMethod paintMethod( void ) const 00630 { 00631 return _paintMethod; 00632 } 00633 00634 private: 00635 double _x; 00636 double _y; 00637 PaintMethod _paintMethod; 00638 }; 00639 00640 // Draw image at point, scaled to size specified by width and height 00641 class MagickDLLDecl Image; 00642 class MagickDLLDecl DrawableCompositeImage : public DrawableBase 00643 { 00644 public: 00645 DrawableCompositeImage ( double x_, double y_, 00646 const std::string &filename_ ); 00647 00648 DrawableCompositeImage ( double x_, double y_, 00649 const Image &image_ ); 00650 00651 DrawableCompositeImage ( double x_, double y_, 00652 double width_, double height_, 00653 const std::string &filename_ ); 00654 00655 DrawableCompositeImage ( double x_, double y_, 00656 double width_, double height_, 00657 const Image &image_ ); 00658 00659 DrawableCompositeImage ( double x_, double y_, 00660 double width_, double height_, 00661 const std::string &filename_, 00662 CompositeOperator composition_ ); 00663 00664 DrawableCompositeImage ( double x_, double y_, 00665 double width_, double height_, 00666 const Image &image_, 00667 CompositeOperator composition_ ); 00668 00669 // Copy constructor 00670 DrawableCompositeImage ( const DrawableCompositeImage& original_ ); 00671 00672 // Destructor 00673 /*virtual*/ ~DrawableCompositeImage( void ); 00674 00675 // Assignment operator 00676 DrawableCompositeImage& operator= 00677 (const DrawableCompositeImage& original_ ); 00678 00679 // Operator to invoke equivalent draw API call 00680 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00681 00682 // Return polymorphic copy of object 00683 /*virtual*/ DrawableBase* copy() const; 00684 00685 void composition( CompositeOperator composition_ ) 00686 { 00687 _composition = composition_; 00688 } 00689 CompositeOperator composition( void ) const 00690 { 00691 return _composition; 00692 } 00693 00694 void filename( const std::string &image_ ); 00695 std::string filename( void ) const; 00696 00697 void x( double x_ ) 00698 { 00699 _x = x_; 00700 } 00701 double x( void ) const 00702 { 00703 return _x; 00704 } 00705 00706 void y( double y_ ) 00707 { 00708 _y = y_; 00709 } 00710 double y( void ) const 00711 { 00712 return _y; 00713 } 00714 00715 void width( double width_ ) 00716 { 00717 _width = width_; 00718 } 00719 double width( void ) const 00720 { 00721 return _width; 00722 } 00723 00724 void height( double height_ ) 00725 { 00726 _height = height_; 00727 } 00728 double height( void ) const 00729 { 00730 return _height; 00731 } 00732 00733 void image( const Image &image_ ); 00734 Magick::Image image( void ) const; 00735 00736 // Specify image format used to output Base64 inlined image data. 00737 void magick( std::string magick_ ); 00738 std::string magick( void ); 00739 00740 private: 00741 CompositeOperator _composition; 00742 double _x; 00743 double _y; 00744 double _width; 00745 double _height; 00746 Image* _image; 00747 }; 00748 00749 // Ellipse 00750 class MagickDLLDecl DrawableEllipse : public DrawableBase 00751 { 00752 public: 00753 DrawableEllipse ( double originX_, double originY_, 00754 double radiusX_, double radiusY_, 00755 double arcStart_, double arcEnd_ ) 00756 : _originX(originX_), 00757 _originY(originY_), 00758 _radiusX(radiusX_), 00759 _radiusY(radiusY_), 00760 _arcStart(arcStart_), 00761 _arcEnd(arcEnd_) 00762 { } 00763 00764 /*virtual*/ ~DrawableEllipse( void ); 00765 00766 // Operator to invoke equivalent draw API call 00767 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00768 00769 // Return polymorphic copy of object 00770 /*virtual*/ DrawableBase* copy() const; 00771 00772 void originX( double originX_ ) 00773 { 00774 _originX = originX_; 00775 } 00776 double originX( void ) const 00777 { 00778 return _originX; 00779 } 00780 00781 void originY( double originY_ ) 00782 { 00783 _originY = originY_; 00784 } 00785 double originY( void ) const 00786 { 00787 return _originY; 00788 } 00789 00790 void radiusX( double radiusX_ ) 00791 { 00792 _radiusX = radiusX_; 00793 } 00794 double radiusX( void ) const 00795 { 00796 return _radiusX; 00797 } 00798 00799 void radiusY( double radiusY_ ) 00800 { 00801 _radiusY = radiusY_; 00802 } 00803 double radiusY( void ) const 00804 { 00805 return _radiusY; 00806 } 00807 00808 void arcStart( double arcStart_ ) 00809 { 00810 _arcStart = arcStart_; 00811 } 00812 double arcStart( void ) const 00813 { 00814 return _arcStart; 00815 } 00816 00817 void arcEnd( double arcEnd_ ) 00818 { 00819 _arcEnd = arcEnd_; 00820 } 00821 double arcEnd( void ) const 00822 { 00823 return _arcEnd; 00824 } 00825 00826 private: 00827 double _originX; 00828 double _originY; 00829 double _radiusX; 00830 double _radiusY; 00831 double _arcStart; 00832 double _arcEnd; 00833 }; 00834 00835 // Specify drawing fill color 00836 class MagickDLLDecl DrawableFillColor : public DrawableBase 00837 { 00838 public: 00839 DrawableFillColor ( const Color &color_ ); 00840 00841 DrawableFillColor ( const DrawableFillColor& original_ ); 00842 00843 /*virtual*/ ~DrawableFillColor( void ); 00844 00845 // Operator to invoke equivalent draw API call 00846 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00847 00848 // Return polymorphic copy of object 00849 /*virtual*/ DrawableBase* copy() const; 00850 00851 void color( const Color &color_ ) 00852 { 00853 _color = color_; 00854 } 00855 Color color( void ) const 00856 { 00857 return _color; 00858 } 00859 00860 private: 00861 Color _color; 00862 }; 00863 00864 // Specify fill rule (fill-rule) 00865 class MagickDLLDecl DrawableFillRule : public DrawableBase 00866 { 00867 public: 00868 DrawableFillRule ( const FillRule fillRule_ ) 00869 : _fillRule(fillRule_) 00870 { 00871 } 00872 00873 /*virtual*/ ~DrawableFillRule ( void ); 00874 00875 // Operator to invoke equivalent draw API call 00876 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00877 00878 // Return polymorphic copy of object 00879 /*virtual*/ DrawableBase* copy() const; 00880 00881 void fillRule( const FillRule fillRule_ ) 00882 { 00883 _fillRule = fillRule_; 00884 } 00885 FillRule fillRule( void ) const 00886 { 00887 return _fillRule; 00888 } 00889 00890 private: 00891 FillRule _fillRule; 00892 }; 00893 00894 // Specify drawing fill opacity 00895 class MagickDLLDecl DrawableFillOpacity : public DrawableBase 00896 { 00897 public: 00898 DrawableFillOpacity ( double opacity_ ) 00899 : _opacity(opacity_) 00900 { 00901 } 00902 00903 /*virtual*/ ~DrawableFillOpacity ( void ); 00904 00905 // Operator to invoke equivalent draw API call 00906 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00907 00908 // Return polymorphic copy of object 00909 /*virtual*/ DrawableBase* copy() const; 00910 00911 void opacity( double opacity_ ) 00912 { 00913 _opacity = opacity_; 00914 } 00915 double opacity( void ) const 00916 { 00917 return _opacity; 00918 } 00919 00920 private: 00921 double _opacity; 00922 }; 00923 00924 // Specify text font 00925 class MagickDLLDecl DrawableFont : public DrawableBase 00926 { 00927 public: 00928 DrawableFont ( const std::string &font_ ); 00929 00930 DrawableFont ( const std::string &family_, 00931 StyleType style_, 00932 const unsigned long weight_, 00933 StretchType stretch_ ); 00934 DrawableFont ( const DrawableFont& original_ ); 00935 00936 /*virtual*/ ~DrawableFont ( void ); 00937 00938 // Operator to invoke equivalent draw API call 00939 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00940 00941 // Return polymorphic copy of object 00942 /*virtual*/ DrawableBase* copy() const; 00943 00944 void font( const std::string &font_ ) 00945 { 00946 _font = font_; 00947 } 00948 std::string font( void ) const 00949 { 00950 return _font; 00951 } 00952 00953 private: 00954 std::string _font; 00955 std::string _family; 00956 StyleType _style; 00957 unsigned long _weight; 00958 StretchType _stretch; 00959 }; 00960 00961 // Specify text positioning gravity 00962 class MagickDLLDecl DrawableGravity : public DrawableBase 00963 { 00964 public: 00965 DrawableGravity ( GravityType gravity_ ) 00966 : _gravity(gravity_) 00967 { 00968 } 00969 00970 /*virtual*/ ~DrawableGravity ( void ); 00971 00972 // Operator to invoke equivalent draw API call 00973 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 00974 00975 // Return polymorphic copy of object 00976 /*virtual*/ DrawableBase* copy() const; 00977 00978 void gravity( GravityType gravity_ ) 00979 { 00980 _gravity = gravity_; 00981 } 00982 GravityType gravity( void ) const 00983 { 00984 return _gravity; 00985 } 00986 00987 private: 00988 GravityType _gravity; 00989 }; 00990 00991 // Line 00992 class MagickDLLDecl DrawableLine : public DrawableBase 00993 { 00994 public: 00995 DrawableLine ( double startX_, double startY_, 00996 double endX_, double endY_ ) 00997 : _startX(startX_), 00998 _startY(startY_), 00999 _endX(endX_), 01000 _endY(endY_) 01001 { } 01002 01003 /*virtual*/ ~DrawableLine ( void ); 01004 01005 // Operator to invoke equivalent draw API call 01006 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01007 01008 // Return polymorphic copy of object 01009 /*virtual*/ DrawableBase* copy() const; 01010 01011 void startX( double startX_ ) 01012 { 01013 _startX = startX_; 01014 } 01015 double startX( void ) const 01016 { 01017 return _startX; 01018 } 01019 01020 void startY( double startY_ ) 01021 { 01022 _startY = startY_; 01023 } 01024 double startY( void ) const 01025 { 01026 return _startY; 01027 } 01028 01029 void endX( double endX_ ) 01030 { 01031 _endX = endX_; 01032 } 01033 double endX( void ) const 01034 { 01035 return _endX; 01036 } 01037 01038 void endY( double endY_ ) 01039 { 01040 _endY = endY_; 01041 } 01042 double endY( void ) const 01043 { 01044 return _endY; 01045 } 01046 01047 private: 01048 double _startX; 01049 double _startY; 01050 double _endX; 01051 double _endY; 01052 }; 01053 01054 // Change pixel matte value to transparent using PaintMethod 01055 class MagickDLLDecl DrawableMatte : public DrawableBase 01056 { 01057 public: 01058 DrawableMatte ( double x_, double y_, 01059 PaintMethod paintMethod_ ) 01060 : _x(x_), 01061 _y(y_), 01062 _paintMethod(paintMethod_) 01063 { } 01064 01065 /*virtual*/ ~DrawableMatte ( void ); 01066 01067 // Operator to invoke equivalent draw API call 01068 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01069 01070 // Return polymorphic copy of object 01071 /*virtual*/ DrawableBase* copy() const; 01072 01073 void x( double x_ ) 01074 { 01075 _x = x_; 01076 } 01077 double x( void ) const 01078 { 01079 return _x; 01080 } 01081 01082 void y( double y_ ) 01083 { 01084 _y = y_; 01085 } 01086 double y( void ) const 01087 { 01088 return _y; 01089 } 01090 01091 void paintMethod( PaintMethod paintMethod_ ) 01092 { 01093 _paintMethod = paintMethod_; 01094 } 01095 PaintMethod paintMethod( void ) const 01096 { 01097 return _paintMethod; 01098 } 01099 01100 private: 01101 double _x; 01102 double _y; 01103 PaintMethod _paintMethod; 01104 }; 01105 01106 // Drawable Path 01107 class MagickDLLDecl DrawablePath : public DrawableBase 01108 { 01109 public: 01110 DrawablePath ( const VPathList &path_ ); 01111 01112 DrawablePath ( const DrawablePath& original_ ); 01113 01114 /*virtual*/ ~DrawablePath ( void ); 01115 01116 // Operator to invoke equivalent draw API call 01117 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01118 01119 // Return polymorphic copy of object 01120 /*virtual*/ DrawableBase* copy() const; 01121 01122 private: 01123 VPathList _path; 01124 }; 01125 01126 // Point 01127 class MagickDLLDecl DrawablePoint : public DrawableBase 01128 { 01129 public: 01130 DrawablePoint ( double x_, double y_ ) 01131 : _x(x_), 01132 _y(y_) 01133 { } 01134 01135 /*virtual*/ ~DrawablePoint ( void ); 01136 01137 // Operator to invoke equivalent draw API call 01138 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01139 01140 // Return polymorphic copy of object 01141 /*virtual*/ DrawableBase* copy() const; 01142 01143 void x( double x_ ) 01144 { 01145 _x = x_; 01146 } 01147 double x( void ) const 01148 { 01149 return _x; 01150 } 01151 01152 void y( double y_ ) 01153 { 01154 _y = y_; 01155 } 01156 double y( void ) const 01157 { 01158 return _y; 01159 } 01160 01161 private: 01162 double _x; 01163 double _y; 01164 }; 01165 01166 // Text pointsize 01167 class MagickDLLDecl DrawablePointSize : public DrawableBase 01168 { 01169 public: 01170 DrawablePointSize ( double pointSize_ ) 01171 : _pointSize(pointSize_) 01172 { } 01173 01174 /*virtual*/ ~DrawablePointSize ( void ); 01175 01176 // Operator to invoke equivalent draw API call 01177 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01178 01179 // Return polymorphic copy of object 01180 /*virtual*/ DrawableBase* copy() const; 01181 01182 void pointSize( double pointSize_ ) 01183 { 01184 _pointSize = pointSize_; 01185 } 01186 double pointSize( void ) const 01187 { 01188 return _pointSize; 01189 } 01190 01191 private: 01192 double _pointSize; 01193 }; 01194 01195 // Polygon (Coordinate list must contain at least three members) 01196 class MagickDLLDecl DrawablePolygon : public DrawableBase 01197 { 01198 public: 01199 DrawablePolygon ( const CoordinateList &coordinates_ ); 01200 01201 DrawablePolygon ( const DrawablePolygon& original_ ); 01202 01203 /*virtual*/ ~DrawablePolygon ( void ); 01204 01205 // Operator to invoke equivalent draw API call 01206 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01207 01208 // Return polymorphic copy of object 01209 /*virtual*/ DrawableBase* copy() const; 01210 01211 private: 01212 CoordinateList _coordinates; 01213 }; 01214 01215 // Polyline (Coordinate list must contain at least three members) 01216 class MagickDLLDecl DrawablePolyline : public DrawableBase 01217 { 01218 public: 01219 DrawablePolyline ( const CoordinateList &coordinates_ ); 01220 01221 DrawablePolyline ( const DrawablePolyline& original_ ); 01222 01223 /*virtual*/ ~DrawablePolyline ( void ); 01224 01225 // Operator to invoke equivalent draw API call 01226 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01227 01228 // Return polymorphic copy of object 01229 /*virtual*/ DrawableBase* copy() const; 01230 01231 private: 01232 CoordinateList _coordinates; 01233 }; 01234 01235 // Pop Graphic Context 01236 class MagickDLLDecl DrawablePopGraphicContext : public DrawableBase 01237 { 01238 public: 01239 DrawablePopGraphicContext ( void ) 01240 : _dummy(0) 01241 { 01242 } 01243 01244 /*virtual*/ ~DrawablePopGraphicContext ( void ); 01245 01246 // Operator to invoke equivalent draw API call 01247 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01248 01249 // Return polymorphic copy of object 01250 /*virtual*/ DrawableBase* copy() const; 01251 01252 private: 01253 int _dummy; 01254 }; 01255 01256 // Push Graphic Context 01257 class MagickDLLDecl DrawablePushGraphicContext : public DrawableBase 01258 { 01259 public: 01260 DrawablePushGraphicContext ( void ) 01261 : _dummy(0) 01262 { 01263 } 01264 01265 /*virtual*/ ~DrawablePushGraphicContext ( void ); 01266 01267 // Operator to invoke equivalent draw API call 01268 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01269 01270 // Return polymorphic copy of object 01271 /*virtual*/ DrawableBase* copy() const; 01272 01273 private: 01274 int _dummy; 01275 }; 01276 01277 // Pop (terminate) Pattern definition 01278 class MagickDLLDecl DrawablePopPattern : public DrawableBase 01279 { 01280 public: 01281 DrawablePopPattern ( void ) 01282 : _dummy(0) 01283 { 01284 } 01285 01286 /*virtual*/ ~DrawablePopPattern ( void ); 01287 01288 // Operator to invoke equivalent draw API call 01289 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01290 01291 // Return polymorphic copy of object 01292 /*virtual*/ DrawableBase* copy() const; 01293 01294 private: 01295 int _dummy; 01296 }; 01297 01298 // Push (create) Pattern definition 01299 class MagickDLLDecl DrawablePushPattern : public DrawableBase 01300 { 01301 public: 01302 DrawablePushPattern ( const std::string &id_, long x_, long y_, 01303 long width_, long height_ ); 01304 01305 DrawablePushPattern ( const DrawablePushPattern& original_ ); 01306 01307 /*virtual*/ ~DrawablePushPattern ( void ); 01308 01309 // Operator to invoke equivalent draw API call 01310 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01311 01312 // Return polymorphic copy of object 01313 /*virtual*/ DrawableBase* copy() const; 01314 01315 private: 01316 std::string _id; 01317 long _x; 01318 long _y; 01319 long _width; 01320 long _height; 01321 }; 01322 01323 // Rectangle 01324 class MagickDLLDecl DrawableRectangle : public DrawableBase 01325 { 01326 public: 01327 DrawableRectangle ( double upperLeftX_, double upperLeftY_, 01328 double lowerRightX_, double lowerRightY_ ) 01329 : _upperLeftX(upperLeftX_), 01330 _upperLeftY(upperLeftY_), 01331 _lowerRightX(lowerRightX_), 01332 _lowerRightY(lowerRightY_) 01333 { } 01334 01335 /*virtual*/ ~DrawableRectangle ( void ); 01336 01337 // Operator to invoke equivalent draw API call 01338 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01339 01340 // Return polymorphic copy of object 01341 /*virtual*/ DrawableBase* copy() const; 01342 01343 void upperLeftX( double upperLeftX_ ) 01344 { 01345 _upperLeftX = upperLeftX_; 01346 } 01347 double upperLeftX( void ) const 01348 { 01349 return _upperLeftX; 01350 } 01351 01352 void upperLeftY( double upperLeftY_ ) 01353 { 01354 _upperLeftY = upperLeftY_; 01355 } 01356 double upperLeftY( void ) const 01357 { 01358 return _upperLeftY; 01359 } 01360 01361 void lowerRightX( double lowerRightX_ ) 01362 { 01363 _lowerRightX = lowerRightX_; 01364 } 01365 double lowerRightX( void ) const 01366 { 01367 return _lowerRightX; 01368 } 01369 01370 void lowerRightY( double lowerRightY_ ) 01371 { 01372 _lowerRightY = lowerRightY_; 01373 } 01374 double lowerRightY( void ) const 01375 { 01376 return _lowerRightY; 01377 } 01378 01379 private: 01380 double _upperLeftX; 01381 double _upperLeftY; 01382 double _lowerRightX; 01383 double _lowerRightY; 01384 }; 01385 01386 // Apply Rotation 01387 class MagickDLLDecl DrawableRotation : public DrawableBase 01388 { 01389 public: 01390 DrawableRotation ( double angle_ ) 01391 : _angle( angle_ ) 01392 { } 01393 01394 /*virtual*/ ~DrawableRotation ( void ); 01395 01396 // Operator to invoke equivalent draw API call 01397 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01398 01399 // Return polymorphic copy of object 01400 /*virtual*/ DrawableBase* copy() const; 01401 01402 void angle( double angle_ ) 01403 { 01404 _angle = angle_; 01405 } 01406 double angle( void ) const 01407 { 01408 return _angle; 01409 } 01410 01411 private: 01412 double _angle; 01413 }; 01414 01415 // Round Rectangle 01416 class MagickDLLDecl DrawableRoundRectangle : public DrawableBase 01417 { 01418 public: 01419 DrawableRoundRectangle ( double centerX_, double centerY_, 01420 double width_, double hight_, 01421 double cornerWidth_, double cornerHeight_ ) 01422 : _centerX(centerX_), 01423 _centerY(centerY_), 01424 _width(width_), 01425 _hight(hight_), 01426 _cornerWidth(cornerWidth_), 01427 _cornerHeight(cornerHeight_) 01428 { } 01429 01430 /*virtual*/ ~DrawableRoundRectangle ( void ); 01431 01432 // Operator to invoke equivalent draw API call 01433 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01434 01435 // Return polymorphic copy of object 01436 /*virtual*/ DrawableBase* copy() const; 01437 01438 void centerX( double centerX_ ) 01439 { 01440 _centerX = centerX_; 01441 } 01442 double centerX( void ) const 01443 { 01444 return _centerX; 01445 } 01446 01447 void centerY( double centerY_ ) 01448 { 01449 _centerY = centerY_; 01450 } 01451 double centerY( void ) const 01452 { 01453 return _centerY; 01454 } 01455 01456 void width( double width_ ) 01457 { 01458 _width = width_; 01459 } 01460 double width( void ) const 01461 { 01462 return _width; 01463 } 01464 01465 void hight( double hight_ ) 01466 { 01467 _hight = hight_; 01468 } 01469 double hight( void ) const 01470 { 01471 return _hight; 01472 } 01473 01474 void cornerWidth( double cornerWidth_ ) 01475 { 01476 _cornerWidth = cornerWidth_; 01477 } 01478 double cornerWidth( void ) const 01479 { 01480 return _cornerWidth; 01481 } 01482 01483 void cornerHeight( double cornerHeight_ ) 01484 { 01485 _cornerHeight = cornerHeight_; 01486 } 01487 double cornerHeight( void ) const 01488 { 01489 return _cornerHeight; 01490 } 01491 01492 private: 01493 double _centerX; 01494 double _centerY; 01495 double _width; 01496 double _hight; 01497 double _cornerWidth; 01498 double _cornerHeight; 01499 }; 01500 01501 // Apply Scaling 01502 class MagickDLLDecl DrawableScaling : public DrawableBase 01503 { 01504 public: 01505 DrawableScaling ( double x_, double y_ ) 01506 : _x(x_), 01507 _y(y_) 01508 { } 01509 01510 /*virtual*/ ~DrawableScaling ( void ); 01511 01512 // Operator to invoke equivalent draw API call 01513 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01514 01515 // Return polymorphic copy of object 01516 /*virtual*/ DrawableBase* copy() const; 01517 01518 void x( double x_ ) 01519 { 01520 _x = x_; 01521 } 01522 double x( void ) const 01523 { 01524 return _x; 01525 } 01526 01527 void y( double y_ ) 01528 { 01529 _y = y_; 01530 } 01531 double y( void ) const 01532 { 01533 return _y; 01534 } 01535 01536 private: 01537 double _x; 01538 double _y; 01539 }; 01540 01541 // Apply Skew in X direction 01542 class MagickDLLDecl DrawableSkewX : public DrawableBase 01543 { 01544 public: 01545 DrawableSkewX ( double angle_ ) 01546 : _angle(angle_) 01547 { } 01548 01549 /*virtual*/ ~DrawableSkewX ( void ); 01550 01551 // Operator to invoke equivalent draw API call 01552 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01553 01554 // Return polymorphic copy of object 01555 /*virtual*/ DrawableBase* copy() const; 01556 01557 void angle( double angle_ ) 01558 { 01559 _angle = angle_; 01560 } 01561 double angle( void ) const 01562 { 01563 return _angle; 01564 } 01565 01566 private: 01567 double _angle; 01568 }; 01569 01570 // Apply Skew in Y direction 01571 class MagickDLLDecl DrawableSkewY : public DrawableBase 01572 { 01573 public: 01574 DrawableSkewY ( double angle_ ) 01575 : _angle(angle_) 01576 { } 01577 01578 /*virtual*/ ~DrawableSkewY ( void ); 01579 01580 // Operator to invoke equivalent draw API call 01581 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01582 01583 // Return polymorphic copy of object 01584 /*virtual*/ DrawableBase* copy() const; 01585 01586 void angle( double angle_ ) 01587 { 01588 _angle = angle_; 01589 } 01590 double angle( void ) const 01591 { 01592 return _angle; 01593 } 01594 01595 private: 01596 double _angle; 01597 }; 01598 01599 // Stroke dasharray 01600 class MagickDLLDecl DrawableDashArray : public DrawableBase 01601 { 01602 public: 01603 DrawableDashArray( const double* dasharray_ ); 01604 DrawableDashArray( const unsigned int* dasharray_ ); // Deprecated 01605 DrawableDashArray( const Magick::DrawableDashArray &original_ ); 01606 01607 /*virtual*/ ~DrawableDashArray( void ); 01608 01609 // Operator to invoke equivalent draw API call 01610 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01611 01612 // Return polymorphic copy of object 01613 /*virtual*/ DrawableBase* copy() const; 01614 01615 void dasharray( const double* dasharray_ ); 01616 void dasharray( const unsigned int* dasharray_ ); // Deprecated 01617 01618 const double* dasharray( void ) const 01619 { 01620 return _dasharray; 01621 } 01622 01623 DrawableDashArray& operator=(const Magick::DrawableDashArray &original_); 01624 01625 private: 01626 size_t _size; 01627 double *_dasharray; 01628 }; 01629 01630 // Stroke dashoffset 01631 class MagickDLLDecl DrawableDashOffset : public DrawableBase 01632 { 01633 public: 01634 DrawableDashOffset ( const double offset_ ) 01635 : _offset(offset_) 01636 { } 01637 01638 /*virtual*/ ~DrawableDashOffset ( void ); 01639 01640 // Operator to invoke equivalent draw API call 01641 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01642 01643 // Return polymorphic copy of object 01644 /*virtual*/ DrawableBase* copy() const; 01645 01646 void offset( const double offset_ ) 01647 { 01648 _offset = offset_; 01649 } 01650 double offset( void ) const 01651 { 01652 return _offset; 01653 } 01654 01655 private: 01656 double _offset; 01657 }; 01658 01659 // Stroke linecap 01660 class MagickDLLDecl DrawableStrokeLineCap : public DrawableBase 01661 { 01662 public: 01663 DrawableStrokeLineCap ( LineCap linecap_ ) 01664 : _linecap(linecap_) 01665 { } 01666 01667 /*virtual*/ ~DrawableStrokeLineCap ( void ); 01668 01669 // Operator to invoke equivalent draw API call 01670 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01671 01672 // Return polymorphic copy of object 01673 /*virtual*/ DrawableBase* copy() const; 01674 01675 void linecap( LineCap linecap_ ) 01676 { 01677 _linecap = linecap_; 01678 } 01679 LineCap linecap( void ) const 01680 { 01681 return _linecap; 01682 } 01683 01684 private: 01685 LineCap _linecap; 01686 }; 01687 01688 // Stroke linejoin 01689 class MagickDLLDecl DrawableStrokeLineJoin : public DrawableBase 01690 { 01691 public: 01692 DrawableStrokeLineJoin ( LineJoin linejoin_ ) 01693 : _linejoin(linejoin_) 01694 { } 01695 01696 /*virtual*/ ~DrawableStrokeLineJoin ( void ); 01697 01698 // Operator to invoke equivalent draw API call 01699 /*virtual*/ void operator()( MagickLib::DrawContext context_ ) const; 01700 01701 // Return polymorphic copy of object 01702 /*virtual*/ DrawableBase* copy() const; 01703 01704 void linejoin( LineJoin linejoin_ ) 01705 { 01706 _linejoin = linejoin_; 01707 } 01708 LineJoin linejoin( void ) const 01709 { 01710 return _linejoin; 01711 } 01712 01713 private: 01714 LineJoin _linejoin; 01715 }; 01716 01717 // Stroke miterlimit 01718 class MagickDLLDecl DrawableMiterLimit : public DrawableBase 01719 { 01720 public: 01721 DrawableMiterLimit ( unsigned int miterlimit_ ) 01722 : _miterlimit(miterlimit_) 01723 { } 01724 01725 /*virtual*/ ~DrawableMiterLimit ( void ); 01726 01727 // Operator to invoke equivalent draw API call 01728 /*virtual*/ void operator()( MagickLib::DrawContext context_ )