⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svg_external.c

📁 一个用于智能手机的多媒体库适合S60 WinCE的跨平台开发库
💻 C
📖 第 1 页 / 共 2 页
字号:
		xlinkp.href = &((SVG_SANI_animationElement *)n)->xlink->href;		xlinkp.role = &((SVG_SANI_animationElement *)n)->xlink->role;		xlinkp.show = &((SVG_SANI_animationElement *)n)->xlink->show;		xlinkp.title = &((SVG_SANI_animationElement *)n)->xlink->title;		xlinkp.type = &((SVG_SANI_animationElement *)n)->xlink->type;		syncp.syncBehavior = &((SVG_SANI_animationElement *)n)->sync->syncBehavior;		syncp.syncBehaviorDefault = &((SVG_SANI_animationElement *)n)->sync->syncBehaviorDefault;		syncp.syncMaster = &((SVG_SANI_animationElement *)n)->sync->syncMaster;		syncp.syncReference = &((SVG_SANI_animationElement *)n)->sync->syncReference;		syncp.syncTolerance = &((SVG_SANI_animationElement *)n)->sync->syncTolerance;		syncp.syncToleranceDefault = &((SVG_SANI_animationElement *)n)->sync->syncToleranceDefault;		clipBegin = &((SVG_SANI_animationElement *)n)->timing->clipBegin;		clipEnd = &((SVG_SANI_animationElement *)n)->timing->clipEnd;	}#endif	if (!is) {		is = gf_svg_get_subscene(n, &xlinkp, &syncp, 1);		if (!is) return;		/*assign animation scene as private stack of inline node, and remember inline node for event propagation*/		gf_node_set_private((GF_Node *)n, is);		gf_list_add(is->inline_nodes, n);	}	/*play*/	if (!is->root_od->mo->num_open) {			gf_mo_play(is->root_od->mo, (clipBegin?*clipBegin:0), (clipEnd ? *clipEnd : -1), 0);	}}static void svg_animation_smil_evaluate(SMIL_Timing_RTI *rti, Fixed normalized_scene_time, u32 status){	GF_InlineScene *is;	switch (status) {	case SMIL_TIMING_EVAL_UPDATE:		svg_animation_smil_update(rti, normalized_scene_time);		break;	case SMIL_TIMING_EVAL_FREEZE:		is = (GF_InlineScene *)gf_node_get_private((GF_Node *)rti->timed_elt);		if (is && is->root_od->mo) gf_mo_stop(is->root_od->mo);		break;	case SMIL_TIMING_EVAL_REMOVE:		is = (GF_InlineScene *)gf_node_get_private((GF_Node *)rti->timed_elt);		if (is && is->root_od->mo) gf_mo_stop(is->root_od->mo);		break;	case SMIL_TIMING_EVAL_REPEAT:		is = (GF_InlineScene *)gf_node_get_private((GF_Node *)rti->timed_elt);		if (is && is->root_od->mo) is->needs_restart = 1;		break;	}}void SVG_Render_animation(GF_Node *n, void *rs, Bool is_destroy){	GF_Node *sub_root;	GF_InlineScene *is;		if (is_destroy) return;	is = (GF_InlineScene *)gf_node_get_private(n);	if (!is || !is->graph_attached) return;	if (is->needs_restart) {		is->needs_restart = 0;		if (is->is_dynamic_scene) {			gf_is_restart_dynamic(is, 0);		} else {			/*we cannot use gf_mo_restart since it only sets the needs_restart for inline scenes. 			The rational is that gf_mo_restart can be called from the parent scene (OK) or from the scene itself, in 			which case shutting down the graph would crash the renderer. We therefore need two render passes to 			safely restart an inline scene*/			/*1- stop main object from playing but don't disconnect channels*/			gf_odm_stop(is->root_od, 1);			/*2- close all ODs inside the scene and reset the graph*/			gf_is_disconnect(is, 0);			/*3- restart the scene*/			gf_odm_start(is->root_od);		}	}	sub_root = gf_sg_get_root_node(is->graph);	if (sub_root) {//		if (is->root_od->mo->num_open && (is->root_od->media_stop_time < (s64) (gf_node_get_scene_time(sub_root)*1000))) {//			gf_mo_stop(is->root_od->mo);//		}		gf_sr_render_inline(is->root_od->term->renderer, n, sub_root, rs);	}}void svg_render_init_animation(GF_InlineScene *is, GF_Node *node){	SVGTimedAnimBaseElement *timed = (SVGTimedAnimBaseElement *)node;	gf_smil_timing_init_runtime_info(node);	if (timed->timingp && timed->timingp->runtime) {		timed->timingp->runtime->evaluate = svg_animation_smil_evaluate;	}	gf_node_set_callback_function(node, SVG_Render_animation);}#ifdef GPAC_ENABLE_SVG_SAvoid svg_sa_render_init_animation(GF_InlineScene *is, GF_Node *node){	gf_smil_timing_init_runtime_info(node);	if (((SVG_SA_Element *)node)->timing->runtime) {		SMIL_Timing_RTI *rti = ((SVG_SA_Element *)node)->timing->runtime;		rti->evaluate = svg_animation_smil_evaluate;	}	gf_node_set_callback_function(node, SVG_Render_animation);}#endifstatic void SVG_Render_use(GF_Node *node, void *rs, Bool is_destroy){	XLinkAttributesPointers xlinkp;	SMILSyncAttributesPointers syncp;	u32 tag = gf_node_get_tag(node);	if (is_destroy) return;	if ((tag>=GF_NODE_RANGE_FIRST_SVG) && (tag<=GF_NODE_RANGE_LAST_SVG)) {		SVGAllAttributes all_atts;		gf_svg_flatten_attributes((SVG_Element *)node, &all_atts);		xlinkp.actuate = all_atts.xlink_actuate;		xlinkp.arcrole = all_atts.xlink_arcrole;		xlinkp.href = all_atts.xlink_href;		xlinkp.role = all_atts.xlink_role;		xlinkp.show = all_atts.xlink_show;		xlinkp.title = all_atts.xlink_title;		xlinkp.type = all_atts.xlink_type;		syncp.syncBehavior = all_atts.syncBehavior;		syncp.syncBehaviorDefault = all_atts.syncBehaviorDefault;		syncp.syncMaster = all_atts.syncMaster;		syncp.syncReference = all_atts.syncReference;		syncp.syncTolerance = all_atts.syncTolerance;		syncp.syncToleranceDefault = all_atts.syncToleranceDefault;	}#ifdef GPAC_ENABLE_SVG_SA	else if ((tag>=GF_NODE_RANGE_FIRST_SVG_SA) && (tag<=GF_NODE_RANGE_LAST_SVG_SA)) {		xlinkp.actuate = &(((SVG_SA_useElement *)node)->xlink->actuate);		xlinkp.arcrole = &((SVG_SA_useElement *)node)->xlink->arcrole;		xlinkp.href = &((SVG_SA_useElement *)node)->xlink->href;		xlinkp.role = &((SVG_SA_useElement *)node)->xlink->role;		xlinkp.show = &((SVG_SA_useElement *)node)->xlink->show;		xlinkp.title = &((SVG_SA_useElement *)node)->xlink->title;		xlinkp.type = &((SVG_SA_useElement *)node)->xlink->type;		syncp.syncBehavior = &((SVG_SA_useElement *)node)->sync->syncBehavior;		syncp.syncBehaviorDefault = &((SVG_SA_useElement *)node)->sync->syncBehaviorDefault;		syncp.syncMaster = &((SVG_SA_useElement *)node)->sync->syncMaster;		syncp.syncReference = &((SVG_SA_useElement *)node)->sync->syncReference;		syncp.syncTolerance = &((SVG_SA_useElement *)node)->sync->syncTolerance;		syncp.syncToleranceDefault = &((SVG_SA_useElement *)node)->sync->syncToleranceDefault;	}#endif#ifdef GPAC_ENABLE_SVG_SANI	else if ((tag>=GF_NODE_RANGE_FIRST_SVG_SANI) && (tag<=GF_NODE_RANGE_LAST_SVG_SANI)) {		xlinkp.actuate = &((SVG_SANI_useElement *)node)->xlink->actuate;		xlinkp.arcrole = &((SVG_SANI_useElement *)node)->xlink->arcrole;		xlinkp.href = &((SVG_SANI_useElement *)node)->xlink->href;		xlinkp.role = &((SVG_SANI_useElement *)node)->xlink->role;		xlinkp.show = &((SVG_SANI_useElement *)node)->xlink->show;		xlinkp.title = &((SVG_SANI_useElement *)node)->xlink->title;		xlinkp.type = &((SVG_SANI_useElement *)node)->xlink->type;		syncp.syncBehavior = &((SVG_SANI_useElement *)node)->sync->syncBehavior;		syncp.syncBehaviorDefault = &((SVG_SANI_useElement *)node)->sync->syncBehaviorDefault;		syncp.syncMaster = &((SVG_SANI_useElement *)node)->sync->syncMaster;		syncp.syncReference = &((SVG_SANI_useElement *)node)->sync->syncReference;		syncp.syncTolerance = &((SVG_SANI_useElement *)node)->sync->syncTolerance;		syncp.syncToleranceDefault = &((SVG_SANI_useElement *)node)->sync->syncToleranceDefault;	}#endif	if (!xlinkp.href) return;	if (xlinkp.href->type == XMLRI_ELEMENTID) {		GF_InlineScene *is = (GF_InlineScene *)gf_sg_get_private(gf_node_get_graph((GF_Node *) node));		gf_sr_render_inline(is->root_od->term->renderer, node, xlinkp.href->target, rs);	} else {		char *fragment;		GF_Node *shadow_root;		GF_InlineScene *is = (GF_InlineScene *)gf_node_get_private(node);		if (!is) {			is = gf_svg_get_subscene(node, &xlinkp, &syncp, 0);			if (!is) return;			/*assign animation scene as private stack of inline node, and remember inline node for event propagation*/			gf_node_set_private(node, is);			gf_list_add(is->inline_nodes, node);			/*play*/			if (!is->root_od->mo->num_open) 				gf_mo_play(is->root_od->mo, 0, -1, 0);		}				shadow_root = gf_sg_get_root_node(is->graph);		if ((fragment = strchr(xlinkp.href->string, '#')) ) {			shadow_root = gf_sg_find_node_by_name(is->graph, fragment+1);		}		if (shadow_root) {			gf_sr_render_inline(is->root_od->term->renderer, node, shadow_root, rs);		}	}}void svg_sa_init_use(GF_InlineScene *is, GF_Node *node){	gf_node_set_callback_function(node, SVG_Render_use);}void svg_sani_render_init_use(GF_InlineScene *is, GF_Node *node){	gf_node_set_callback_function(node, SVG_Render_use);}void svg_render_init_use(GF_InlineScene *is, GF_Node *node){	gf_node_set_callback_function(node, SVG_Render_use);}#endif //GPAC_DISABLE_SVG

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -