📄 main.c
字号:
!strcmp(name, "svg.AnimateCommon.attr") ||
!strcmp(name, "svg.XLinkEmbed.attr") ||
!strcmp(name, "svg.XLinkRequired.attr") ||
!strcmp(name, "svg.XLinkReplace.attr") ||
!strcmp(name, "svg.ContentType.attr") ||
!strcmp(name, "svg.AnimateTiming.attr") ||
!strcmp(name, "svg.AnimateTimingNoMinMax.attr") ||
!strcmp(name, "svg.AnimateBegin.attr") ||
!strcmp(name, "svg.AnimateTimingNoFillNoMinMax.attr") ||
!strcmp(name, "svg.AnimateSync.attr") ||
!strcmp(name, "svg.AnimateSyncDefault.attr") ||
!strcmp(name, "svg.AnimateAttributeCommon.attr") ||
!strcmp(name, "svg.AnimateToCommon.attr") ||
!strcmp(name, "svg.AnimateValueCommon.attr") ||
!strcmp(name, "svg.AnimateAdditionCommon.attr") ||
!strcmp(name, "svg.AnimateTypeCommon.attr") ||
!strcmp(name, "svg.Conditional.attr") ||
// !strcmp(name, "svg.XY.attr") ||
!strcmp(name, "svg.Transform.attr")) {
return 1;
} else {
return 0;
}
}
static Bool setGenericAttributesFlags(char *name, SVGElement *e)
{
Bool ret = 1;
if (!strcmp(name, "svg.Core.attr") ||
!strcmp(name, "svg.CorePreserve.attr") ||
!strcmp(name, "svg.External.attr")) {
e->has_svg_generic = 1;
e->has_xml_generic = 1;
} else if (!strcmp(name, "svg.Properties.attr")) {
e->has_properties = 1;
} else if (!strcmp(name, "svg.Media.attr")) {
e->has_properties = 1;
} else if (!strcmp(name, "svg.Opacity.attr")) {
e->has_properties = 1;
} else if (!strcmp(name, "svg.FocusHighlight.attr") ||
!strcmp(name, "svg.Focus.attr")) {
e->has_focus = 1;
} else if (!strcmp(name, "svg.AnimateCommon.attr") ||
!strcmp(name, "svg.XLinkEmbed.attr") ||
!strcmp(name, "svg.XLinkRequired.attr") ||
!strcmp(name, "svg.XLinkReplace.attr") ||
!strcmp(name, "svg.ContentType.attr")) {
e->has_xlink = 1;
} else if (!strcmp(name, "svg.AnimateTiming.attr") ||
!strcmp(name, "svg.AnimateTimingNoMinMax.attr") ||
!strcmp(name, "svg.AnimateBegin.attr") ||
!strcmp(name, "svg.AnimateTimingNoFillNoMinMax.attr")) {
e->has_timing = 1;
} else if (!strcmp(name, "svg.AnimateSync.attr") ||
!strcmp(name, "svg.AnimateSyncDefault.attr")) {
e->has_sync= 1;
} else if (!strcmp(name, "svg.AnimateAttributeCommon.attr") ||
!strcmp(name, "svg.AnimateToCommon.attr") ||
!strcmp(name, "svg.AnimateValueCommon.attr") ||
!strcmp(name, "svg.AnimateAdditionCommon.attr") ||
!strcmp(name, "svg.AnimateTypeCommon.attr")) {
e->has_animation = 1;
} else if (!strcmp(name, "svg.Conditional.attr")) {
e->has_conditional = 1;
} else if (!strcmp(name, "svg.Transform.attr")) {
e->has_transform = 1;
} else if (!strcmp(name, "svg.XY.attr")) {
e->has_xy = 1;
} else {
ret = 0;
}
return ret;
}
static void flattenAttributeGroup(SVGAttrGrp attgrp, SVGElement *e, Bool all);
static void flattenAttributeGroups(GF_List *attrgrps, SVGElement *e, Bool all)
{
u32 i;
for (i = 0; i < gf_list_count(attrgrps); i ++) {
SVGAttrGrp *ag = gf_list_get(attrgrps, i);
flattenAttributeGroup(*ag, e, all);
}
}
static void flattenAttributeGroup(SVGAttrGrp attgrp, SVGElement *e, Bool all)
{
u32 i;
if (isGenericAttributesGroup(attgrp.name) && !all) {
setGenericAttributesFlags(attgrp.name, e);
flattenAttributeGroups(attgrp.attrgrps, e, 1);
for (i = 0; i < gf_list_count(attgrp.attrs); i++) {
gf_list_add(e->generic_attributes, gf_list_get(attgrp.attrs, i));
}
} else {
flattenAttributeGroups(attgrp.attrgrps, e, all);
for (i = 0; i < gf_list_count(attgrp.attrs); i++) {
if (all)
gf_list_add(e->generic_attributes, gf_list_get(attgrp.attrs, i));
else
gf_list_add(e->attributes, gf_list_get(attgrp.attrs, i));
}
}
}
static SVGAttribute *findAttribute(SVGElement *e, char *name)
{
u32 i;
for (i = 0; i < gf_list_count(e->attributes); i++) {
SVGAttribute *a = gf_list_get(e->attributes, i);
if (!strcmp(a->svg_name, name)) return a;
}
for (i = 0; i < gf_list_count(e->generic_attributes); i++) {
SVGAttribute *a = gf_list_get(e->generic_attributes, i);
if (!strcmp(a->svg_name, name)) return a;
}
return NULL;
}
static u32 countAttributesAllInGroup(SVGAttrGrp *ag)
{
u32 i, ret = 0;
for (i = 0; i < gf_list_count(ag->attrgrps); i ++) {
SVGAttrGrp *agtmp = gf_list_get(ag->attrgrps, i);
ret += countAttributesAllInGroup(agtmp);
}
ret += gf_list_count(ag->attrs);
return ret;
}
/* XML related functions */
xmlNodeSetPtr findNodes( xmlXPathContextPtr ctxt, xmlChar * path )
{
xmlXPathObjectPtr res = NULL;
if ( ctxt->node != NULL && path != NULL ) {
xmlXPathCompExprPtr comp;
xmlDocPtr tdoc = NULL;
xmlNodePtr froot = ctxt->node;
comp = xmlXPathCompile( path );
if ( comp == NULL ) {
return NULL;
}
if ( ctxt->node->doc == NULL ) {
/* if one XPaths a node from a fragment, libxml2 will
refuse the lookup. this is not very usefull for XML
scripters. thus we need to create a temporary document
to make libxml2 do it's job correctly.
*/
tdoc = xmlNewDoc( NULL );
/* find refnode's root node */
while ( froot != NULL ) {
if ( froot->parent == NULL ) {
break;
}
froot = froot->parent;
}
xmlAddChild((xmlNodePtr)tdoc, froot);
ctxt->node->doc = tdoc;
}
res = xmlXPathCompiledEval(comp, ctxt);
xmlXPathFreeCompExpr(comp);
if ( tdoc != NULL ) {
/* after looking through a fragment, we need to drop the
fake document again */
xmlSetTreeDoc(froot,NULL);
froot->doc = NULL;
tdoc->children = NULL;
tdoc->last = NULL;
froot->parent = NULL;
ctxt->node->doc = NULL;
xmlFreeDoc( tdoc );
}
}
if (res && res->type == XPATH_NODESET)
return res->nodesetval;
else
return NULL;
}
/* definition of GPAC groups of SVG attributes */
void setAttributeType(SVGAttribute *att)
{
if (!att->svg_type) {
if (!strcmp(att->svg_name, "textContent")) {
strcpy(att->impl_type, "SVG_TextContent");
} else if (!strcmp(att->svg_name, "class")) {
strcpy(att->implementation_name, "_class");
strcpy(att->impl_type, "SVG_String");
} else if (!strcmp(att->svg_name, "visibility")) {
strcpy(att->impl_type, "SVG_Visibility");
} else if (!strcmp(att->svg_name, "display")) {
strcpy(att->impl_type, "SVG_Display");
} else if (!strcmp(att->svg_name, "stroke-linecap")) {
strcpy(att->impl_type, "SVG_StrokeLineCap");
} else if (!strcmp(att->svg_name, "stroke-dasharray")) {
strcpy(att->impl_type, "SVG_StrokeDashArray");
} else if (!strcmp(att->svg_name, "stroke-linejoin")) {
strcpy(att->impl_type, "SVG_StrokeLineJoin");
} else if (!strcmp(att->svg_name, "font-style")) {
strcpy(att->impl_type, "SVG_FontStyle");
} else if (!strcmp(att->svg_name, "font-weight")) {
strcpy(att->impl_type, "SVG_FontWeight");
} else if (!strcmp(att->svg_name, "text-anchor")) {
strcpy(att->impl_type, "SVG_TextAnchor");
} else if (!strcmp(att->svg_name, "fill")) {
strcpy(att->impl_type, "SMIL_Fill");
} else if (!strcmp(att->svg_name, "fill-rule")) {
strcpy(att->impl_type, "SVG_FillRule");
} else if (!strcmp(att->svg_name, "font-family")) {
strcpy(att->impl_type, "SVG_FontFamily");
} else if (!strcmp(att->svg_name, "stroke-miterlimit")) {
strcpy(att->impl_type, "SVG_StrokeMiterLimit");
} else if (!strcmp(att->svg_name, "stroke-width")) {
strcpy(att->impl_type, "SVG_StrokeWidth");
} else if (!strcmp(att->svg_name, "calcMode")) {
strcpy(att->impl_type, "SMIL_CalcMode");
} else if (!strcmp(att->svg_name, "values")) {
strcpy(att->impl_type, "SMIL_AnimateValues");
} else if (!strcmp(att->svg_name, "keyTimes")) {
strcpy(att->impl_type, "SMIL_KeyTimes");
} else if (!strcmp(att->svg_name, "keySplines")) {
strcpy(att->impl_type, "SMIL_KeySplines");
} else if (!strcmp(att->svg_name, "keyPoints")) {
strcpy(att->impl_type, "SMIL_KeyPoints");
} else if (!strcmp(att->svg_name, "from") || !strcmp(att->svg_name, "to") || !strcmp(att->svg_name, "by")) {
strcpy(att->impl_type, "SMIL_AnimateValue");
} else if (!strcmp(att->svg_name, "additive")) {
strcpy(att->impl_type, "SMIL_Additive");
} else if (!strcmp(att->svg_name, "accumulate")) {
strcpy(att->impl_type, "SMIL_Accumulate");
} else if (!strcmp(att->svg_name, "begin") ||
!strcmp(att->svg_name, "end") ||
!strcmp(att->svg_name, "lsr:begin")
) {
strcpy(att->impl_type, "SMIL_Times");
} else if (!strcmp(att->svg_name, "clipBegin") ||
!strcmp(att->svg_name, "clipEnd")
) {
strcpy(att->impl_type, "SVG_Clock");
} else if (!strcmp(att->svg_name, "min") ||
!strcmp(att->svg_name, "max") ||
!strcmp(att->svg_name, "dur") ||
!strcmp(att->svg_name, "repeatDur")
) {
strcpy(att->impl_type, "SMIL_Duration");
} else if (!strcmp(att->svg_name, "repeat")) {
strcpy(att->impl_type, "SMIL_Repeat");
} else if (!strcmp(att->svg_name, "restart")) {
strcpy(att->impl_type, "SMIL_Restart");
} else if (!strcmp(att->svg_name, "repeatCount")) {
strcpy(att->impl_type, "SMIL_RepeatCount");
} else if (!strcmp(att->svg_name, "attributeName")) {
strcpy(att->impl_type, "SMIL_AttributeName");
} else if (!strcmp(att->svg_name, "type")) {
strcpy(att->impl_type, "SVG_TransformType");
} else if (!strcmp(att->svg_name, "font-size")) {
strcpy(att->impl_type, "SVG_FontSize");
} else if (!strcmp(att->svg_name, "viewBox")) {
strcpy(att->impl_type, "SVG_ViewBox");
} else if (!strcmp(att->svg_name, "preserveAspectRatio")) {
strcpy(att->impl_type, "SVG_PreserveAspectRatio");
} else if (!strcmp(att->svg_name, "zoomAndPan")) {
strcpy(att->impl_type, "SVG_ZoomAndPan");
} else if (!strcmp(att->svg_name, "path")) {
strcpy(att->impl_type, "SVG_PathData");
} else if (!strcmp(att->svg_name, "image-rendering")) {
strcpy(att->impl_type, "SVG_RenderingHint");
} else if (!strcmp(att->svg_name, "color-rendering")) {
strcpy(att->impl_type, "SVG_RenderingHint");
} else if (!strcmp(att->svg_name, "text-rendering")) {
strcpy(att->impl_type, "SVG_RenderingHint");
} else if (!strcmp(att->svg_name, "shape-rendering")) {
strcpy(att->impl_type, "SVG_RenderingHint");
} else if (!strcmp(att->svg_name, "pointer-events")) {
strcpy(att->impl_type, "SVG_PointerEvents");
} else if (!strcmp(att->svg_name, "vector-effect")) {
strcpy(att->impl_type, "SVG_VectorEffect");
} else if (!strcmp(att->svg_name, "vector-effect")) {
strcpy(att->impl_type, "SVG_VectorEffect");
} else if (!strcmp(att->svg_name, "display-align")) {
strcpy(att->impl_type, "SVG_DisplayAlign");
} else if (!strcmp(att->svg_name, "propagate")) {
strcpy(att->impl_type, "XMLEV_Propagate");
} else if (!strcmp(att->svg_name, "defaultAction")) {
strcpy(att->impl_type, "XMLEV_DefaultAction");
} else if (!strcmp(att->svg_name, "phase")) {
strcpy(att->impl_type, "XMLEV_Phase");
} else if (!strcmp(att->svg_name, "syncBehavior")) {
strcpy(att->impl_type, "SMIL_SyncBehavior");
} else if (!strcmp(att->svg_name, "syncBehaviorDefault")) {
strcpy(att->impl_type, "SMIL_SyncBehavior");
} else if (!strcmp(att->svg_name, "attributeType")) {
strcpy(att->impl_type, "SMIL_AttributeType");
} else if (!strcmp(att->svg_name, "playbackOrder")) {
strcpy(att->impl_type, "SVG_PlaybackOrder");
} else if (!strcmp(att->svg_name, "timelineBegin")) {
strcpy(att->impl_type, "SVG_TimelineBegin");
} else if (!strcmp(att->svg_name, "xml:space")) {
strcpy(att->impl_type, "XML_Space");
} else if (!strcmp(att->svg_name, "snapshotTime")) {
strcpy(att->impl_type, "SVG_Clock");
} else if (!strcmp(att->svg_name, "version")) {
strcpy(att->impl_type, "SVG_String");
} else if (!strcmp(att->svg_name, "gradientUnits")) {
strcpy(att->impl_type, "SVG_GradientUnit");
} else if (!strcmp(att->svg_name, "baseProfile")) {
strcpy(att->impl_type, "SVG_String");
} else if (!strcmp(att->svg_name, "focusHighlight")) {
strcpy(att->impl_type, "SVG_FocusHighlight");
} else if (!strcmp(att->svg_name, "initialVisibility")) {
strcpy(att->impl_type, "SVG_InitialVisibility");
} else if (!strcmp(att->svg_name, "overlay")) {
strcpy(att->impl_type, "SVG_Overlay");
} else if (!strcmp(att->svg_name, "transformBehavior")) {
strcpy(att->impl_type, "SVG_TransformBehavior");
} else if (!strcmp(att->svg_name, "rotate")) {
strcpy(att->impl_type, "SVG_Rotate");
} else if (!strcmp(att->svg_name, "font-variant")) {
strcpy(att->impl_type, "SVG_FontVariant");
} else if (!strcmp(att->svg_name, "lsr:enabled")) {
strcpy(att->impl_type, "SVG_Boolean");
} else if (!strcmp(att->svg_name, "choice")) {
strcpy(att->impl_type, "LASeR_Choice");
} else if (!strcmp(att->svg_name, "size") || !strcmp(att->svg_name, "delta")) {
strcpy(att->impl_type, "LASeR_Size");
} else if (!strcmp(att->svg_name, "spreadMethod")) {
strcpy(att->impl_type, "SVG_SpreadMethod");
} else if (!strcmp(att->svg_name, "gradientTransform")) {
strcpy(att->impl_type, "SVG_Matrix");
} else {
strcpy(att->impl_type, "SVG_String");
fprintf(stdout, "Warning: using type SVG_String for attribute %s.\n", att->svg_name);
}
} else {
if (!strcmp(att->svg_name, "fill-opacity")) {
strcpy(att->impl_type, "SVG_Opacity");
} else if (!strcmp(att->svg_name, "opacity")) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -