{
j=i;
i--;
- alpha=(offset-gradient->stops[i].offset)/
+ alpha=100.0*(offset-gradient->stops[i].offset)/
(gradient->stops[j].offset-gradient->stops[i].offset);
CompositePixelInfoBlend(&gradient->stops[i].color,1.0-alpha,
&gradient->stops[j].color,alpha,&composite);
number_stops++;
if (number_stops == 1)
stops=(StopInfo *) AcquireQuantumMemory(2,sizeof(*stops));
- else if (number_stops > 2)
- stops=(StopInfo *) ResizeQuantumMemory(stops,number_stops,
- sizeof(*stops));
+ else
+ if (number_stops > 2)
+ stops=(StopInfo *) ResizeQuantumMemory(stops,number_stops,
+ sizeof(*stops));
if (stops == (StopInfo *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
if (LocaleCompare((const char *) name,"text") == 0)
{
PushGraphicContext(id);
+ (void) FormatLocaleFile(svg_info->file,"translate %g,%g\n",
+ svg_info->bounds.x,svg_info->bounds.y);
+ svg_info->center.x=svg_info->bounds.x;
+ svg_info->center.y=svg_info->bounds.y;
svg_info->bounds.x=0.0;
svg_info->bounds.y=0.0;
svg_info->bounds.width=0.0;
*text;
text=EscapeString(svg_info->text,'\'');
- (void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n",
- svg_info->bounds.x,svg_info->bounds.y,text);
+ (void) FormatLocaleFile(svg_info->file,"text 0,0 \"%s\"\n",text);
text=DestroyString(text);
*svg_info->text='\0';
}
text=EscapeString(svg_info->text,'\'');
(void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n",
- svg_info->bounds.x,svg_info->bounds.y,text);
+ svg_info->bounds.x-svg_info->center.x,svg_info->bounds.y-svg_info->center.y,text);
text=DestroyString(text);
draw_info=CloneDrawInfo(svg_info->image_info,(DrawInfo *) NULL);
draw_info->pointsize=svg_info->pointsize;