📄 svg_properties.c
字号:
if (elt->properties->font_family.type != SVG_FONTFAMILY_INHERIT) { render_svg_props->font_family = &elt->properties->font_family; } else { inherited_flags_mask |= GF_SG_SVG_FONTFAMILY_DIRTY; } if (elt->properties->font_size.type != SVG_NUMBER_INHERIT) { render_svg_props->font_size = &elt->properties->font_size; } else { inherited_flags_mask |= GF_SG_SVG_FONTSIZE_DIRTY; } if (elt->properties->font_style != SVG_FONTSTYLE_INHERIT) { render_svg_props->font_style = &elt->properties->font_style; } else { inherited_flags_mask |= GF_SG_SVG_FONTSTYLE_DIRTY; } if (elt->properties->font_variant != SVG_FONTVARIANT_INHERIT) { render_svg_props->font_variant = &elt->properties->font_variant; } else { inherited_flags_mask |= GF_SG_SVG_FONTVARIANT_DIRTY; } if (elt->properties->font_weight!= SVG_FONTWEIGHT_INHERIT) { render_svg_props->font_weight = &elt->properties->font_weight; } else { inherited_flags_mask |= GF_SG_SVG_FONTWEIGHT_DIRTY; } if (elt->properties->image_rendering != SVG_RENDERINGHINT_INHERIT) { render_svg_props->image_rendering = &elt->properties->image_rendering; } if (elt->properties->line_increment.type != SVG_NUMBER_INHERIT) { render_svg_props->line_increment = &elt->properties->line_increment; } else { inherited_flags_mask |= GF_SG_SVG_LINEINCREMENT_DIRTY; } if (elt->properties->opacity.type != SVG_NUMBER_INHERIT) { render_svg_props->opacity = &elt->properties->opacity; } else { inherited_flags_mask |= GF_SG_SVG_OPACITY_DIRTY; } if (elt->properties->pointer_events != SVG_POINTEREVENTS_INHERIT) { render_svg_props->pointer_events = &elt->properties->pointer_events; } if (elt->properties->shape_rendering != SVG_RENDERINGHINT_INHERIT) { render_svg_props->shape_rendering = &elt->properties->shape_rendering; } if (elt->properties->solid_color.type != SVG_PAINT_INHERIT) { render_svg_props->solid_color = &(elt->properties->solid_color); if (elt->properties->solid_color.type == SVG_PAINT_COLOR && elt->properties->solid_color.color.type == SVG_COLOR_CURRENTCOLOR && (inherited_flags_mask & GF_SG_SVG_COLOR_DIRTY)) { inherited_flags_mask |= GF_SG_SVG_SOLIDCOLOR_DIRTY; } } else { inherited_flags_mask |= GF_SG_SVG_SOLIDCOLOR_DIRTY; } if (elt->properties->solid_opacity.type != SVG_NUMBER_INHERIT) { render_svg_props->solid_opacity = &elt->properties->solid_opacity; } else { inherited_flags_mask |= GF_SG_SVG_SOLIDOPACITY_DIRTY; } if (elt->properties->stop_color.type != SVG_PAINT_INHERIT) { render_svg_props->stop_color = &(elt->properties->stop_color); if (elt->properties->stop_color.type == SVG_PAINT_COLOR && elt->properties->stop_color.color.type == SVG_COLOR_CURRENTCOLOR && (inherited_flags_mask & GF_SG_SVG_COLOR_DIRTY)) { inherited_flags_mask |= GF_SG_SVG_STOPCOLOR_DIRTY; } } else { inherited_flags_mask |= GF_SG_SVG_STOPCOLOR_DIRTY; } if (elt->properties->stop_opacity.type != SVG_NUMBER_INHERIT) { render_svg_props->stop_opacity = &elt->properties->stop_opacity; } else { inherited_flags_mask |= GF_SG_SVG_STOPOPACITY_DIRTY; } if (elt->properties->stroke.type != SVG_PAINT_INHERIT) { render_svg_props->stroke = &elt->properties->stroke; if (elt->properties->stroke.type == SVG_PAINT_COLOR && elt->properties->stroke.color.type == SVG_COLOR_CURRENTCOLOR && (inherited_flags_mask & GF_SG_SVG_COLOR_DIRTY)) { inherited_flags_mask |= GF_SG_SVG_STROKE_DIRTY; } } else { inherited_flags_mask |= GF_SG_SVG_STROKE_DIRTY; } if (elt->properties->stroke_dasharray.type != SVG_STROKEDASHARRAY_INHERIT) { render_svg_props->stroke_dasharray = &elt->properties->stroke_dasharray; } else { inherited_flags_mask |= GF_SG_SVG_STROKEDASHARRAY_DIRTY; } if (elt->properties->stroke_dashoffset.type != SVG_NUMBER_INHERIT) { render_svg_props->stroke_dashoffset = &elt->properties->stroke_dashoffset; } else { inherited_flags_mask |= GF_SG_SVG_STROKEDASHOFFSET_DIRTY; } if (elt->properties->stroke_linecap != SVG_STROKELINECAP_INHERIT) { render_svg_props->stroke_linecap = &elt->properties->stroke_linecap; } else { inherited_flags_mask |= GF_SG_SVG_STROKELINECAP_DIRTY; } if (elt->properties->stroke_linejoin != SVG_STROKELINEJOIN_INHERIT) { render_svg_props->stroke_linejoin = &elt->properties->stroke_linejoin; } else { inherited_flags_mask |= GF_SG_SVG_STROKELINEJOIN_DIRTY; } if (elt->properties->stroke_miterlimit.type != SVG_NUMBER_INHERIT) { render_svg_props->stroke_miterlimit = &elt->properties->stroke_miterlimit; } else { inherited_flags_mask |= GF_SG_SVG_STROKEMITERLIMIT_DIRTY; } if (elt->properties->stroke_opacity.type != SVG_NUMBER_INHERIT) { render_svg_props->stroke_opacity = &elt->properties->stroke_opacity; } else { inherited_flags_mask |= GF_SG_SVG_STROKEOPACITY_DIRTY; } if (elt->properties->stroke_width.type != SVG_NUMBER_INHERIT) { render_svg_props->stroke_width = &elt->properties->stroke_width; } else { inherited_flags_mask |= GF_SG_SVG_STROKEWIDTH_DIRTY; } if (elt->properties->text_align != SVG_TEXTALIGN_INHERIT) { render_svg_props->text_align = &elt->properties->text_align; } else { inherited_flags_mask |= GF_SG_SVG_TEXTALIGN_DIRTY; } if (elt->properties->text_anchor != SVG_TEXTANCHOR_INHERIT) { render_svg_props->text_anchor = &elt->properties->text_anchor; } else { inherited_flags_mask |= GF_SG_SVG_TEXTANCHOR_DIRTY; } if (elt->properties->text_rendering != SVG_RENDERINGHINT_INHERIT) { render_svg_props->text_rendering = &elt->properties->text_rendering; } if (elt->properties->vector_effect != SVG_VECTOREFFECT_INHERIT) { render_svg_props->vector_effect = &elt->properties->vector_effect; } else { inherited_flags_mask |= GF_SG_SVG_VECTOREFFECT_DIRTY; } if (elt->properties->viewport_fill.type != SVG_PAINT_INHERIT) { render_svg_props->viewport_fill = &elt->properties->viewport_fill; } if (elt->properties->viewport_fill_opacity.type != SVG_NUMBER_INHERIT) { render_svg_props->viewport_fill_opacity = &elt->properties->viewport_fill_opacity; } if (elt->properties->visibility != SVG_VISIBILITY_INHERIT) { render_svg_props->visibility = &elt->properties->visibility; } } return inherited_flags_mask;}#endifvoid *gf_svg_get_property_pointer(SVG_Element *elt, void *input_attribute, SVGPropertiesPointers *output_property_context){ SVGAttribute *att = elt->attributes; while (att) { if (att->data == input_attribute) break; att = att->next; } if (!att) return NULL; switch (att->tag) { case TAG_SVG_ATT_audio_level: return output_property_context->audio_level; case TAG_SVG_ATT_color: return output_property_context->color; case TAG_SVG_ATT_color_rendering: return output_property_context->color_rendering; case TAG_SVG_ATT_display: return output_property_context->display; case TAG_SVG_ATT_display_align: return output_property_context->display_align; case TAG_SVG_ATT_fill: return output_property_context->fill; case TAG_SVG_ATT_fill_opacity: return output_property_context->fill_opacity; case TAG_SVG_ATT_fill_rule: return output_property_context->fill_rule; case TAG_SVG_ATT_font_family: return output_property_context->font_family; case TAG_SVG_ATT_font_size: return output_property_context->font_size; case TAG_SVG_ATT_font_style: return output_property_context->font_style; case TAG_SVG_ATT_font_variant: return output_property_context->font_variant; case TAG_SVG_ATT_font_weight: return output_property_context->font_weight; case TAG_SVG_ATT_image_rendering: return output_property_context->image_rendering; case TAG_SVG_ATT_line_increment: return output_property_context->line_increment; case TAG_SVG_ATT_opacity: return output_property_context->opacity; case TAG_SVG_ATT_pointer_events: return output_property_context->pointer_events; case TAG_SVG_ATT_shape_rendering: return output_property_context->shape_rendering; case TAG_SVG_ATT_solid_color: return output_property_context->solid_color; case TAG_SVG_ATT_solid_opacity: return output_property_context->solid_opacity; case TAG_SVG_ATT_stop_color: return output_property_context->stop_color; case TAG_SVG_ATT_stop_opacity: return output_property_context->stop_opacity; case TAG_SVG_ATT_stroke: return output_property_context->stroke; case TAG_SVG_ATT_stroke_dasharray: return output_property_context->stroke_dasharray; case TAG_SVG_ATT_stroke_dashoffset: return output_property_context->stroke_dashoffset; case TAG_SVG_ATT_stroke_linecap: return output_property_context->stroke_linecap; case TAG_SVG_ATT_stroke_linejoin: return output_property_context->stroke_linejoin; case TAG_SVG_ATT_stroke_miterlimit: return output_property_context->stroke_miterlimit; case TAG_SVG_ATT_stroke_opacity: return output_property_context->stroke_opacity; case TAG_SVG_ATT_stroke_width: return output_property_context->stroke_width; case TAG_SVG_ATT_text_align: return output_property_context->text_align; case TAG_SVG_ATT_text_anchor: return output_property_context->text_anchor; case TAG_SVG_ATT_text_rendering: return output_property_context->text_rendering; case TAG_SVG_ATT_vector_effect: return output_property_context->vector_effect; case TAG_SVG_ATT_viewport_fill: return output_property_context->viewport_fill; case TAG_SVG_ATT_viewport_fill_opacity: return output_property_context->viewport_fill_opacity; case TAG_SVG_ATT_visibility: return output_property_context->visibility; default:return NULL; }}#ifdef GPAC_ENABLE_SVG_SA/* Equivalent to "get_property_pointer_by_name" but without string comparison Returns a pointer to the property in the given output property context based on the input attribute and the input property context. output_property_context: contains a list of pointers to the CSS properties input_property_context: contains a list of the CSS properties of a given SVG element, input_attribute: is the pointer to attribute of the same SVG element and which has the same name as the property we want Principle: if the address of the attribute NNN is equal to the pointer input_property_context->XXX, then we return the property output_property_context->XXX (ie. output_property_context->XXX)*/void *gf_svg_sa_get_property_pointer(SVGPropertiesPointers *output_property_context, SVGProperties *input_property_context, void *input_attribute){ if (!output_property_context || !input_property_context) return NULL; else if (input_attribute == &input_property_context->audio_level) return output_property_context->audio_level; else if (input_attribute == &input_property_context->color) return output_property_context->color; else if (input_attribute == &input_property_context->color_rendering) return output_property_context->color_rendering; else if (input_attribute == &input_property_context->display) return output_property_context->display; else if (input_attribute == &input_property_context->display_align) return output_property_context->display_align; else if (input_attribute == &input_property_context->fill) return output_property_context->fill; else if (input_attribute == &input_property_context->fill_opacity) return output_property_context->fill_opacity; else if (input_attribute == &input_property_context->fill_rule) return output_property_context->fill_rule; else if (input_attribute == &input_property_context->font_family) return output_property_context->font_family; else if (input_attribute == &input_property_context->font_size) return output_property_context->font_size; else if (input_attribute == &input_property_context->font_style) return output_property_context->font_style; else if (input_attribute == &input_property_context->font_variant) return output_property_context->font_variant; else if (input_attribute == &input_property_context->font_weight) return output_property_context->font_weight; else if (input_attribute == &input_property_context->image_rendering) return output_property_context->image_rendering; else if (input_attribute == &input_property_context->line_increment) return output_property_context->line_increment; else if (input_attribute == &input_property_context->opacity) return output_property_context->opacity; else if (input_attribute == &input_property_context->pointer_events) return output_property_context->pointer_events; else if (input_attribute == &input_property_context->shape_rendering) return output_property_context->shape_rendering; else if (input_attribute == &input_property_context->solid_color) return output_property_context->solid_color; else if (input_attribute == &input_property_context->solid_opacity) return output_property_context->solid_opacity; else if (input_attribute == &input_property_context->stop_color) return output_property_context->stop_color; else if (input_attribute == &input_property_context->stop_opacity) return output_property_context->stop_opacity; else if (input_attribute == &input_property_context->stroke) return output_property_context->stroke; else if (input_attribute == &input_property_context->stroke_dasharray) return output_property_context->stroke_dasharray; else if (input_attribute == &input_property_context->stroke_dashoffset) return output_property_context->stroke_dashoffset; else if (input_attribute == &input_property_context->stroke_linecap) return output_property_context->stroke_linecap; else if (input_attribute == &input_property_context->stroke_linejoin) return output_property_context->stroke_linejoin; else if (input_attribute == &input_property_context->stroke_miterlimit) return output_property_context->stroke_miterlimit; else if (input_attribute == &input_property_context->stroke_opacity) return output_property_context->stop_opacity; else if (input_attribute == &input_property_context->stroke_width) return output_property_context->stroke_width; else if (input_attribute == &input_property_context->text_align) return output_property_context->text_align; else if (input_attribute == &input_property_context->text_anchor) return output_property_context->text_anchor; else if (input_attribute == &input_property_context->text_rendering) return output_property_context->text_rendering; else if (input_attribute == &input_property_context->vector_effect) return output_property_context->vector_effect; else if (input_attribute == &input_property_context->viewport_fill) return output_property_context->viewport_fill; else if (input_attribute == &input_property_context->viewport_fill_opacity) return output_property_context->viewport_fill_opacity; else if (input_attribute == &input_property_context->visibility) return output_property_context->visibility; else return NULL;}#endifBool gf_svg_is_property(GF_Node *node, GF_FieldInfo *target_attribute){ u32 tag = gf_node_get_tag(node); if ((tag>=GF_NODE_RANGE_FIRST_SVG) && (tag<=GF_NODE_RANGE_LAST_SVG)) { SVG_Element *e = (SVG_Element *)node; SVGAttribute *att = e->attributes; while (att) { if (att->data == target_attribute->far_ptr) break; att = att->next; } if (!att) return 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -