From: dirk Date: Tue, 7 Apr 2015 19:32:12 +0000 (+0000) Subject: Renamed alpha back to opacity for various Draw methods. X-Git-Tag: 7.0.1-0~1125 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8e845f3f7f8cf0458db8a34a631cda0b4b2c89c;p=imagemagick Renamed alpha back to opacity for various Draw methods. --- diff --git a/Magick++/lib/Drawable.cpp b/Magick++/lib/Drawable.cpp index 35aace33b..aba465e39 100644 --- a/Magick++/lib/Drawable.cpp +++ b/Magick++/lib/Drawable.cpp @@ -244,7 +244,6 @@ Magick::DrawableBase* Magick::DrawableAffine::copy() const return new DrawableAffine(*this); } -// Change pixel matte value to transparent using PaintMethod Magick::DrawableAlpha::~DrawableAlpha(void) { } @@ -624,18 +623,19 @@ Magick::DrawableBase* Magick::DrawableFillRule::copy() const return new DrawableFillRule(*this); } -// Specify drawing fill alpha -Magick::DrawableFillAlpha::~DrawableFillAlpha ( void ) +Magick::DrawableFillOpacity::~DrawableFillOpacity(void) { } -void Magick::DrawableFillAlpha::operator() - ( MagickCore::DrawingWand * context_ ) const + +void Magick::DrawableFillOpacity::operator() + (MagickCore::DrawingWand *context_) const { - DrawSetFillAlpha( context_, _alpha ); + DrawSetFillOpacity(context_,_opacity); } -Magick::DrawableBase* Magick::DrawableFillAlpha::copy() const + +Magick::DrawableBase* Magick::DrawableFillOpacity::copy() const { - return new DrawableFillAlpha(*this); + return new DrawableFillOpacity(*this); } // Specify text font @@ -1208,18 +1208,19 @@ Magick::DrawableBase* Magick::DrawableStrokeColor::copy() const return new DrawableStrokeColor(*this); } -// Stroke alpha -Magick::DrawableStrokeAlpha::~DrawableStrokeAlpha ( void ) +Magick::DrawableStrokeOpacity::~DrawableStrokeOpacity(void) { } -void Magick::DrawableStrokeAlpha::operator() - ( MagickCore::DrawingWand * context_ ) const + +void Magick::DrawableStrokeOpacity::operator() + (MagickCore::DrawingWand * context_) const { - DrawSetStrokeAlpha( context_, _alpha ); + DrawSetStrokeOpacity(context_,_opacity); } -Magick::DrawableBase* Magick::DrawableStrokeAlpha::copy() const + +Magick::DrawableBase* Magick::DrawableStrokeOpacity::copy() const { - return new DrawableStrokeAlpha(*this); + return new DrawableStrokeOpacity(*this); } // Stroke width diff --git a/Magick++/lib/Magick++/Drawable.h b/Magick++/lib/Magick++/Drawable.h index 4d4d76f3b..6ae4a69b5 100644 --- a/Magick++/lib/Magick++/Drawable.h +++ b/Magick++/lib/Magick++/Drawable.h @@ -955,33 +955,35 @@ private: }; // Specify drawing fill alpha -class MagickPPExport DrawableFillAlpha : public DrawableBase +class MagickPPExport DrawableFillOpacity : public DrawableBase { public: - DrawableFillAlpha ( double alpha_ ) - : _alpha(alpha_) - { - } - /*virtual*/ ~DrawableFillAlpha ( void ); + DrawableFillOpacity(double opacity_) + : _opacity(opacity_) + { + } + + ~DrawableFillOpacity ( void ); // Operator to invoke equivalent draw API call - /*virtual*/ void operator()( MagickCore::DrawingWand *context_ ) const; + void operator()(MagickCore::DrawingWand *context_) const; // Return polymorphic copy of object - /*virtual*/ DrawableBase* copy() const; + DrawableBase* copy() const; - void alpha( double alpha_ ) - { - _alpha = alpha_; - } - double alpha( void ) const - { - return _alpha; - } + void opacity(double opacity_) + { + _opacity=opacity_; + } + + double opacity(void) const + { + return(_opacity); + } private: - double _alpha; + double _opacity; }; // Specify text font @@ -1818,34 +1820,36 @@ private: Color _color; }; -// Stroke alpha -class MagickPPExport DrawableStrokeAlpha : public DrawableBase +// Stroke opacity +class MagickPPExport DrawableStrokeOpacity : public DrawableBase { public: - DrawableStrokeAlpha ( double alpha_ ) - : _alpha(alpha_) - { - } - /*virtual*/ ~DrawableStrokeAlpha ( void ); + DrawableStrokeOpacity(double opacity_) + : _opacity(opacity_) + { + } + + ~DrawableStrokeOpacity(void); // Operator to invoke equivalent draw API call - /*virtual*/ void operator()( MagickCore::DrawingWand *context_ ) const; + void operator()(MagickCore::DrawingWand *context_) const; // Return polymorphic copy of object - /*virtual*/ DrawableBase* copy() const; + DrawableBase* copy() const; - void alpha( double alpha_ ) - { - _alpha = alpha_; - } - double alpha( void ) const - { - return _alpha; - } + void opacity(double opacity_) + { + _opacity=opacity_; + } + + double opacity(void) const + { + return(_opacity); + } private: - double _alpha; + double _opacity; }; // Stroke width diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h index d78f8c2b0..792c251db 100644 --- a/Magick++/lib/Magick++/Include.h +++ b/Magick++/lib/Magick++/Include.h @@ -1206,7 +1206,7 @@ namespace Magick using MagickCore::DrawSetClipRule; using MagickCore::DrawSetClipUnits; using MagickCore::DrawSetFillColor; - using MagickCore::DrawSetFillAlpha; + using MagickCore::DrawSetFillOpacity; using MagickCore::DrawSetFillPatternURL; using MagickCore::DrawSetFillRule; using MagickCore::DrawSetFont; @@ -1223,7 +1223,7 @@ namespace Magick using MagickCore::DrawSetStrokeLineCap; using MagickCore::DrawSetStrokeLineJoin; using MagickCore::DrawSetStrokeMiterLimit; - using MagickCore::DrawSetStrokeAlpha; + using MagickCore::DrawSetStrokeOpacity; using MagickCore::DrawSetStrokePatternURL; using MagickCore::DrawSetStrokeWidth; using MagickCore::DrawSetTextAntialias; diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 8c3f5dc6f..deeb8c09d 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -2010,7 +2010,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, } break; } - if (LocaleCompare("fill-alpha",keyword) == 0) + if (LocaleCompare("fill-opacity",keyword) == 0) { GetMagickToken(q,&q,token); factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0; @@ -2179,16 +2179,6 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, status=MagickFalse; break; } - case 'm': - case 'M': - { - if (LocaleCompare("matte",keyword) == 0) - { - primitive_type=AlphaPrimitive; - break; - } - break; - } case 'o': case 'O': { diff --git a/MagickWand/drawing-wand.c b/MagickWand/drawing-wand.c index 003e60e4c..9e0c45c76 100644 --- a/MagickWand/drawing-wand.c +++ b/MagickWand/drawing-wand.c @@ -1426,19 +1426,19 @@ WandExport void DrawGetFillColor(const DrawingWand *wand,PixelWand *fill_color) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% DrawGetFillAlpha() returns the alpha used when drawing using the fill +% DrawGetFillOpacity() returns the alpha used when drawing using the fill % color or fill texture. Fully opaque is 1.0. % -% The format of the DrawGetFillAlpha method is: +% The format of the DrawGetFillOpacity method is: % -% double DrawGetFillAlpha(const DrawingWand *wand) +% double DrawGetFillOpacity(const DrawingWand *wand) % % A description of each parameter follows: % % o wand: the drawing wand. % */ -WandExport double DrawGetFillAlpha(const DrawingWand *wand) +WandExport double DrawGetFillOpacity(const DrawingWand *wand) { double alpha; @@ -1771,19 +1771,19 @@ WandExport GravityType DrawGetGravity(const DrawingWand *wand) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% DrawGetAlpha() returns the alpha used when drawing with the fill +% DrawGetOpacity() returns the alpha used when drawing with the fill % or stroke color or texture. Fully opaque is 1.0. % -% The format of the DrawGetAlpha method is: +% The format of the DrawGetOpacity method is: % -% double DrawGetAlpha(const DrawingWand *wand) +% double DrawGetOpacity(const DrawingWand *wand) % % A description of each parameter follows: % % o wand: the drawing wand. % */ -WandExport double DrawGetAlpha(const DrawingWand *wand) +WandExport double DrawGetOpacity(const DrawingWand *wand) { double alpha; @@ -2081,18 +2081,18 @@ WandExport size_t DrawGetStrokeMiterLimit(const DrawingWand *wand) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% DrawGetStrokeAlpha() returns the alpha of stroked object outlines. +% DrawGetStrokeOpacity() returns the alpha of stroked object outlines. % -% The format of the DrawGetStrokeAlpha method is: +% The format of the DrawGetStrokeOpacity method is: % -% double DrawGetStrokeAlpha(const DrawingWand *wand) +% double DrawGetStrokeOpacity(const DrawingWand *wand) % % A description of each parameter follows: % % o wand: the drawing wand. % */ -WandExport double DrawGetStrokeAlpha(const DrawingWand *wand) +WandExport double DrawGetStrokeOpacity(const DrawingWand *wand) { double alpha; @@ -2475,7 +2475,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) GetColorTuple(&pixel,MagickTrue,value); (void) SetXMLTreeContent(child,value); } - child=AddChildToXMLTree(xml_info,"fill-alpha",0); + child=AddChildToXMLTree(xml_info,"fill-opacity",0); if (child != (XMLTreeInfo *) NULL) { (void) FormatLocaleString(value,MaxTextExtent,"%.20g", @@ -2596,7 +2596,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) CurrentContext->miterlimit); (void) SetXMLTreeContent(child,value); } - child=AddChildToXMLTree(xml_info,"stroke-alpha",0); + child=AddChildToXMLTree(xml_info,"stroke-opacity",0); if (child != (XMLTreeInfo *) NULL) { (void) FormatLocaleString(value,MaxTextExtent,"%.20g", @@ -4666,21 +4666,21 @@ WandExport void DrawSetFillColor(DrawingWand *wand,const PixelWand *fill_wand) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% DrawSetFillAlpha() sets the alpha to use when drawing using the fill +% DrawSetFillOpacity() sets the alpha to use when drawing using the fill % color or fill texture. Fully opaque is 1.0. % -% The format of the DrawSetFillAlpha method is: +% The format of the DrawSetFillOpacity method is: % -% void DrawSetFillAlpha(DrawingWand *wand,const double fill_alpha) +% void DrawSetFillOpacity(DrawingWand *wand,const double fill_alpha) % % A description of each parameter follows: % % o wand: the drawing wand. % -% o fill_alpha: fill alpha +% o fill_opacity: fill opacity % */ -WandExport void DrawSetFillAlpha(DrawingWand *wand,const double fill_alpha) +WandExport void DrawSetFillOpacity(DrawingWand *wand,const double fill_opacity) { double alpha; @@ -4689,12 +4689,12 @@ WandExport void DrawSetFillAlpha(DrawingWand *wand,const double fill_alpha) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - alpha=(double) ClampToQuantum(QuantumRange*(1.0-fill_alpha)); + alpha=(double) ClampToQuantum(QuantumRange*fill_opacity); if ((wand->filter_off != MagickFalse) || (CurrentContext->fill.alpha != alpha)) { CurrentContext->fill.alpha=alpha; - (void) MvgPrintf(wand,"fill-alpha %.20g\n",fill_alpha); + (void) MvgPrintf(wand,"fill-opacity %.20g\n",fill_opacity); } } @@ -4763,10 +4763,10 @@ WandExport MagickBooleanType DrawSetFontResolution(DrawingWand *wand, % % o wand: the drawing wand. % -% o alpha: fill alpha +% o opacity: fill and stroke opacity. The value 1.0 is opaque. % */ -WandExport void DrawSetOpacity(DrawingWand *wand,const double alpha) +WandExport void DrawSetOpacity(DrawingWand *wand,const double opacity) { Quantum quantum_alpha; @@ -4775,12 +4775,12 @@ WandExport void DrawSetOpacity(DrawingWand *wand,const double alpha) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - quantum_alpha=ClampToQuantum(QuantumRange*(1.0-alpha)); + quantum_alpha=ClampToQuantum(QuantumRange*opacity); if ((wand->filter_off != MagickFalse) || (CurrentContext->alpha != quantum_alpha)) { - CurrentContext->alpha=(Quantum) alpha; - (void) MvgPrintf(wand,"opacity %.20g\n",alpha); + CurrentContext->alpha=(Quantum) opacity; + (void) MvgPrintf(wand,"opacity %.20g\n",opacity); } } @@ -5639,22 +5639,22 @@ WandExport void DrawSetStrokeMiterLimit(DrawingWand *wand, % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% DrawSetStrokeAlpha() specifies the alpha of stroked object outlines. +% DrawSetStrokeOpacity() specifies the alpha of stroked object outlines. % -% The format of the DrawSetStrokeAlpha method is: +% The format of the DrawSetStrokeOpacity method is: % -% void DrawSetStrokeAlpha(DrawingWand *wand, +% void DrawSetStrokeOpacity(DrawingWand *wand, % const double stroke_alpha) % % A description of each parameter follows: % % o wand: the drawing wand. % -% o stroke_alpha: stroke alpha. The value 1.0 is opaque. +% o opacity: stroke opacity. The value 1.0 is opaque. % */ -WandExport void DrawSetStrokeAlpha(DrawingWand *wand, - const double stroke_alpha) +WandExport void DrawSetStrokeOpacity(DrawingWand *wand, + const double opacity) { double alpha; @@ -5663,12 +5663,12 @@ WandExport void DrawSetStrokeAlpha(DrawingWand *wand, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - alpha=(double) ClampToQuantum(QuantumRange*(1.0-stroke_alpha)); + alpha=(double) ClampToQuantum(QuantumRange*opacity); if ((wand->filter_off != MagickFalse) || (CurrentContext->stroke.alpha != alpha)) { CurrentContext->stroke.alpha=alpha; - (void) MvgPrintf(wand,"stroke-alpha %.20g\n",stroke_alpha); + (void) MvgPrintf(wand,"stroke-opacity %.20g\n",opacity); } } @@ -6189,7 +6189,7 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, (void) QueryColorCompliance(value,AllCompliance,&CurrentContext->fill, wand->exception); } - child=GetXMLTreeChild(xml_info,"fill-alpha"); + child=GetXMLTreeChild(xml_info,"fill-opacity"); if (child != (XMLTreeInfo *) NULL) { value=GetXMLTreeContent(child); @@ -6353,7 +6353,7 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, if (value != (const char *) NULL) CurrentContext->miterlimit=StringToUnsignedLong(value); } - child=GetXMLTreeChild(xml_info,"stroke-alpha"); + child=GetXMLTreeChild(xml_info,"stroke-opacity"); if (child != (XMLTreeInfo *) NULL) { value=GetXMLTreeContent(child); diff --git a/MagickWand/drawing-wand.h b/MagickWand/drawing-wand.h index dff15317c..c4183ad25 100644 --- a/MagickWand/drawing-wand.h +++ b/MagickWand/drawing-wand.h @@ -48,12 +48,12 @@ extern WandExport DirectionType DrawGetTextDirection(const DrawingWand *); extern WandExport double - DrawGetFillAlpha(const DrawingWand *), + DrawGetFillOpacity(const DrawingWand *), DrawGetFontSize(const DrawingWand *), - DrawGetAlpha(const DrawingWand *), + DrawGetOpacity(const DrawingWand *), *DrawGetStrokeDashArray(const DrawingWand *,size_t *), DrawGetStrokeDashOffset(const DrawingWand *), - DrawGetStrokeAlpha(const DrawingWand *), + DrawGetStrokeOpacty(const DrawingWand *), DrawGetStrokeWidth(const DrawingWand *), DrawGetTextKerning(DrawingWand *), DrawGetTextInterlineSpacing(DrawingWand *), @@ -191,7 +191,7 @@ extern WandExport void DrawSetClipRule(DrawingWand *,const FillRule), DrawSetClipUnits(DrawingWand *,const ClipPathUnits), DrawSetFillColor(DrawingWand *,const PixelWand *), - DrawSetFillAlpha(DrawingWand *,const double), + DrawSetFillOpacity(DrawingWand *,const double), DrawSetFillRule(DrawingWand *,const FillRule), DrawSetFontSize(DrawingWand *,const double), DrawSetFontStretch(DrawingWand *,const StretchType), @@ -205,7 +205,7 @@ extern WandExport void DrawSetStrokeLineCap(DrawingWand *,const LineCap), DrawSetStrokeLineJoin(DrawingWand *,const LineJoin), DrawSetStrokeMiterLimit(DrawingWand *,const size_t), - DrawSetStrokeAlpha(DrawingWand *, const double), + DrawSetStrokeOpacity(DrawingWand *, const double), DrawSetStrokeWidth(DrawingWand *,const double), DrawSetTextAlignment(DrawingWand *,const AlignType), DrawSetTextAntialias(DrawingWand *,const MagickBooleanType),