Added DrawableBorderColor, DrawableClipRule, DrawableClipUnits, DrawableFillPatternUrl, DrawableStrokePatternUrl and DrawableTextAlignment
Renamed DrawableDashArray and DrawableDashOffset.
diff --git a/Magick++/lib/Drawable.cpp b/Magick++/lib/Drawable.cpp
index 2bfa3a7..1455eb7 100644
--- a/Magick++/lib/Drawable.cpp
+++ b/Magick++/lib/Drawable.cpp
@@ -301,6 +301,120 @@
return new DrawableBezier(*this);
}
+
+/* DrawableBorderColor */
+Magick::DrawableBorderColor::DrawableBorderColor(const Magick::Color &color_)
+ : _color(color_)
+{
+}
+
+Magick::DrawableBorderColor::DrawableBorderColor
+ (const Magick::DrawableBorderColor &original_)
+ : DrawableBase(original_),
+ _color(original_._color)
+{
+}
+
+Magick::DrawableBorderColor::~DrawableBorderColor(void)
+{
+}
+
+void Magick::DrawableBorderColor::operator()(
+ MagickCore::DrawingWand *context_) const
+{
+ PixelInfo
+ color;
+
+ PixelWand
+ *pixel_wand;
+
+ color=static_cast<PixelInfo>(_color);
+ pixel_wand=NewPixelWand();
+ PixelSetPixelColor(pixel_wand,&color);
+ DrawSetBorderColor(context_,pixel_wand);
+ pixel_wand=DestroyPixelWand(pixel_wand);
+}
+
+void Magick::DrawableBorderColor::color(const Color &color_)
+{
+ _color=color_;
+}
+
+Magick::Color Magick::DrawableBorderColor::color(void) const
+{
+ return(_color);
+}
+
+Magick::DrawableBase* Magick::DrawableBorderColor::copy() const
+{
+ return(new DrawableBorderColor(*this));
+}
+
+
+/* DrawableClipRule */
+Magick::DrawableClipRule::DrawableClipRule(const FillRule fillRule_)
+{
+ _fillRule=fillRule_;
+}
+
+Magick::DrawableClipRule::~DrawableClipRule(void)
+{
+}
+
+void Magick::DrawableClipRule::operator()(
+ MagickCore::DrawingWand * context_) const
+{
+ DrawSetClipRule(context_,_fillRule);
+}
+
+void Magick::DrawableClipRule::fillRule(const FillRule fillRule_)
+{
+ _fillRule=fillRule_;
+}
+
+Magick::FillRule Magick::DrawableClipRule::fillRule(void) const
+{
+ return(_fillRule);
+}
+
+Magick::DrawableBase* Magick::DrawableClipRule::copy() const
+{
+ return(new DrawableClipRule(*this));
+}
+
+
+/* DrawableClipUnits */
+Magick::DrawableClipUnits::DrawableClipUnits(const ClipPathUnits units_)
+{
+ _units = units_;
+}
+
+Magick::DrawableClipUnits::~DrawableClipUnits(void)
+{
+}
+
+void Magick::DrawableClipUnits::operator()(
+ MagickCore::DrawingWand * context_) const
+{
+ DrawSetClipUnits(context_, _units);
+}
+
+void Magick::DrawableClipUnits::units(const ClipPathUnits units_)
+{
+ _units = units_;
+}
+
+Magick::ClipPathUnits Magick::DrawableClipUnits::units(void) const
+{
+ return(_units);
+}
+
+Magick::DrawableBase* Magick::DrawableClipUnits::copy() const
+{
+ return(new DrawableClipUnits(*this));
+}
+
+
//
//Clip Path
//
@@ -622,6 +736,44 @@
return new DrawableFillColor(*this);
}
+/* DrawableFillPatternUrl */
+Magick::DrawableFillPatternUrl::DrawableFillPatternUrl(const std::string &url_)
+ : _url(url_)
+{
+}
+
+Magick::DrawableFillPatternUrl::DrawableFillPatternUrl(
+ const Magick::DrawableFillPatternUrl& original_)
+ : DrawableBase(original_),
+ _url(original_._url)
+{
+}
+
+Magick::DrawableFillPatternUrl::~DrawableFillPatternUrl(void)
+{
+}
+
+void Magick::DrawableFillPatternUrl::operator()(
+ MagickCore::DrawingWand * context_) const
+{
+ DrawSetFillPatternURL(context_, _url.c_str());
+}
+
+void Magick::DrawableFillPatternUrl::url(const std::string &url_)
+{
+ _url = url_;
+}
+
+std::string Magick::DrawableFillPatternUrl::url(void) const
+{
+ return(_url);
+}
+
+Magick::DrawableBase* Magick::DrawableFillPatternUrl::copy() const
+{
+ return(new DrawableFillPatternUrl(*this));
+}
+
// Specify drawing fill fule
Magick::DrawableFillRule::~DrawableFillRule ( void )
{
@@ -1033,15 +1185,16 @@
return new DrawableSkewY(*this);
}
-Magick::DrawableDashArray::DrawableDashArray(const double* dasharray_)
+/* DrawableStrokeDashArray */
+Magick::DrawableStrokeDashArray::DrawableStrokeDashArray(const double* dasharray_)
: _size(0),
_dasharray(0)
{
dasharray(dasharray_);
}
-Magick::DrawableDashArray::DrawableDashArray(
- const Magick::DrawableDashArray& original_)
+Magick::DrawableStrokeDashArray::DrawableStrokeDashArray(
+ const Magick::DrawableStrokeDashArray& original_)
: DrawableBase (original_),
_size(original_._size),
_dasharray(new double[_size+1])
@@ -1054,17 +1207,17 @@
}
}
-Magick::DrawableDashArray::~DrawableDashArray(void)
+Magick::DrawableStrokeDashArray::~DrawableStrokeDashArray(void)
{
delete [] _dasharray;
_size=0;
- _dasharray=0;
+ _dasharray=(double *) NULL;
}
-Magick::DrawableDashArray& Magick::DrawableDashArray::operator=(
- const Magick::DrawableDashArray &original_)
+Magick::DrawableStrokeDashArray& Magick::DrawableStrokeDashArray::operator=(
+ const Magick::DrawableStrokeDashArray &original_)
{
- if( this != &original_ )
+ if (this != &original_)
{
delete [] _dasharray;
_size=original_._size;
@@ -1076,21 +1229,22 @@
_dasharray[_size]=0.0;
}
}
- return *this;
+ return(*this);
}
-void Magick::DrawableDashArray::operator()(
+void Magick::DrawableStrokeDashArray::operator()(
MagickCore::DrawingWand *context_) const
{
- (void) DrawSetStrokeDashArray(context_,(const unsigned long) _size,_dasharray);
+ (void) DrawSetStrokeDashArray(context_,(const unsigned long) _size,
+ _dasharray);
}
-Magick::DrawableBase *Magick::DrawableDashArray::copy() const
+Magick::DrawableBase *Magick::DrawableStrokeDashArray::copy() const
{
- return(new DrawableDashArray(*this));
+ return(new DrawableStrokeDashArray(*this));
}
-void Magick::DrawableDashArray::dasharray(const double* dasharray_)
+void Magick::DrawableStrokeDashArray::dasharray(const double* dasharray_)
{
size_t
n;
@@ -1099,12 +1253,15 @@
_size=0;
_dasharray=0;
- if (dasharray_)
+ if (dasharray_ != (const double *) NULL)
{
+ const double
+ *p;
+
// Count elements in dash array
n=0;
{
- const double *p = dasharray_;
+ p = dasharray_;
while(*p++ != 0.0)
n++;
}
@@ -1121,18 +1278,35 @@
}
}
-// Stroke dashoffset
-Magick::DrawableDashOffset::~DrawableDashOffset ( void )
+const double* Magick::DrawableStrokeDashArray::dasharray(void) const
+{
+ return(_dasharray);
+}
+
+/* DrawableStrokeDashOffset */
+Magick::DrawableStrokeDashOffset::~DrawableStrokeDashOffset(void)
{
}
-void Magick::DrawableDashOffset::operator()
- ( MagickCore::DrawingWand * context_ ) const
+
+void Magick::DrawableStrokeDashOffset::operator()
+ ( MagickCore::DrawingWand * context_) const
{
- DrawSetStrokeDashOffset( context_, _offset );
+ DrawSetStrokeDashOffset(context_,_offset);
}
-Magick::DrawableBase* Magick::DrawableDashOffset::copy() const
+
+Magick::DrawableBase* Magick::DrawableStrokeDashOffset::copy() const
{
- return new DrawableDashOffset(*this);
+ return(new DrawableStrokeDashOffset(*this));
+}
+
+void Magick::DrawableStrokeDashOffset::offset(const double offset_)
+{
+ _offset=offset_;
+}
+
+double Magick::DrawableStrokeDashOffset::offset(void) const
+{
+ return(_offset);
}
// Stroke linecap
@@ -1177,6 +1351,46 @@
return new DrawableMiterLimit(*this);
}
+
+/* DrawableStrokePatternUrl */
+Magick::DrawableStrokePatternUrl::DrawableStrokePatternUrl(
+ const std::string &url_)
+ : _url(url_)
+{
+}
+
+Magick::DrawableStrokePatternUrl::DrawableStrokePatternUrl(
+ const Magick::DrawableStrokePatternUrl& original_)
+ : DrawableBase(original_),
+ _url(original_._url)
+{
+}
+
+Magick::DrawableStrokePatternUrl::~DrawableStrokePatternUrl(void)
+{
+}
+
+void Magick::DrawableStrokePatternUrl::operator()(
+ MagickCore::DrawingWand * context_) const
+{
+ DrawSetStrokePatternURL(context_, _url.c_str());
+}
+
+void Magick::DrawableStrokePatternUrl::url(const std::string &url_)
+{
+ _url = url_;
+}
+
+std::string Magick::DrawableStrokePatternUrl::url(void) const
+{
+ return(_url);
+}
+
+Magick::DrawableBase* Magick::DrawableStrokePatternUrl::copy() const
+{
+ return(new DrawableStrokePatternUrl(*this));
+}
+
// Stroke antialias
Magick::DrawableStrokeAntialias::~DrawableStrokeAntialias ( void )
{
@@ -1290,6 +1504,45 @@
return new DrawableText(*this);
}
+/* DrawableTextAlignment */
+Magick::DrawableTextAlignment::DrawableTextAlignment(
+ Magick::AlignType alignment_)
+ : _alignment(alignment_)
+{
+}
+
+Magick::DrawableTextAlignment::DrawableTextAlignment
+(const Magick::DrawableTextAlignment &original_)
+ : DrawableBase(original_),
+ _alignment(original_._alignment)
+{
+}
+
+Magick::DrawableTextAlignment::~DrawableTextAlignment(void)
+{
+}
+
+void Magick::DrawableTextAlignment::operator()(
+ MagickCore::DrawingWand * context_) const
+{
+ DrawSetTextAlignment(context_, _alignment);
+}
+
+void Magick::DrawableTextAlignment::alignment(AlignType alignment_)
+{
+ _alignment=alignment_;
+}
+
+Magick::AlignType Magick::DrawableTextAlignment::alignment(void) const
+{
+ return(_alignment);
+}
+
+Magick::DrawableBase* Magick::DrawableTextAlignment::copy() const
+{
+ return new DrawableTextAlignment(*this);
+}
+
// Text antialias
Magick::DrawableTextAntialias::DrawableTextAntialias ( bool flag_ )
: _flag(flag_)
@@ -1314,6 +1567,7 @@
return new DrawableTextAntialias(*this);
}
+
// Decoration (text decoration)
Magick::DrawableTextDecoration::DrawableTextDecoration
( Magick::DecorationType decoration_ )
diff --git a/Magick++/lib/Magick++/Drawable.h b/Magick++/lib/Magick++/Drawable.h
index d796e3c..1693452 100644
--- a/Magick++/lib/Magick++/Drawable.h
+++ b/Magick++/lib/Magick++/Drawable.h
@@ -478,6 +478,73 @@
CoordinateList _coordinates;
};
+ // Sets the border color to be used for drawing bordered objects.
+ class MagickPPExport DrawableBorderColor : public DrawableBase
+ {
+ public:
+
+ DrawableBorderColor(const Color &color_);
+
+ DrawableBorderColor(const DrawableBorderColor &original_);
+
+ ~DrawableBorderColor(void);
+
+ // Operator to invoke equivalent draw API call
+ void operator()(MagickCore::DrawingWand *context_) const;
+
+ void color(const Color &color_);
+ Color color(void) const;
+
+ // Return polymorphic copy of object
+ DrawableBase* copy() const;
+
+ private:
+ Color _color;
+ };
+
+ // Sets the polygon fill rule to be used by the clipping path.
+ class MagickPPExport DrawableClipRule : public DrawableBase
+ {
+ public:
+
+ DrawableClipRule(const FillRule fillRule_);
+
+ ~DrawableClipRule(void);
+
+ // Operator to invoke equivalent draw API call
+ void operator()(MagickCore::DrawingWand *context_) const;
+
+ void fillRule(const FillRule fillRule_);
+ FillRule fillRule(void) const;
+
+ // Return polymorphic copy of object
+ DrawableBase* copy() const;
+
+ private:
+ FillRule _fillRule;
+ };
+
+ // Sets the interpretation of clip path units.
+ class MagickPPExport DrawableClipUnits : public DrawableBase
+ {
+ public:
+
+ DrawableClipUnits(const ClipPathUnits units_);
+
+ ~DrawableClipUnits(void);
+
+ // Operator to invoke equivalent draw API call
+ void operator()(MagickCore::DrawingWand *context_) const;
+
+ void units(const ClipPathUnits units_);
+ ClipPathUnits units(void) const;
+
+ // Return polymorphic copy of object
+ DrawableBase* copy() const;
+
+ private:
+ ClipPathUnits _units;
+ };
// Pop (terminate) clip path definition
class MagickPPExport DrawablePopClipPath : public DrawableBase
@@ -907,6 +974,33 @@
Color _color;
};
+ // Sets the URL to use as a fill pattern for filling objects. Only local
+ // URLs("#identifier") are supported at this time. These local URLs are
+ // normally created by defining a named fill pattern with
+ // DrawablePushPattern/DrawablePopPattern.
+ class MagickPPExport DrawableFillPatternUrl : public DrawableBase
+ {
+ public:
+
+ DrawableFillPatternUrl(const std::string &url_);
+
+ ~DrawableFillPatternUrl(void);
+
+ DrawableFillPatternUrl(const DrawableFillPatternUrl& original_);
+
+ // Operator to invoke equivalent draw API call
+ void operator()(MagickCore::DrawingWand *context_) const;
+
+ void url(const std::string &url_);
+ std::string url(void) const;
+
+ // Return polymorphic copy of object
+ DrawableBase* copy() const;
+
+ private:
+ std::string _url;
+ };
+
// Specify fill rule (fill-rule)
class MagickPPExport DrawableFillRule : public DrawableBase
{
@@ -1592,20 +1686,47 @@
double _angle;
};
-// Stroke dasharray
-//
-// dasharray_ is an allocated array terminated by value 0.0 or 0.
-// The array is copied so the original does not need to be preserved.
-// Pass a null pointer to clear an existing dash array setting.
-class MagickPPExport DrawableDashArray : public DrawableBase
-{
-public:
+ // Stroke dasharray
+ //
+ // dasharray_ is an allocated array terminated by value 0.0 or 0.
+ // The array is copied so the original does not need to be preserved.
+ // Pass a null pointer to clear an existing dash array setting.
+ class MagickPPExport DrawableStrokeDashArray : public DrawableBase
+ {
+ public:
- DrawableDashArray(const double* dasharray_);
+ DrawableStrokeDashArray(const double* dasharray_);
- DrawableDashArray(const Magick::DrawableDashArray &original_);
+ DrawableStrokeDashArray(const Magick::DrawableStrokeDashArray &original_);
- ~DrawableDashArray(void);
+ ~DrawableStrokeDashArray(void);
+
+ // Operator to invoke equivalent draw API call
+ void operator()(MagickCore::DrawingWand *context_) const;
+
+ // Return polymorphic copy of object
+ DrawableBase* copy() const;
+
+ void dasharray(const double* dasharray_);
+ const double* dasharray(void) const;
+
+ DrawableStrokeDashArray& operator=(
+ const Magick::DrawableStrokeDashArray &original_);
+
+ private:
+ size_t _size;
+ double *_dasharray;
+ };
+
+ // Stroke dashoffset
+ class MagickPPExport DrawableStrokeDashOffset : public DrawableBase
+ {
+ public:
+ DrawableStrokeDashOffset(const double offset_)
+ : _offset(offset_)
+ { }
+
+ ~DrawableStrokeDashOffset(void);
// Operator to invoke equivalent draw API call
void operator()(MagickCore::DrawingWand *context_) const;
@@ -1613,49 +1734,12 @@
// Return polymorphic copy of object
DrawableBase* copy() const;
- void dasharray(const double* dasharray_);
-
- const double* dasharray(void) const
- {
- return _dasharray;
- }
-
- DrawableDashArray& operator=(const Magick::DrawableDashArray &original_);
-
-private:
-
- size_t _size;
- double *_dasharray;
-};
-
-// Stroke dashoffset
-class MagickPPExport DrawableDashOffset : public DrawableBase
-{
-public:
- DrawableDashOffset ( const double offset_ )
- : _offset(offset_)
- { }
-
- /*virtual*/ ~DrawableDashOffset ( void );
-
- // Operator to invoke equivalent draw API call
- /*virtual*/ void operator()( MagickCore::DrawingWand *context_ ) const;
-
- // Return polymorphic copy of object
- /*virtual*/ DrawableBase* copy() const;
-
- void offset( const double offset_ )
- {
- _offset = offset_;
- }
- double offset( void ) const
- {
- return _offset;
- }
-
-private:
- double _offset;
-};
+ void offset(const double offset_);
+ double offset(void) const;
+
+ private:
+ double _offset;
+ };
// Stroke linecap
class MagickPPExport DrawableStrokeLineCap : public DrawableBase
@@ -1744,6 +1828,29 @@
size_t _miterlimit;
};
+// Sets the pattern used for stroking object outlines.
+class MagickPPExport DrawableStrokePatternUrl : public DrawableBase
+{
+public:
+
+ DrawableStrokePatternUrl(const std::string &url_);
+
+ ~DrawableStrokePatternUrl(void);
+
+ DrawableStrokePatternUrl(const DrawableStrokePatternUrl& original_);
+
+ // Operator to invoke equivalent draw API call
+ void operator()(MagickCore::DrawingWand *context_) const;
+
+ void url(const std::string &url_);
+ std::string url(void) const;
+
+ // Return polymorphic copy of object
+ DrawableBase* copy() const;
+
+private:
+ std::string _url;
+};
// Stroke antialias
class MagickPPExport DrawableStrokeAntialias : public DrawableBase
@@ -1922,6 +2029,30 @@
std::string _encoding;
};
+// Text alignment
+class MagickPPExport DrawableTextAlignment : public DrawableBase
+{
+public:
+
+ DrawableTextAlignment(AlignType alignment_);
+
+ DrawableTextAlignment(const DrawableTextAlignment& original_);
+
+ ~DrawableTextAlignment(void);
+
+ // Operator to invoke equivalent draw API call
+ void operator()(MagickCore::DrawingWand *context_) const;
+
+ void alignment(AlignType alignment_);
+ AlignType alignment(void) const;
+
+ // Return polymorphic copy of object
+ DrawableBase* copy() const;
+
+private:
+ AlignType _alignment;
+};
+
// Text antialias
class MagickPPExport DrawableTextAntialias : public DrawableBase
{
diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h
index 3cd9d78..5fc1c34 100644
--- a/Magick++/lib/Magick++/Include.h
+++ b/Magick++/lib/Magick++/Include.h
@@ -297,6 +297,13 @@
using MagickCore::RectangleInfo;
using MagickCore::StringInfo;
+ // Alignment types.
+ using MagickCore::AlignType;
+ using MagickCore::UndefinedAlign;
+ using MagickCore::LeftAlign;
+ using MagickCore::CenterAlign;
+ using MagickCore::RightAlign;
+
// Alpha channel options
using MagickCore::AlphaChannelOption;
using MagickCore::UndefinedAlphaChannel;
@@ -316,12 +323,6 @@
using MagickCore::ShapeAlphaChannel;
using MagickCore::TransparentAlphaChannel;
- // Image class types
- using MagickCore::ClassType;
- using MagickCore::UndefinedClass;
- using MagickCore::DirectClass;
- using MagickCore::PseudoClass;
-
// Channel types
using MagickCore::ChannelType;
using MagickCore::UndefinedChannel;
@@ -347,6 +348,19 @@
using MagickCore::SyncChannels;
using MagickCore::DefaultChannels;
+ // Image class types
+ using MagickCore::ClassType;
+ using MagickCore::UndefinedClass;
+ using MagickCore::DirectClass;
+ using MagickCore::PseudoClass;
+
+ // Clip path units
+ using MagickCore::ClipPathUnits;
+ using MagickCore::UndefinedPathUnits;
+ using MagickCore::UserSpace;
+ using MagickCore::UserSpaceOnUse;
+ using MagickCore::ObjectBoundingBox;
+
// Color-space types
using MagickCore::ColorspaceType;
using MagickCore::UndefinedColorspace;