From: cristy Date: Sun, 15 Dec 2013 23:58:29 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~3043 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6145b19e9636dd905f51bd5fcf3e035dd4585c8a;p=imagemagick --- diff --git a/Magick++/demo/piddle.cpp b/Magick++/demo/piddle.cpp index 5addefe10..1e353bb6b 100644 --- a/Magick++/demo/piddle.cpp +++ b/Magick++/demo/piddle.cpp @@ -80,9 +80,14 @@ int main( int /*argc*/, char ** argv) // // Draw line // - drawList.push_back(DrawableStrokeColor("red")); - drawList.push_back(DrawableStrokeWidth(1)); - drawList.push_back(DrawableLine(10,200, 20,190)); + { + const double dash_array[] = {4.0, 3.0, 0.0}; + drawList.push_back(DrawableDashArray(dash_array)); + drawList.push_back(DrawableStrokeColor("red")); + drawList.push_back(DrawableStrokeWidth(1)); + drawList.push_back(DrawableLine(10,200, 54,182)); + drawList.push_back(DrawableDashArray((double *) 0)); + } // // Draw arc within a circle. diff --git a/Magick++/lib/Drawable.cpp b/Magick++/lib/Drawable.cpp index a63228c0d..87b4fede1 100644 --- a/Magick++/lib/Drawable.cpp +++ b/Magick++/lib/Drawable.cpp @@ -1017,6 +1017,7 @@ Magick::DrawableBase* Magick::DrawableSkewY::copy() const return new DrawableSkewY(*this); } + // Stroke dasharray Magick::DrawableDashArray::DrawableDashArray( const double* dasharray_ ) : _size(0), @@ -1035,10 +1036,15 @@ Magick::DrawableDashArray::DrawableDashArray( const size_t* dasharray_ ) Magick::DrawableDashArray::DrawableDashArray (const Magick::DrawableDashArray& original_) : DrawableBase (original_), - _size(0), - _dasharray(0) + _size(original_._size), + _dasharray(new double[_size+1]) { - dasharray( original_._dasharray ); + // Copy elements + { + for (size_t i=0; i < _size; i++) + _dasharray[i]=original_._dasharray[i]; + _dasharray[_size]=0.0; + } } Magick::DrawableDashArray::~DrawableDashArray( void ) { @@ -1051,14 +1057,23 @@ Magick::DrawableDashArray& Magick::DrawableDashArray::operator= { if( this != &original_ ) { - dasharray( original_._dasharray ); + delete [] _dasharray; + _size=original_._size; + _dasharray = new double[_size+1]; + // Copy elements + { + for (size_t i=0; i < _size; i++) + _dasharray[i]=original_._dasharray[i]; + _dasharray[_size]=0.0; + } } return *this; } +// Invoke object void Magick::DrawableDashArray::operator() - ( MagickCore::DrawingWand * context_ ) const + ( MagickCore::DrawingWand *context_ ) const { - (void) DrawSetStrokeDashArray( context_, (size_t) _size, _dasharray ); + (void) DrawSetStrokeDashArray( context_, (const unsigned long) _size, _dasharray ); } Magick::DrawableBase* Magick::DrawableDashArray::copy() const { @@ -1066,7 +1081,9 @@ Magick::DrawableBase* Magick::DrawableDashArray::copy() const } void Magick::DrawableDashArray::dasharray ( const double* dasharray_ ) { - _dasharray=(double *) RelinquishMagickMemory(_dasharray); + delete [] _dasharray; + _size = 0; + _dasharray = 0; if(dasharray_) { @@ -1074,20 +1091,18 @@ void Magick::DrawableDashArray::dasharray ( const double* dasharray_ ) size_t n = 0; { const double *p = dasharray_; - while(*p++ != 0) + while(*p++ != 0.0) n++; } _size = n; // Allocate elements - _dasharray=static_cast(AcquireMagickMemory((n+1)*sizeof(double))); + _dasharray=new double[_size+1]; // Copy elements { - double *q = _dasharray; - const double *p = dasharray_; - while( *p ) - *q++=*p++; - *q=0; + for (size_t i=0; i < _size; i++) + _dasharray[i]=dasharray_[i]; + _dasharray[_size]=0.0; } } } @@ -1095,7 +1110,10 @@ void Magick::DrawableDashArray::dasharray ( const double* dasharray_ ) // code to the const double* version. void Magick::DrawableDashArray::dasharray( const size_t* dasharray_ ) { - _dasharray=(double *) RelinquishMagickMemory(_dasharray); + if (_dasharray) + delete [] _dasharray; + _size = 0; + _dasharray = 0; if(dasharray_) { @@ -1109,14 +1127,12 @@ void Magick::DrawableDashArray::dasharray( const size_t* dasharray_ ) _size = n; // Allocate elements - _dasharray=static_cast(AcquireMagickMemory((n+1)*sizeof(double))); + _dasharray=new double[_size+1]; // Copy elements { - double *q = _dasharray; - const size_t *p = dasharray_; - while( *p ) - *q++=static_cast(*p++); - *q=0; + for (size_t i=0; i < _size; i++) + _dasharray[i]=dasharray_[i]; + _dasharray[_size]=0; } } } diff --git a/Magick++/lib/Magick++/Drawable.h b/Magick++/lib/Magick++/Drawable.h index 532d7f59b..71edebe1b 100644 --- a/Magick++/lib/Magick++/Drawable.h +++ b/Magick++/lib/Magick++/Drawable.h @@ -1602,6 +1602,10 @@ private: }; // 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: diff --git a/MagickWand/drawing-wand.c b/MagickWand/drawing-wand.c index d76109265..273a5360f 100644 --- a/MagickWand/drawing-wand.c +++ b/MagickWand/drawing-wand.c @@ -424,7 +424,7 @@ static void MvgAppendPointsCommand(DrawingWand *wand,const char *command, (void) MvgPrintf(wand,"%s",command); for (i=number_coordinates, coordinate=coordinates; i != 0; i--) { - (void) MvgAutoWrapPrintf(wand," %g %g",coordinate->x,coordinate->y); + (void) MvgAutoWrapPrintf(wand," %.20g %.20g",coordinate->x,coordinate->y); coordinate++; } (void) MvgPrintf(wand, "\n"); @@ -682,7 +682,7 @@ WandExport void DrawAffine(DrawingWand *wand,const AffineMatrix *affine) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); assert(affine != (const AffineMatrix *) NULL); AdjustAffine(wand,affine); - (void) MvgPrintf(wand,"affine %g %g %g %g %g %g\n", + (void) MvgPrintf(wand,"affine %.20g %.20g %.20g %.20g %.20g %.20g\n", affine->sx,affine->rx,affine->ry,affine->sy,affine->tx,affine->ty); } @@ -774,7 +774,7 @@ WandExport void DrawAnnotation(DrawingWand *wand,const double x,const double y, escaped_text=EscapeString((const char *) text,'\''); if (escaped_text != (char *) NULL) { - (void) MvgPrintf(wand,"text %g %g '%s'\n",x,y,escaped_text); + (void) MvgPrintf(wand,"text %.20g %.20g '%s'\n",x,y,escaped_text); escaped_text=DestroyString(escaped_text); } } @@ -822,7 +822,7 @@ WandExport void DrawArc(DrawingWand *wand,const double sx,const double sy, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"arc %g %g %g %g %g %g\n",sx,sy,ex, + (void) MvgPrintf(wand,"arc %.20g %.20g %.20g %.20g %.20g %.20g\n",sx,sy,ex, ey,sd,ed); } @@ -902,7 +902,7 @@ WandExport void DrawCircle(DrawingWand *wand,const double ox,const double oy, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"circle %g %g %g %g\n",ox,oy,px,py); + (void) MvgPrintf(wand,"circle %.20g %.20g %.20g %.20g\n",ox,oy,px,py); } /* @@ -1077,7 +1077,7 @@ WandExport MagickBooleanType DrawComposite(DrawingWand *wand, } mode=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t) compose); media_type=MagickToMime(image->magick); - (void) MvgPrintf(wand,"image %s %g %g %g %g 'data:%s;base64,\n", + (void) MvgPrintf(wand,"image %s %.20g %.20g %.20g %.20g 'data:%s;base64,\n", mode,x,y,width,height,media_type); p=base64; for (i=(ssize_t) encoded_length; i > 0; i-=76) @@ -1136,7 +1136,7 @@ WandExport void DrawColor(DrawingWand *wand,const double x,const double y, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"color %g %g '%s'\n",x,y,CommandOptionToMnemonic( + (void) MvgPrintf(wand,"color %.20g %.20g '%s'\n",x,y,CommandOptionToMnemonic( MagickMethodOptions,(ssize_t) paint_method)); } @@ -1211,7 +1211,7 @@ WandExport void DrawEllipse(DrawingWand *wand,const double ox,const double oy, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"ellipse %g %g %g %g %g %g\n",ox,oy, + (void) MvgPrintf(wand,"ellipse %.20g %.20g %.20g %.20g %.20g %.20g\n",ox,oy, rx,ry,start,end); } @@ -1957,7 +1957,7 @@ WandExport double *DrawGetStrokeDashArray(const DrawingWand *wand, size_t *number_elements) { double - *dash_array; + *dasharray; register const double *p; @@ -1982,18 +1982,18 @@ WandExport double *DrawGetStrokeDashArray(const DrawingWand *wand, while (fabs(*p++) >= MagickEpsilon) n++; *number_elements=n; - dash_array=(double *) NULL; + dasharray=(double *) NULL; if (n != 0) { - dash_array=(double *) AcquireQuantumMemory((size_t) n+1UL, - sizeof(*dash_array)); + dasharray=(double *) AcquireQuantumMemory((size_t) n+1UL, + sizeof(*dasharray)); p=CurrentContext->dash_pattern; - q=dash_array; + q=dasharray; for (i=0; i < (ssize_t) n; i++) *q++=(*p++); *q=0.0; } - return(dash_array); + return(dasharray); } /* @@ -2506,7 +2506,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) child=AddChildToXMLTree(xml_info,"fill-alpha",0); if (child != (XMLTreeInfo *) NULL) { - (void) FormatLocaleString(value,MaxTextExtent,"%g", + (void) FormatLocaleString(value,MaxTextExtent,"%.20g", (double) QuantumScale*CurrentContext->fill.alpha); (void) SetXMLTreeContent(child,value); } @@ -2527,7 +2527,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) child=AddChildToXMLTree(xml_info,"font-size",0); if (child != (XMLTreeInfo *) NULL) { - (void) FormatLocaleString(value,MaxTextExtent,"%g", + (void) FormatLocaleString(value,MaxTextExtent,"%.20g", CurrentContext->pointsize); (void) SetXMLTreeContent(child,value); } @@ -2588,7 +2588,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) { if (i != 0) (void) ConcatenateString(&dash_pattern,","); - (void) FormatLocaleString(value,MaxTextExtent,"%g", + (void) FormatLocaleString(value,MaxTextExtent,"%.20g", CurrentContext->dash_pattern[i]); (void) ConcatenateString(&dash_pattern,value); } @@ -2598,7 +2598,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) child=AddChildToXMLTree(xml_info,"stroke-dashoffset",0); if (child != (XMLTreeInfo *) NULL) { - (void) FormatLocaleString(value,MaxTextExtent,"%g", + (void) FormatLocaleString(value,MaxTextExtent,"%.20g", CurrentContext->dash_offset); (void) SetXMLTreeContent(child,value); } @@ -2627,14 +2627,14 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) child=AddChildToXMLTree(xml_info,"stroke-alpha",0); if (child != (XMLTreeInfo *) NULL) { - (void) FormatLocaleString(value,MaxTextExtent,"%g", + (void) FormatLocaleString(value,MaxTextExtent,"%.20g", (double) QuantumScale*CurrentContext->stroke.alpha); (void) SetXMLTreeContent(child,value); } child=AddChildToXMLTree(xml_info,"stroke-width",0); if (child != (XMLTreeInfo *) NULL) { - (void) FormatLocaleString(value,MaxTextExtent,"%g", + (void) FormatLocaleString(value,MaxTextExtent,"%.20g", CurrentContext->stroke_width); (void) SetXMLTreeContent(child,value); } @@ -2746,7 +2746,7 @@ WandExport void DrawLine(DrawingWand *wand,const double sx,const double sy, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"line %g %g %g %g\n",sx,sy,ex,ey); + (void) MvgPrintf(wand,"line %.20g %.20g %.20g %.20g\n",sx,sy,ex,ey); } /* @@ -2795,7 +2795,7 @@ WandExport void DrawMatte(DrawingWand *wand,const double x,const double y, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"matte %g %g '%s'\n",x,y,CommandOptionToMnemonic( + (void) MvgPrintf(wand,"matte %.20g %.20g '%s'\n",x,y,CommandOptionToMnemonic( MagickMethodOptions,(ssize_t) paint_method)); } @@ -2888,11 +2888,11 @@ static void DrawPathCurveTo(DrawingWand *wand,const PathMode mode, { wand->path_operation=PathCurveToOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand, "%c%g %g %g %g %g %g", + (void) MvgAutoWrapPrintf(wand, "%c%.20g %.20g %.20g %.20g %.20g %.20g", mode == AbsolutePathMode ? 'C' : 'c',x1,y1,x2,y2,x,y); } else - (void) MvgAutoWrapPrintf(wand," %g %g %g %g %g %g",x1,y1, + (void) MvgAutoWrapPrintf(wand," %.20g %.20g %.20g %.20g %.20g %.20g",x1,y1, x2,y2,x,y); } @@ -3003,11 +3003,11 @@ static void DrawPathCurveToQuadraticBezier(DrawingWand *wand, { wand->path_operation=PathCurveToQuadraticBezierOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand, "%c%g %g %g %g", + (void) MvgAutoWrapPrintf(wand, "%c%.20g %.20g %.20g %.20g", mode == AbsolutePathMode ? 'Q' : 'q',x1,y1,x,y); } else - (void) MvgAutoWrapPrintf(wand," %g %g %g %g",x1,y1,x,y); + (void) MvgAutoWrapPrintf(wand," %.20g %.20g %.20g %.20g",x1,y1,x,y); } WandExport void DrawPathCurveToQuadraticBezierAbsolute(DrawingWand *wand, @@ -3115,11 +3115,11 @@ static void DrawPathCurveToQuadraticBezierSmooth(DrawingWand *wand, { wand->path_operation=PathCurveToQuadraticBezierSmoothOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand,"%c%g %g",mode == AbsolutePathMode ? + (void) MvgAutoWrapPrintf(wand,"%c%.20g %.20g",mode == AbsolutePathMode ? 'T' : 't',x,y); } else - (void) MvgAutoWrapPrintf(wand," %g %g",x,y); + (void) MvgAutoWrapPrintf(wand," %.20g %.20g",x,y); } WandExport void DrawPathCurveToQuadraticBezierSmoothAbsolute(DrawingWand *wand, @@ -3229,11 +3229,11 @@ static void DrawPathCurveToSmooth(DrawingWand *wand,const PathMode mode, { wand->path_operation=PathCurveToSmoothOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand,"%c%g %g %g %g", + (void) MvgAutoWrapPrintf(wand,"%c%.20g %.20g %.20g %.20g", mode == AbsolutePathMode ? 'S' : 's',x2,y2,x,y); } else - (void) MvgAutoWrapPrintf(wand," %g %g %g %g",x2,y2,x,y); + (void) MvgAutoWrapPrintf(wand," %.20g %.20g %.20g %.20g",x2,y2,x,y); } WandExport void DrawPathCurveToSmoothAbsolute(DrawingWand *wand,const double x2, @@ -3359,12 +3359,12 @@ static void DrawPathEllipticArc(DrawingWand *wand, const PathMode mode, { wand->path_operation=PathEllipticArcOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand, "%c%g %g %g %u %u %g %g", + (void) MvgAutoWrapPrintf(wand, "%c%.20g %.20g %.20g %u %u %.20g %.20g", mode == AbsolutePathMode ? 'A' : 'a',rx,ry,x_axis_rotation, large_arc_flag,sweep_flag,x,y); } else - (void) MvgAutoWrapPrintf(wand," %g %g %g %u %u %g %g",rx,ry, + (void) MvgAutoWrapPrintf(wand," %.20g %.20g %.20g %u %u %.20g %.20g",rx,ry, x_axis_rotation,large_arc_flag,sweep_flag,x,y); } @@ -3511,11 +3511,11 @@ static void DrawPathLineTo(DrawingWand *wand,const PathMode mode, { wand->path_operation=PathLineToOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand,"%c%g %g",mode == AbsolutePathMode ? + (void) MvgAutoWrapPrintf(wand,"%c%.20g %.20g",mode == AbsolutePathMode ? 'L' : 'l',x,y); } else - (void) MvgAutoWrapPrintf(wand," %g %g",x,y); + (void) MvgAutoWrapPrintf(wand," %.20g %.20g",x,y); } WandExport void DrawPathLineToAbsolute(DrawingWand *wand,const double x, @@ -3606,11 +3606,11 @@ static void DrawPathLineToHorizontal(DrawingWand *wand,const PathMode mode, { wand->path_operation=PathLineToHorizontalOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand,"%c%g",mode == AbsolutePathMode ? + (void) MvgAutoWrapPrintf(wand,"%c%.20g",mode == AbsolutePathMode ? 'H' : 'h',x); } else - (void) MvgAutoWrapPrintf(wand," %g",x); + (void) MvgAutoWrapPrintf(wand," %.20g",x); } WandExport void DrawPathLineToHorizontalAbsolute(DrawingWand *wand, @@ -3696,11 +3696,11 @@ static void DrawPathLineToVertical(DrawingWand *wand,const PathMode mode, { wand->path_operation=PathLineToVerticalOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand,"%c%g",mode == AbsolutePathMode ? + (void) MvgAutoWrapPrintf(wand,"%c%.20g",mode == AbsolutePathMode ? 'V' : 'v',y); } else - (void) MvgAutoWrapPrintf(wand," %g",y); + (void) MvgAutoWrapPrintf(wand," %.20g",y); } WandExport void DrawPathLineToVerticalAbsolute(DrawingWand *wand,const double y) @@ -3789,11 +3789,11 @@ static void DrawPathMoveTo(DrawingWand *wand,const PathMode mode,const double x, { wand->path_operation=PathMoveToOperation; wand->path_mode=mode; - (void) MvgAutoWrapPrintf(wand,"%c%g %g",mode == AbsolutePathMode ? + (void) MvgAutoWrapPrintf(wand,"%c%.20g %.20g",mode == AbsolutePathMode ? 'M' : 'm',x,y); } else - (void) MvgAutoWrapPrintf(wand," %g %g",x,y); + (void) MvgAutoWrapPrintf(wand," %.20g %.20g",x,y); } WandExport void DrawPathMoveToAbsolute(DrawingWand *wand,const double x, @@ -3914,7 +3914,7 @@ WandExport void DrawPoint(DrawingWand *wand,const double x,const double y) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"point %g %g\n",x,y); + (void) MvgPrintf(wand,"point %.20g %.20g\n",x,y); } /* @@ -4244,7 +4244,7 @@ WandExport MagickBooleanType DrawPushPattern(DrawingWand *wand, return(MagickFalse); } wand->filter_off=MagickTrue; - (void) MvgPrintf(wand,"push pattern %s %g %g %g %g\n",pattern_id, + (void) MvgPrintf(wand,"push pattern %s %.20g %.20g %.20g %.20g\n",pattern_id, x,y,width,height); wand->indent_depth++; wand->pattern_id=AcquireString(pattern_id); @@ -4293,7 +4293,7 @@ WandExport void DrawRectangle(DrawingWand *wand,const double x1,const double y1, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"rectangle %g %g %g %g\n",x1,y1,x2,y2); + (void) MvgPrintf(wand,"rectangle %.20g %.20g %.20g %.20g\n",x1,y1,x2,y2); } /* @@ -4403,7 +4403,7 @@ WandExport void DrawRotate(DrawingWand *wand,const double degrees) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"rotate %g\n",degrees); + (void) MvgPrintf(wand,"rotate %.20g\n",degrees); } /* @@ -4450,7 +4450,7 @@ WandExport void DrawRoundRectangle(DrawingWand *wand,double x1,double y1, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"roundrectangle %g %g %g %g %g %g\n", + (void) MvgPrintf(wand,"roundrectangle %.20g %.20g %.20g %.20g %.20g %.20g\n", x1,y1,x2,y2,rx,ry); } @@ -4487,7 +4487,7 @@ WandExport void DrawScale(DrawingWand *wand,const double x,const double y) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"scale %g %g\n",x,y); + (void) MvgPrintf(wand,"scale %.20g %.20g\n",x,y); } /* @@ -4772,7 +4772,7 @@ WandExport void DrawSetFillAlpha(DrawingWand *wand,const double fill_alpha) (CurrentContext->fill.alpha != alpha)) { CurrentContext->fill.alpha=alpha; - (void) MvgPrintf(wand,"fill-alpha %g\n",fill_alpha); + (void) MvgPrintf(wand,"fill-alpha %.20g\n",fill_alpha); } } @@ -4813,7 +4813,7 @@ WandExport MagickBooleanType DrawSetFontResolution(DrawingWand *wand, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) FormatLocaleString(density,MaxTextExtent,"%gx%g",x_resolution, + (void) FormatLocaleString(density,MaxTextExtent,"%.20gx%.20g",x_resolution, y_resolution); (void) CloneString(&CurrentContext->density,density); return(MagickTrue); @@ -4858,7 +4858,7 @@ WandExport void DrawSetAlpha(DrawingWand *wand,const double alpha) (CurrentContext->alpha != quantum_alpha)) { CurrentContext->alpha=(Quantum) alpha; - (void) MvgPrintf(wand,"alpha %g\n",alpha); + (void) MvgPrintf(wand,"alpha %.20g\n",alpha); } } @@ -5085,7 +5085,7 @@ WandExport void DrawSetFontSize(DrawingWand *wand,const double pointsize) (fabs(CurrentContext->pointsize-pointsize) >= MagickEpsilon)) { CurrentContext->pointsize=pointsize; - (void) MvgPrintf(wand,"font-size %g\n",pointsize); + (void) MvgPrintf(wand,"font-size %.20g\n",pointsize); } } @@ -5426,13 +5426,13 @@ WandExport void DrawSetStrokeAntialias(DrawingWand *wand, % specify the lengths of alternating dashes and gaps in pixels. If an odd % number of values is provided, then the list of values is repeated to yield % an even number of values. To remove an existing dash array, pass a zero -% number_elements argument and null dash_array. A typical stroke dash array +% number_elements argument and null dasharray. A typical stroke dash array % might contain the members 5 3 2. % % The format of the DrawSetStrokeDashArray method is: % % MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand, -% const size_t number_elements,const double *dash_array) +% const size_t number_elements,const double *dasharray) % % A description of each parameter follows: % @@ -5440,11 +5440,11 @@ WandExport void DrawSetStrokeAntialias(DrawingWand *wand, % % o number_elements: number of elements in dash array % -% o dash_array: dash array values +% o dasharray: dash array values % */ WandExport MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand, - const size_t number_elements,const double *dash_array) + const size_t number_elements,const double *dasharray) { MagickBooleanType update; @@ -5480,9 +5480,9 @@ WandExport MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand, update=MagickTrue; else if ((CurrentContext->dash_pattern != (double *) NULL) && - (dash_array != (double *) NULL)) + (dasharray != (double *) NULL)) { - p=dash_array; + p=dasharray; q=CurrentContext->dash_pattern; for (i=0; i < (ssize_t) n_new; i++) { @@ -5510,21 +5510,22 @@ WandExport MagickBooleanType DrawSetStrokeDashArray(DrawingWand *wand, wand->name); return(MagickFalse); } - q=CurrentContext->dash_pattern; - p=dash_array; - for (i=0; i < (ssize_t) n_new; i++) - *q++=(*p++); - *q=0.0; + for (i=0; i < n_new; i++) + CurrentContext->dash_pattern[i]=dasharray[i]; + CurrentContext->dash_pattern[n_new]=0.0; } (void) MvgPrintf(wand,"stroke-dasharray "); if (n_new == 0) - (void) MvgPrintf(wand,"none"); + (void) MvgPrintf(wand,"none\n"); else { - p=dash_array; - (void) MvgPrintf(wand,"%g",*p++); - for (i=1; i < (ssize_t) n_new; i++) - (void) MvgPrintf(wand,",%g",*p++); + for (i=0; i < n_new; i++) + { + if (i != 0) + (void) MvgPrintf(wand,","); + (void) MvgPrintf(wand,"%.20g",dasharray[i]); + } + (void) MvgPrintf(wand,"\n"); } } return(MagickTrue); @@ -5567,7 +5568,7 @@ WandExport void DrawSetStrokeDashOffset(DrawingWand *wand, (fabs(CurrentContext->dash_offset-dash_offset) >= MagickEpsilon)) { CurrentContext->dash_offset=dash_offset; - (void) MvgPrintf(wand,"stroke-dashoffset %g\n",dash_offset); + (void) MvgPrintf(wand,"stroke-dashoffset %.20g\n",dash_offset); } } @@ -5738,7 +5739,7 @@ WandExport void DrawSetStrokeAlpha(DrawingWand *wand, (CurrentContext->stroke.alpha != alpha)) { CurrentContext->stroke.alpha=alpha; - (void) MvgPrintf(wand,"stroke-alpha %g\n",stroke_alpha); + (void) MvgPrintf(wand,"stroke-alpha %.20g\n",stroke_alpha); } } @@ -5778,7 +5779,7 @@ WandExport void DrawSetStrokeWidth(DrawingWand *wand,const double stroke_width) (fabs(CurrentContext->stroke_width-stroke_width) >= MagickEpsilon)) { CurrentContext->stroke_width=stroke_width; - (void) MvgPrintf(wand,"stroke-width %g\n",stroke_width); + (void) MvgPrintf(wand,"stroke-width %.20g\n",stroke_width); } } @@ -6460,7 +6461,7 @@ WandExport void DrawSkewX(DrawingWand *wand,const double degrees) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"skewX %g\n",degrees); + (void) MvgPrintf(wand,"skewX %.20g\n",degrees); } /* @@ -6494,7 +6495,7 @@ WandExport void DrawSkewY(DrawingWand *wand,const double degrees) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"skewY %g\n",degrees); + (void) MvgPrintf(wand,"skewY %.20g\n",degrees); } /* @@ -6532,7 +6533,7 @@ WandExport void DrawTranslate(DrawingWand *wand,const double x,const double y) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - (void) MvgPrintf(wand,"translate %g %g\n",x,y); + (void) MvgPrintf(wand,"translate %.20g %.20g\n",x,y); } /*