libgpac
Documentation of the core library of GPAC
|
Scenegraph for SVG files. More...
Data Structures | |
struct | GF_DOMAttribute |
struct | GF_DOMFullAttribute |
struct | GF_DOMNode |
struct | GF_DOMFullNode |
struct | GF_DOMText |
struct | GF_DOMUpdates |
struct | GF_DOMEventTarget |
struct | GF_DOMMediaEvent |
struct | GF_DOM_Event |
struct | GF_DOMHandler |
struct | SVGPropertiesPointers |
Macros | |
#define | GF_DOM_BASE_ATTRIBUTE |
#define | GF_DOM_FULL_ATTRIBUTE GF_DOM_ATTRIBUTE \ |
#define | GF_DOM_BASE_NODE |
#define | GF_DOM_BASE_LISTENER |
Typedefs | |
typedef void | gf_sg_smil_evaluate(struct _smil_timing_rti *rti, Fixed normalized_simple_time, GF_SGSMILTimingEvalState state) |
typedef struct __dom_base_attribute | SVGAttribute |
typedef struct __dom_full_attribute | SVGExtendedAttribute |
typedef struct __dom_base_node | SVG_Element |
typedef struct __xml_ev_handler | SVG_handlerElement |
typedef struct _all_atts | SVGAllAttributes |
This section documents the Scenegraph for SVG files.
struct GF_DOMAttribute |
DOM attribute
struct GF_DOMFullAttribute |
DOM full attribute
Data Fields | ||
---|---|---|
GF_DOM_BASE_ATTRIBUTE u32 | xmlns | |
char * | name |
struct GF_DOMNode |
DOM base node
struct GF_DOMFullNode |
DOM full node
Data Fields | ||
---|---|---|
GF_DOM_BASE_NODE char * | name | |
u32 | ns |
struct GF_DOMUpdates |
struct GF_DOMEventTarget |
DOM EventTarget Interface
Data Fields | ||
---|---|---|
GF_List * | listeners |
list of SVG Listener nodes attached to this Event Target |
void * | ptr |
pointer to the object implementing the DOM Event Target Interface |
GF_DOMEventTargetType | ptr_type |
type of the object implementing the DOM Event Target Interface |
struct GF_DOMMediaEvent |
struct GF_DOM_Event |
DOM Event structure
Data Fields | ||
---|---|---|
GF_EventType | type | |
u8 | event_phase | |
u8 | bubbles | |
u8 | cancelable | |
u8 | has_ui_events | |
void * | target | |
GF_DOMEventTargetType | target_type | |
GF_DOMEventTarget * | currentTarget | |
Double | timestamp | |
u32 | detail | |
s32 | screenX | |
s32 | screenY | |
s32 | clientX | |
s32 | clientY | |
u32 | button | |
u32 | key_flags | |
u32 | key_hw_code | |
GF_Node * | relatedTarget | |
GF_Rect | screen_rect | |
GF_Point2D | prev_translate | |
GF_Point2D | new_translate | |
Fixed | prev_scale | |
Fixed | new_scale | |
u32 | cpu_percentage | |
Bool | onBattery | |
u32 | batteryState | |
u32 | batteryLevel | |
Double | smil_event_time | |
GF_Node * | relatedNode | |
Bool | is_vrml | |
GF_DOMMediaEvent | media_event | |
u32 | consumed | |
GF_FieldInfo * | attr | |
GF_Err | error_state | |
const char * | addon_url |
struct SVGPropertiesPointers |
SVG properties of node
Data Fields | ||
---|---|---|
SVG_Paint * | color | |
SVG_Paint * | fill | |
SVG_Paint * | stroke | |
SVG_Paint * | solid_color | |
SVG_Paint * | stop_color | |
SVG_Paint * | viewport_fill | |
SVG_Number * | fill_opacity | |
SVG_Number * | solid_opacity | |
SVG_Number * | stop_opacity | |
SVG_Number * | stroke_opacity | |
SVG_Number * | viewport_fill_opacity | |
SVG_Number * | opacity | |
SVG_Number * | audio_level | |
Fixed | computed_audio_level | |
SVG_RenderingHint * | color_rendering | |
SVG_RenderingHint * | image_rendering | |
SVG_RenderingHint * | shape_rendering | |
SVG_RenderingHint * | text_rendering | |
SVG_Display * | display | |
SVG_Visibility * | visibility | |
SVG_Overflow * | overflow | |
SVG_FontFamily * | font_family | |
SVG_FontSize * | font_size | |
SVG_FontStyle * | font_style | |
SVG_FontWeight * | font_weight | |
SVG_FontVariant * | font_variant | |
SVG_Number * | line_increment | |
SVG_TextAnchor * | text_anchor | |
SVG_DisplayAlign * | display_align | |
SVG_TextAlign * | text_align | |
SVG_PointerEvents * | pointer_events | |
SVG_FillRule * | fill_rule | |
SVG_StrokeDashArray * | stroke_dasharray | |
SVG_Length * | stroke_dashoffset | |
SVG_StrokeLineCap * | stroke_linecap | |
SVG_StrokeLineJoin * | stroke_linejoin | |
SVG_Number * | stroke_miterlimit | |
SVG_Length * | stroke_width | |
SVG_VectorEffect * | vector_effect |
#define GF_DOM_BASE_ATTRIBUTE |
#define GF_DOM_FULL_ATTRIBUTE GF_DOM_ATTRIBUTE \ |
macro for DOM full attribute
#define GF_DOM_BASE_NODE |
macro for DOM base node
#define GF_DOM_BASE_LISTENER |
macro for DOM listener DOM listener is simply a node added to the node events list. Only one observer can be attached to a listener. The listener will remove itself from the observer event list when destructed.
typedef void gf_sg_smil_evaluate(struct _smil_timing_rti *rti, Fixed normalized_simple_time, GF_SGSMILTimingEvalState state) |
SMIL timing evaluation callback
rti | SMIL runtime info |
normalized_simple_time | SMIL normalized time |
state | SMIL evaluation state |
typedef struct __dom_base_attribute SVGAttribute |
SVG attribute - same as DOM attribute
typedef struct __dom_full_attribute SVGExtendedAttribute |
SVG extended attribute - same as DOM extended attribute
typedef struct __dom_base_node SVG_Element |
SVG node - same as DOM node
typedef struct __xml_ev_handler SVG_handlerElement |
SVG handler node - same as DOM Event handler
typedef struct _all_atts SVGAllAttributes |
SVG all attributes
anonymous enum |
DOM attributes tags for xmlspace, xmlev, xlink, SVG and LASeR
enum GF_NamespaceType |
anonymous enum |
enum GF_DOMEventPhase |
DOM Event phases
Enumerator | |
---|---|
GF_DOM_EVENT_PHASE_CAPTURE | |
GF_DOM_EVENT_PHASE_AT_TARGET | |
GF_DOM_EVENT_PHASE_BUBBLE | |
GF_DOM_EVENT_CANCEL_MASK | |
GF_DOM_EVENT_PHASE_CANCEL | |
GF_DOM_EVENT_PHASE_CANCEL_ALL | |
GF_DOM_EVENT_PHASE_PREVENT |
DOM Event possible targets
enum GF_DOMEventCategory |
DOM Event category
anonymous enum |
This section documents the data types used for SVG scene graph.
SVG attribute types
GF_NamespaceType gf_xml_get_namespace_id | ( | char * | name | ) |
gets built-in XMLNS id for this namespace
name | name of the namespace |
GF_Err gf_sg_add_namespace | ( | GF_SceneGraph * | sg, |
char * | name, | ||
char * | qname | ||
) |
adds a new namespace
sg | the target scene graph |
name | name of the namespace (full URL) |
qname | QName of the namespace (short name in doc, eg "ev") |
GF_Err gf_sg_remove_namespace | ( | GF_SceneGraph * | sg, |
char * | name, | ||
char * | qname | ||
) |
removes a new namespace
sg | the target scene graph |
name | name of the namespace |
qname | QName of the namespace |
GF_NamespaceType gf_sg_get_namespace_code | ( | GF_SceneGraph * | sg, |
char * | qname | ||
) |
gets namespace code
sg | the target scene graph |
qname | QName of the namespace |
GF_NamespaceType gf_sg_get_namespace_code_from_name | ( | GF_SceneGraph * | sg, |
char * | name | ||
) |
gets namespace code from name
sg | the target scene graph |
name | name of the namespace |
const char* gf_sg_get_namespace_qname | ( | GF_SceneGraph * | sg, |
GF_NamespaceType | xmlns_id | ||
) |
gets namespace qname from ID
sg | the target scene graph |
xmlns_id | ID of the namespace |
const char* gf_sg_get_namespace | ( | GF_SceneGraph * | sg, |
GF_NamespaceType | xmlns_id | ||
) |
gets namespace from ID
sg | the target scene graph |
xmlns_id | ID of the namespace |
void gf_xml_push_namespaces | ( | GF_DOMNode * | elt | ) |
push namespace parsing state
elt | the current node being parsed |
void gf_xml_pop_namespaces | ( | GF_DOMNode * | elt | ) |
pop namespace parsing state
elt | the current node being parsed |
GF_NamespaceType gf_xml_get_element_namespace | ( | GF_Node * | n | ) |
gets namespace of an element
n | the target node |
GF_DOMText* gf_dom_add_text_node | ( | GF_Node * | parent, |
char * | text_data | ||
) |
creates a new text node, assign string (does NOT duplicate it) and register node with parent if desired
parent | the target parent node |
text_data | UTF-8 data to add as a text node |
void gf_dom_set_textContent | ( | GF_Node * | n, |
char * | text | ||
) |
replaces text content of node by the specified string
n | the target DOM node |
text | the replacement string in UTF-8. If NULL, only resets the children of the node data to add as a text node |
char* gf_dom_flatten_textContent | ( | GF_Node * | n | ) |
flattens text content of the node
n | the target DOM node |
GF_DOMText* gf_dom_new_text_node | ( | GF_SceneGraph * | sg | ) |
creates a new text node - this DOES NOT register the node
sg | the target scene graph for the node |
GF_DOMUpdates* gf_dom_add_updates_node | ( | GF_Node * | parent | ) |
creates a new updates node and register node with parent
parent | the target parent node |
GF_DOMEventTarget* gf_dom_event_target_new | ( | GF_DOMEventTargetType | type, |
void * | obj | ||
) |
creates a new event target
type | the type of the event target |
obj | opaque data passed to the event target |
GF_Err gf_sg_listener_associate | ( | GF_Node * | listener, |
GF_DOMEventTarget * | evt_target | ||
) |
associates a listener node and a event target node
listener | the target listener |
evt_target | the event target |
Bool gf_dom_event_fire | ( | GF_Node * | node, |
GF_DOM_Event * | event | ||
) |
fires an event on the specified node
node | the target node |
event | the DOM event |
Bool gf_sg_fire_dom_event | ( | GF_DOMEventTarget * | et, |
GF_DOM_Event * | event, | ||
GF_SceneGraph * | sg, | ||
GF_Node * | n | ||
) |
fires a DOM event on the specified node
et | the event target |
event | the dom event |
sg | the parent graph |
n | the event current target, can be NULL |
Bool gf_dom_event_fire_ex | ( | GF_Node * | node, |
GF_DOM_Event * | event, | ||
GF_List * | use_stack | ||
) |
fires event on the specified node
node | the target node |
event | the DOM event |
use_stack | a list of parent node/use node pairs for bubbling phase - may be NULL |
GF_EventType gf_dom_event_type_by_name | ( | const char * | name | ) |
gets event type by name
name | the event name |
const char* gf_dom_event_get_name | ( | GF_EventType | type | ) |
gets event name by type
type | the event type |
const char* gf_dom_get_key_name | ( | GF_KeyCode | key_identifier | ) |
gets key name by type
key_identifier | the key type |
GF_KeyCode gf_dom_get_key_type | ( | char * | key_name | ) |
gets key type by name
key_name | the key name |
GF_DOMEventCategory gf_dom_event_get_category | ( | GF_EventType | type | ) |
gets category of DOM event
type | type of event |
void gf_sg_register_event_type | ( | GF_SceneGraph * | sg, |
GF_DOMEventCategory | category | ||
) |
registers an event category with the scene graph. Event with unregistered categories will not be fired
sg | the target scene graph |
category | the DOM event category to add |
void gf_sg_unregister_event_type | ( | GF_SceneGraph * | sg, |
GF_DOMEventCategory | category | ||
) |
unregisters an event category with the scene graph
sg | the target scene graph |
category | the DOM event category to add |
adds a listener to the node.
n | the target node |
listener | a listenerElement (XML event). The listener node is NOT registered with the node (it may very well not be a direct child of the node) |
gets number of listener of a node
n | the target node |
gets a listener of a node
n | the target node |
idx | 0-based index of the listener to query |
GF_DOMHandler* gf_dom_listener_build | ( | GF_Node * | observer, |
GF_EventType | event_type, | ||
u32 | event_param | ||
) |
creates a default listener/handler for the given event on the given node Listener/handler are stored at the node level
observer | the observer node |
event_type | the event type |
event_param | the event parameter |
void gf_node_register_iri | ( | GF_SceneGraph * | sg, |
XMLRI * | iri | ||
) |
registers a XML IRI with the scene graph - this is needed to handle replacement of IRI (SMIL anim, DOM / LASeR updates)
sg | the target scene graph |
iri | the IRI to register |
void gf_node_unregister_iri | ( | GF_SceneGraph * | sg, |
XMLRI * | iri | ||
) |
unregisters a XML IRI with the scene graph
sg | the target scene graph |
iri | the IRI to unregister |
gets number of animation targeting this node
n | the target node |
GF_Err gf_node_store_embedded_data | ( | XMLRI * | iri, |
const char * | cache_dir, | ||
const char * | base_filename | ||
) |
writes data embedded in IRI (such as base64 data) to the indicated cahce directory, and updates the IRI accordingly
iri | the IRI to store |
cache_dir | location of the directory to which the data should be extracted |
base_filename | location of the file the IRI was declared in |
void gf_svg_properties_init_pointers | ( | SVGPropertiesPointers * | svg_props | ) |
initializes an SVGPropertiesPointers
svg_props | pointer to structure to initialize |
void gf_svg_properties_reset_pointers | ( | SVGPropertiesPointers * | svg_props | ) |
resets an SVGPropertiesPointers
svg_props | pointer to structure to reset |
void gf_svg_apply_animations | ( | GF_Node * | n, |
SVGPropertiesPointers * | render_svg_props | ||
) |
applies animations for the node
n | the target node |
render_svg_props | pointer to rendering SVG properties of the node |
check if appearance flag is set
flags | flags to test |
checks if node tag indicates a transformable elemnt
tag | tag to check |
void* gf_svg_create_attribute_value | ( | u32 | attribute_type | ) |
creates an SVG attribute value for the given type
attribute_type | type of attribute to delete |
void gf_svg_delete_attribute_value | ( | u32 | attribute_type, |
void * | value, | ||
GF_SceneGraph * | sg | ||
) |
destroys an SVG attribute value
attribute_type | type of attribute to delete |
value | the value to destroy |
sg | the parent scenegraph (needed for IRI registration) |
Bool gf_svg_attributes_equal | ( | GF_FieldInfo * | a, |
GF_FieldInfo * | b | ||
) |
checks if two SVG attributes are equal
a | first attribute |
b | second attribute |
GF_Err gf_svg_attributes_copy | ( | GF_FieldInfo * | a, |
GF_FieldInfo * | b, | ||
Bool | clamp | ||
) |
copies attributes (a = b)
a | destination attribute |
b | source attribute |
clamp | if GF_TRUE, the interpolated value is clamped to its min/max possible values |
GF_Err gf_svg_attributes_add | ( | GF_FieldInfo * | a, |
GF_FieldInfo * | b, | ||
GF_FieldInfo * | c, | ||
Bool | clamp | ||
) |
adds attributes ( c = a + b)
a | first attribute |
b | second attribute |
c | destination attribute |
clamp | if GF_TRUE, the interpolated value is clamped to its min/max possible values |
checks if attribute type can be interpolated
type | attribute type |
GF_Err gf_svg_attributes_interpolate | ( | GF_FieldInfo * | a, |
GF_FieldInfo * | b, | ||
GF_FieldInfo * | c, | ||
Fixed | coef, | ||
Bool | clamp | ||
) |
interpolates attributes ( c = coef * a + (1 - coef) * b )
a | first attribute |
b | second attribute |
c | destination attribute |
coef | interpolation coefficient |
clamp | if GF_TRUE, the interpolated value is clamped to its min/max possible values |
GF_Err gf_svg_attributes_muladd | ( | Fixed | alpha, |
GF_FieldInfo * | a, | ||
Fixed | beta, | ||
GF_FieldInfo * | b, | ||
GF_FieldInfo * | c, | ||
Bool | clamp | ||
) |
multiply and add attributes (c = alpha * a + beta * b)
a | first attribute |
alpha | first multiplier |
b | second attribute |
beta | second multiplier |
c | destination attribute |
clamp | if GF_TRUE, the interpolated value is clamped to its min/max possible values |
GF_Err gf_node_get_attribute_by_tag | ( | GF_Node * | n, |
u32 | attribute_tag, | ||
Bool | create_if_not_found, | ||
Bool | set_default, | ||
GF_FieldInfo * | field | ||
) |
gets an attribute by its tag (built-in name)
n | the target node |
attribute_tag | the attribute tag |
create_if_not_found | if GF_TRUE, adds the attribute if not found |
set_default | if GF_TRUE, sets the attribute to default when creating it |
field | set to the attribute information |
const char* gf_svg_attribute_type_to_string | ( | u32 | att_type | ) |
gets name of an attribute type
att_type | the attribute type |
GF_Err gf_svg_parse_attribute | ( | GF_Node * | n, |
GF_FieldInfo * | info, | ||
char * | attribute_content, | ||
u8 | anim_value_type | ||
) |
parses an attribute
n | the target node |
info | the attribute information |
attribute_content | the UTF-8 string to parse |
anim_value_type | the SMIL animation value type for this attribute, 0 if not animatable |
void gf_svg_parse_style | ( | GF_Node * | n, |
char * | style | ||
) |
parses an SVG style
n | the target node |
style | the UTF-8 style string to parse |
char* gf_svg_dump_attribute | ( | GF_Node * | n, |
GF_FieldInfo * | info | ||
) |
dumps an SVG attribute
n | the target node |
info | the attribute information |
char* gf_svg_dump_attribute_indexed | ( | GF_Node * | n, |
GF_FieldInfo * | info | ||
) |
dumps an SVG indexed attribute (special 1-D version of a N dimensional attribute, used by LASeR and DOM updates)
n | the target node |
info | the attribute information |
void gf_svg_path_build | ( | GF_Path * | path, |
GF_List * | commands, | ||
GF_List * | points | ||
) |
builds a path from its SVG representation
path | a 2D graphical path object |
commands | a list of SVG path commands |
points | a list of SVG path points |
parses an SVG element ID
n | the target node |
nodename | the node name to parse |
warning_if_defined | if GF_TRUE, throws a warning when the node name is already defined |
const char* gf_svg_get_system_paint_server_name | ( | u32 | paint_type | ) |
gets the name of a paint server type
paint_type | the paint server type |
u32 gf_svg_get_system_paint_server_type | ( | const char * | name | ) |
gets the type of a paint server by name
name | the paint server name |
Bool gf_smil_notify_timed_elements | ( | GF_SceneGraph * | sg | ) |
notifies the scene time to all the timed elements in the given scene graph (including sub-scenes).
sg | the target scene graph |
inserts a new resolved time instant in the begin or end attribute. The insertion preserves the sorting and removes the previous insertions which have become obsolete
n | the target element |
is_end | if GF_TRUE, the SMIL clock is an end clock |
clock | clock time in seconds |
Bool gf_svg_parse_transformlist | ( | GF_Matrix2D * | mat, |
char * | attribute_content | ||
) |
parses a transformation list into a 2D matrix
mat | the matrix to fill |
attribute_content | the UTF8 string representin the SVG transformation |
void gf_smil_set_evaluation_callback | ( | GF_Node * | smil_time, |
gf_sg_smil_evaluate | smil_evaluate | ||
) |
sets the SMIL evaluation callback for a node
smil_time | the target SMIL node |
smil_evaluate | the callback function |
void gf_smil_set_media_duration | ( | SMIL_Timing_RTI * | rti, |
Double | media_duration | ||
) |
assigns media duration for a SMIL node
rti | the target SMIL runtime info of the node |
media_duration | the media duration in seconds |
Double gf_smil_get_media_duration | ( | SMIL_Timing_RTI * | rti | ) |
gets media duration of a SMIL node
rti | the target SMIL runtime info of the node |
GF_Node* gf_smil_get_element | ( | SMIL_Timing_RTI * | rti | ) |
gets node from a SMIL runtime info
rti | the target SMIL runtime info of the node |
checks if a SMIL node is active
node | the target node |
void gf_smil_timing_modified | ( | GF_Node * | node, |
GF_FieldInfo * | field | ||
) |
notifies a SMIL node that it has been modified
node | the target SMIL node |
field | the field information describing the modified attribute, may be NULL |
void gf_svg_flatten_attributes | ( | SVG_Element * | n, |
SVGAllAttributes * | all_atts | ||
) |
flattens all SVG attributes in a structure
n | the target SVG node |
all_atts | filled with all SVG attributes defined fo node |
gets SVG attribute name for a node
n | the target SVG node |
tag | the attribute tag |
u32 gf_svg_apply_inheritance | ( | SVGAllAttributes * | all_atts, |
SVGPropertiesPointers * | render_svg_props | ||
) |
applies inheritance of SVG attributes to a render_svg_props
all_atts | the flatten SVG attributes of the node |
render_svg_props | the set of properties applying to the parent node (initialize this one to 0 for root element) |
GF_DOMAttribute* gf_xml_create_attribute | ( | GF_Node * | n, |
u32 | tag | ||
) |
creates a DOM Attribute for the given tag
n | the target node |
tag | the target built-in tag |
gets the type of a built-in XML/SVG/SMIL attribute tag
tag | the target attribute tag |
u32 gf_xml_get_attribute_tag | ( | GF_Node * | n, |
char * | attribute_name, | ||
GF_NamespaceType | ns | ||
) |
gets the built-in tag of a node's attribute
n | the target node |
attribute_name | the target attribute name |
ns | the target namespace |