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

📄 character.c

📁 Ming is a library for generating Macromedia Flash files (.swf), written in C, and includes useful ut
💻 C
字号:
/*    Ming, an SWF output library    Copyright (C) 2002  Opaque Industries - http://www.opaque.net/    This library 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.1 of the License, or (at your option) any later version.    This library 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; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//* $Id: character.c,v 1.21 2008/06/09 21:50:04 krechert Exp $ */#include <stdlib.h>#include "character.h"#include "blocktypes.h"#include "morph.h"#include "libming.h"int SWF_gNumCharacters;voidSWFCharacterInit(SWFCharacter character){	SWFBlockInit((SWFBlock)character);	character->id = 0;	character->bounds = NULL;	character->dependencies = NULL;	character->nDependencies = 0;		character->isFinished = FALSE;	character->onPlace = NULL;	character->onFrame = NULL;}voiddestroySWFCharacter(SWFCharacter character){	if ( character->dependencies != NULL )		free(character->dependencies);	if ( character->bounds != NULL )		destroySWFRect(character->bounds);	// destroySWFBlock((SWFBlock)character);	free(character);}voidSWFCharacter_addDependency(SWFCharacter character, SWFCharacter dependency){#if 1	int n;	for(n = 0 ; n < character->nDependencies ; n++)		if(character->dependencies[n] == dependency)			return;#endif	character->dependencies =		(SWFCharacter*)realloc(character->dependencies,						sizeof(SWFCharacter) * (character->nDependencies + 1));	character->dependencies[character->nDependencies] = dependency;	++character->nDependencies;}void SWFCharacter_setID(SWFCharacter character, int id){	character->id = id;}int SWFCharacter_getID(SWFCharacter character){	return character->id;}BOOLSWFCharacter_getDependencies(SWFCharacter character,														 SWFCharacter** depsPtr, int* nDepsPtr){	int i;	int nDeps = *nDepsPtr;	SWFCharacter* deps = *depsPtr;	if ( BLOCK(character)->type == SWF_DEFINEMORPHSHAPE )		character = (SWFCharacter)SWFMorph_getShape1((SWFMorph)character);	for ( i = 0; i < character->nDependencies; ++i )	{		SWFCharacter c = character->dependencies[i];		if ( !SWFBlock_isDefined((SWFBlock)c) )		{			deps = (SWFCharacter*) realloc(deps, sizeof(SWFCharacter) * (nDeps + 1));			deps[nDeps] = c;			++nDeps;		}	}	if ( nDeps == *nDepsPtr )		return FALSE;	*depsPtr = deps;	*nDepsPtr = nDeps;	return TRUE;}intSWFCharacter_getScaledWidth(SWFCharacter character){	return SWFRect_getWidth(character->bounds);}intSWFCharacter_getScaledHeight(SWFCharacter character){	return SWFRect_getHeight(character->bounds);}SWFRectSWFCharacter_getBounds(SWFCharacter character){	return character->bounds;}/* rather, should it go on the display list..	 "character" is a bit of a sloppy category now */BOOLSWFBlock_isCharacter(SWFBlock block){	SWFBlocktype type = block->type;	if ( type == SWF_DEFINETEXT		 || type == SWF_DEFINETEXT2			 ||			 type == SWF_DEFINESHAPE	 || type == SWF_DEFINESHAPE2		 ||			 type == SWF_DEFINESHAPE3	 || type == SWF_DEFINEMORPHSHAPE ||			 type == SWF_DEFINESPRITE	 || type == SWF_DEFINEBUTTON		 ||			 type == SWF_DEFINEBUTTON2 || type == SWF_DEFINETEXT2			 ||			 type == SWF_DEFINEBITS ||			 type == SWF_DEFINEBITSJPEG2 ||			 type == SWF_DEFINEBITSJPEG3 ||			 type == SWF_DEFINELOSSLESS ||			 type == SWF_DEFINELOSSLESS2 ||			 type == SWF_DEFINEFONT || type == SWF_DEFINEFONT2 ||			 type == SWF_DEFINEEDITTEXT ||			 type == SWF_DEFINEVIDEOSTREAM ||			 type == SWF_PREBUILTCLIP ||			 type == SWF_DEFINESOUND ||			 type == SWF_BROWSERFONT)	{		return TRUE;	}	else		return FALSE;}voidSWFCharacter_setFinished(SWFCharacter character){	character->isFinished = TRUE;}BOOLSWFCharacter_isFinished(SWFCharacter character){	return character->isFinished;}/* * Local variables: * tab-width: 2 * c-basic-offset: 2 * End: */

⌨️ 快捷键说明

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