return((size_t) floor((angle.y-angle.x)/step+0.5)+3);
}
-static char *GetNodeByID(const char *primitive,const char *id)
+static char *GetGroupByURL(const char *primitive,const char *url)
{
char
*token;
if (*q == '"')
{
GetNextToken(q,&q,extent,token);
- if (LocaleCompare(id,token) == 0)
+ if (LocaleCompare(url,token) == 0)
{
/*
Start of group by ID.
defsDepth,
j,
k,
- n;
+ n,
+ symbolDepth;
StopInfo
*stops;
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
defsDepth=0;
+ symbolDepth=0;
status=MagickTrue;
for (q=primitive; *q != '\0'; )
{
}
if (LocaleCompare("pattern",token) == 0)
break;
+ if (LocaleCompare("symbol",token) == 0)
+ {
+ symbolDepth--;
+ graphic_context[n]->render=symbolDepth > 0 ? MagickFalse :
+ MagickTrue;
+ break;
+ }
status=MagickFalse;
break;
}
GetNextToken(q,&q,extent,token);
break;
}
+ if (LocaleCompare("defs",token) == 0)
+ {
+ defsDepth++;
+ graphic_context[n]->render=defsDepth > 0 ? MagickFalse :
+ MagickTrue;
+ break;
+ }
if (LocaleCompare("gradient",token) == 0)
{
char
GetNextToken(q,&q,extent,token);
break;
}
+ if (LocaleCompare("graphic-context",token) == 0)
+ {
+ n++;
+ graphic_context=(DrawInfo **) ResizeQuantumMemory(
+ graphic_context,(size_t) (n+1),sizeof(*graphic_context));
+ if (graphic_context == (DrawInfo **) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ ResourceLimitError,"MemoryAllocationFailed","`%s'",
+ image->filename);
+ break;
+ }
+ graphic_context[n]=CloneDrawInfo((ImageInfo *) NULL,
+ graphic_context[n-1]);
+ if (*q == '"')
+ GetNextToken(q,&q,extent,token);
+ break;
+ }
if (LocaleCompare("pattern",token) == 0)
{
char
GetNextToken(q,&q,extent,token);
break;
}
- if (LocaleCompare("graphic-context",token) == 0)
- {
- n++;
- graphic_context=(DrawInfo **) ResizeQuantumMemory(
- graphic_context,(size_t) (n+1),sizeof(*graphic_context));
- if (graphic_context == (DrawInfo **) NULL)
- {
- (void) ThrowMagickException(exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",
- image->filename);
- break;
- }
- graphic_context[n]=CloneDrawInfo((ImageInfo *) NULL,
- graphic_context[n-1]);
- if (*q == '"')
- GetNextToken(q,&q,extent,token);
- break;
- }
- if (LocaleCompare("defs",token) == 0)
+ if (LocaleCompare("symbol",token) == 0)
{
- defsDepth++;
- graphic_context[n]->render=defsDepth > 0 ? MagickFalse :
+ symbolDepth++;
+ graphic_context[n]->render=symbolDepth > 0 ? MagickFalse :
MagickTrue;
break;
}
if (LocaleCompare("use",keyword) == 0)
{
char
- *node;
+ *group;
/*
Take a node from within the MVG document, and duplicate it here.
*/
GetNextToken(q,&q,extent,token);
- node=GetNodeByID(primitive,token);
- if (node != (char *) NULL)
+ group=GetGroupByURL(primitive,token);
+ if (group != (char *) NULL)
{
DrawInfo
*clone_info;
clone_info=CloneDrawInfo((ImageInfo *) NULL,graphic_context[n]);
- (void) CloneString(&clone_info->primitive,node);
- node=DestroyString(node);
+ (void) CloneString(&clone_info->primitive,group);
+ group=DestroyString(group);
status=DrawImage(image,clone_info,exception);
clone_info=DestroyDrawInfo(clone_info);
}
case 'S':
case 's':
{
+ if (LocaleCompare((const char *) name,"symbol") == 0)
+ {
+ (void) FormatLocaleFile(svg_info->file,"push symbol\n");
+ break;
+ }
if (LocaleCompare((const char *) name,"svg") == 0)
{
PushGraphicContext(id);
}
if (LocaleCompare(keyword,"href") == 0)
{
- if (*value != '#')
- (void) CloneString(&svg_info->url,value);
- else
- (void) CloneString(&svg_info->url,value+1);
+ (void) CloneString(&svg_info->url,value);
break;
}
break;
}
if (LocaleCompare(keyword,"xlink:href") == 0)
{
- if (*value != '#')
- (void) CloneString(&svg_info->url,value);
- else
- (void) CloneString(&svg_info->url,value+1);
+ (void) CloneString(&svg_info->url,value);
break;
}
if (LocaleCompare(keyword,"x1") == 0)
svg_info->stop_color,svg_info->offset);
break;
}
+ if (LocaleCompare((const char *) name,"symbol") == 0)
+ {
+ (void) FormatLocaleFile(svg_info->file,"pop symbol\n");
+ break;
+ }
if (LocaleCompare((const char *) name,"svg") == 0)
{
(void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
if ((svg_info->bounds.x != 0.0) || (svg_info->bounds.y != 0.0))
(void) FormatLocaleFile(svg_info->file,"translate %g,%g\n",
svg_info->bounds.x,svg_info->bounds.y);
- (void) FormatLocaleFile(svg_info->file,"use \"%s\"\n",svg_info->url);
+ (void) FormatLocaleFile(svg_info->file,"use \"url(%s)\"\n",
+ svg_info->url);
(void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
break;
}
(void) WriteBlobString(image,"</pattern>\n");
break;
}
- if (LocaleCompare("defs",token) == 0)
- (void) WriteBlobString(image,"</g>\n");
+ if (LocaleCompare("symbol",token) == 0)
+ {
+ (void) WriteBlobString(image,"</symbol>\n");
+ break;
+ }
+ if ((LocaleCompare("defs",token) == 0) ||
+ (LocaleCompare("symbol",token) == 0))
+ (void) WriteBlobString(image,"</g>\n");
break;
}
if (LocaleCompare("push",keyword) == 0)
(void) WriteBlobString(image,message);
break;
}
+ if (LocaleCompare("symbol",token) == 0)
+ {
+ (void) WriteBlobString(image,"<symbol>\n");
+ break;
+ }
break;
}
status=MagickFalse;