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

📄 v2.c

📁 一个用于智能手机的多媒体库适合S60 WinCE的跨平台开发库
💻 C
📖 第 1 页 / 共 2 页
字号:
/* *			GPAC - Multimedia Framework C SDK * *			Copyright (c) Cyril Concolato 2004-2005 *					All rights reserved * *  This file is part of GPAC / SVG Scene Graph Generator sub-project * *  GPAC is free software; you can redistribute it and/or modify *  it under the terms of the GNU Lesser General Public License as published by *  the Free Software Foundation; either version 2, or (at your option) *  any later version. *    *  GPAC is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU Lesser General Public License for more details. *    *  You should have received a copy of the GNU Lesser General Public *  License along with this library; see the file COPYING.  If not, write to *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  * */#include "svggen.h"void generateAttributes2(FILE *output, GF_List *attributes) {	u32 i;	for (i = 0; i<gf_list_count(attributes); i++) {		SVGGenAttribute *att = (SVGGenAttribute *)gf_list_get(attributes, i);		if (!strcmp(att->implementation_name, "transform")) continue;		fprintf(output, "\t%s %s;\n", att->impl_type, att->implementation_name);	}}void generateNode2(FILE *output, SVGGenElement* svg_elt) {	fprintf(output, "typedef struct _tagSVG_SANI_%sElement\n{\n", svg_elt->implementation_name);	if (svg_elt->has_transform) {		fprintf(output, "\tTRANSFORMABLE_SVG_SANI_ELEMENT\n");	} else {		fprintf(output, "\tBASE_SVG_SANI_ELEMENT\n");	}	if (!strcmp(svg_elt->implementation_name, "conditional")) {		fprintf(output, "\tSVGCommandBuffer updates;\n");	} 	generateAttributes2(output, svg_elt->attributes);	/*special case for handler node*/	if (!strcmp(svg_elt->implementation_name, "handler")) {		fprintf(output, "\tvoid (*handle_event)(GF_Node *hdl, GF_DOM_Event *event);\n");	}	fprintf(output, "} SVG_SANI_%sElement;\n\n\n", svg_elt->implementation_name);}void generateAttributeInfo2(FILE *output, char * elt_imp_name, SVGGenAttribute *att, u32 i){	fprintf(output, "\t\tcase %d:\n", i);	fprintf(output, "\t\t\tinfo->name = \"%s\";\n", att->svg_name);	fprintf(output, "\t\t\tinfo->fieldType = %s_datatype;\n", att->impl_type);	fprintf(output, "\t\t\tinfo->far_ptr = & ((SVG_SANI_%sElement *)node)->%s;\n", elt_imp_name, att->implementation_name);	fprintf(output, "\t\t\treturn GF_OK;\n");}u32 generateTransformInfo2(FILE *output, SVGGenElement *elt, u32 start){	u32 i = start;	fprintf(output, "\t\tcase %d:\n", i);	fprintf(output, "\t\t\tinfo->name = \"transform\";\n");	fprintf(output, "\t\t\tinfo->fieldType = SVG_Transform_datatype;\n");	fprintf(output, "\t\t\tinfo->far_ptr = &((SVG_SANI_TransformableElement *)node)->transform;\n");	fprintf(output, "\t\t\treturn GF_OK;\n");	i++;	return i;}u32 generateMotionTransformInfo2(FILE *output, SVGGenElement *elt, u32 start){	u32 i = start;	fprintf(output, "\t\tcase %d:\n", i);	fprintf(output, "\t\t\tinfo->name = \"motionTransform\";\n");	fprintf(output, "\t\t\tinfo->fieldType = SVG_Transform_datatype;\n");	fprintf(output, "\t\t\tinfo->far_ptr = ((SVG_SANI_TransformableElement *)node)->motionTransform;\n");	fprintf(output, "\t\t\treturn GF_OK;\n");	i++;	return i;}u32 generateXYInfo2(FILE *output, SVGGenElement *elt, u32 start){	u32 i = start;	fprintf(output, "\t\tcase %d:\n", i);	fprintf(output, "\t\t\tinfo->name = \"x\";\n");	fprintf(output, "\t\t\tinfo->fieldType = SVG_Coordinate_datatype;\n");	fprintf(output, "\t\t\tinfo->far_ptr = &((SVG_SANI_TransformableElement *)node)->xy.x;\n");	fprintf(output, "\t\t\treturn GF_OK;\n");	i++;	fprintf(output, "\t\tcase %d:\n", i);	fprintf(output, "\t\t\tinfo->name = \"y\";\n");	fprintf(output, "\t\t\tinfo->fieldType = SVG_Coordinate_datatype;\n");	fprintf(output, "\t\t\tinfo->far_ptr = &((SVG_SANI_TransformableElement *)node)->xy.y;\n");	fprintf(output, "\t\t\treturn GF_OK;\n");	i++;	return i;}void generateNodeImpl2(FILE *output, SVGGenElement* svg_elt) {	u32 i;		/* Constructor */	fprintf(output, "void *gf_svg_sani_new_%s()\n{\n\tSVG_SANI_%sElement *p;\n", svg_elt->implementation_name,svg_elt->implementation_name);	fprintf(output, "\tGF_SAFEALLOC(p, SVG_SANI_%sElement);\n\tif (!p) return NULL;\n\tgf_node_setup((GF_Node *)p, TAG_SVG_SANI_%s);\n\tgf_sg_parent_setup((GF_Node *) p);\n",svg_elt->implementation_name,svg_elt->implementation_name);	fprintf(output, "#ifdef GF_NODE_USE_POINTERS\n");	fprintf(output, "\t((GF_Node *p)->sgprivate->name = \"%s\";\n", svg_elt->implementation_name);	fprintf(output, "\t((GF_Node *p)->sgprivate->node_del = gf_svg_sani_%s_del;\n", svg_elt->implementation_name);	fprintf(output, "\t((GF_Node *p)->sgprivate->get_field = gf_svg_sani_%s_get_attribute;\n", svg_elt->implementation_name);	fprintf(output, "#endif\n");	fprintf(output, "\tgf_svg_sani_init_core((SVG_SANI_Element *)p);\n");			if (svg_elt->has_focus) {		fprintf(output, "\tgf_svg_sani_init_focus((SVG_SANI_Element *)p);\n");			} 	if (svg_elt->has_xlink) {		fprintf(output, "\tgf_svg_sani_init_xlink((SVG_SANI_Element *)p);\n");			} 	if (svg_elt->has_timing) {		fprintf(output, "\tgf_svg_sani_init_timing((SVG_SANI_Element *)p);\n");			} 	if (svg_elt->has_sync) {		fprintf(output, "\tgf_svg_sani_init_sync((SVG_SANI_Element *)p);\n");			}	if (svg_elt->has_animation){		fprintf(output, "\tgf_svg_sani_init_anim((SVG_SANI_Element *)p);\n");			} 	if (svg_elt->has_conditional) {		fprintf(output, "\tgf_svg_sani_init_conditional((SVG_SANI_Element *)p);\n");			} 	if (svg_elt->has_transform) {		fprintf(output, "\tgf_mx2d_init(p->transform.mat);\n");	} 	if (!strcmp(svg_elt->implementation_name, "conditional")) {		fprintf(output, "\tgf_svg_sa_init_lsr_conditional(&p->updates);\n");		fprintf(output, "\tgf_svg_sani_init_timing((SVG_SANI_Element *)p);\n");			} 	for (i = 0; i < gf_list_count(svg_elt->attributes); i++) {		SVGGenAttribute *att = gf_list_get(svg_elt->attributes, i);				/* forcing initialization of old-properties */		if (!strcmp("audio-level", att->svg_name)) {			fprintf(output, "\tp->audio_level.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->audio_level.value = FIX_ONE;\n");		} else if (!strcmp("display", att->svg_name)) {			fprintf(output, "\tp->display = SVG_DISPLAY_INLINE;\n");		} else if (!strcmp("display-align", att->svg_name)) {			fprintf(output, "\tp->display_align = SVG_DISPLAYALIGN_AUTO;\n");		} else if (!strcmp("fill", att->svg_name)) {			fprintf(output, "\tp->fill.type = SVG_PAINT_COLOR;\n");			fprintf(output, "\tp->fill.color.type = SVG_COLOR_RGBCOLOR;\n");		} else if (!strcmp("fill-opacity", att->svg_name)) {			fprintf(output, "\tp->fill_opacity.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->fill_opacity.value = FIX_ONE;\n");		} else if (!strcmp("fill-rule", att->svg_name)) {			fprintf(output, "\tp->fill_rule = SVG_FILLRULE_NONZERO;\n");		} else if (!strcmp("font-family", att->svg_name)) {			fprintf(output, "\tp->font_family.type = SVG_FONTFAMILY_VALUE;\n");			fprintf(output, "\tp->font_family.value = strdup(\"Arial\");\n");		} else if (!strcmp("font-size", att->svg_name)) {			fprintf(output, "\tp->font_size.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->font_size.value = 12*FIX_ONE;\n");		} else if (!strcmp("font-style", att->svg_name)) {			fprintf(output, "\tp->font_style = SVG_FONTSTYLE_NORMAL;\n");		} else if (!strcmp("font-variant", att->svg_name)) {			fprintf(output, "\tp->font_variant = SVG_FONTVARIANT_NORMAL;\n");		} else if (!strcmp("font-weight", att->svg_name)) {			fprintf(output, "\tp->font_weight = SVG_FONTWEIGHT_NORMAL;\n");		} else if (!strcmp("line-increment", att->svg_name)) {			fprintf(output, "\tp->line_increment.type = SVG_NUMBER_AUTO;\n");			fprintf(output, "\tp->line_increment.value = FIX_ONE;\n");		} else if (!strcmp("opacity", att->svg_name)) {			fprintf(output, "\tp->opacity.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->opacity.value = FIX_ONE;\n");		} else if (!strcmp("solid-color", att->svg_name)) {			fprintf(output, "\tp->solid_color.type = SVG_PAINT_COLOR;\n");			fprintf(output, "\tp->solid_color.color.type = SVG_COLOR_RGBCOLOR;\n");		} else if (!strcmp("solid-opacity", att->svg_name)) {			fprintf(output, "\tp->solid_opacity.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->solid_opacity.value = FIX_ONE;\n");		} else if (!strcmp("solid-color", att->svg_name)) {			fprintf(output, "\tp->stop_color.type = SVG_PAINT_COLOR;\n");			fprintf(output, "\tp->stop_color.color.type = SVG_COLOR_RGBCOLOR;\n");		} else if (!strcmp("stop-opacity", att->svg_name)) {			fprintf(output, "\tp->stop_opacity.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->stop_opacity.value = FIX_ONE;\n");		} else if (!strcmp("stroke", att->svg_name)) {			fprintf(output, "\tp->stroke.type = SVG_PAINT_NONE;\n");			fprintf(output, "\tp->stroke.color.type = SVG_COLOR_RGBCOLOR;\n");		} else if (!strcmp("stroke-dasharray", att->svg_name)) {			fprintf(output, "\tp->stroke_dasharray.type = SVG_STROKEDASHARRAY_NONE;\n");		} else if (!strcmp("stroke-dashoffset", att->svg_name)) {			fprintf(output, "\tp->stroke_dashoffset.type = SVG_NUMBER_VALUE;\n");		} else if (!strcmp("stroke-linecap", att->svg_name)) {			fprintf(output, "\tp->stroke_linecap = SVG_STROKELINECAP_BUTT;\n");		} else if (!strcmp("stroke-linejoin", att->svg_name)) {			fprintf(output, "\tp->stroke_linejoin = SVG_STROKELINEJOIN_MITER;\n");		} else if (!strcmp("stroke-miterlimit", att->svg_name)) {			fprintf(output, "\tp->stroke_miterlimit.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->stroke_miterlimit.value = 4*FIX_ONE;\n");		} else if (!strcmp("stroke-opacity", att->svg_name)) {			fprintf(output, "\tp->stroke_opacity.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->stroke_opacity.value = FIX_ONE;\n");		} else if (!strcmp("stroke-width", att->svg_name)) {			fprintf(output, "\tp->stroke_width.type = SVG_NUMBER_VALUE;\n");			fprintf(output, "\tp->stroke_width.value = FIX_ONE;\n");		} else if (!strcmp("text-align", att->svg_name)) {			fprintf(output, "\tp->text_align = SVG_TEXTALIGN_START;\n");		} else if (!strcmp("text-anchor", att->svg_name)) {			fprintf(output, "\tp->text_anchor = SVG_TEXTANCHOR_START;\n");		} else if (!strcmp("vector-effect", att->svg_name)) {			fprintf(output, "\tp->vector_effect = SVG_VECTOREFFECT_NONE;\n");		} else if (!strcmp("viewport-fill", att->svg_name)) {			fprintf(output, "\tp->viewport_fill.type = SVG_PAINT_NONE;\n");

⌨️ 快捷键说明

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