Ejemplo n.º 1
0
/*
 * Adds a block to a movie.
 * This function adds a block or character to a movieclip.
 * returns a SWFDisplayItem 
 */
SWFDisplayItem
SWFMovieClip_add(SWFMovieClip clip, SWFBlock block)
{
	if ( SWFBlock_getType(block) == SWF_DEFINEBITS ||
			 SWFBlock_getType(block) == SWF_DEFINEBITSJPEG2 ||
			 SWFBlock_getType(block) == SWF_DEFINEBITSJPEG3 ||
			 SWFBlock_getType(block) == SWF_DEFINELOSSLESS ||
			 SWFBlock_getType(block) == SWF_DEFINELOSSLESS2 )
	{
		block = (SWFBlock)newSWFShapeFromBitmap((SWFBitmap)block, SWFFILL_TILED_BITMAP);
	}

	if ( SWFBlock_isCharacter(block) )
	{
		SWFCharacter_getDependencies((SWFCharacter)block,
																 &CHARACTER(clip)->dependencies,
																 &CHARACTER(clip)->nDependencies);

		SWFCharacter_addDependency((SWFCharacter)clip, (SWFCharacter)block);

		SWFCharacter_setFinished((SWFCharacter)block);

		return SWFDisplayList_add(clip->displayList, clip->blockList, (SWFCharacter)block);
	}
	else
	{
		/* XXX - make sure it's a legit block for a sprite */
		SWFBlockList_addBlock(clip->blockList, block);
	}

	return NULL;
}
Ejemplo n.º 2
0
Archivo: button.c Proyecto: cran/R2SWF
/* adds a character 
 * Add a character to a button for given states
 * possible states:
 * SWFBUTTON_HIT
 * SWFBUTTON_DOWN
 * SWFBUTTON_OVER
 * SWFBUTTON_UP
 * states can be combined using the binary or operator
 * returns a SWFButtonRecord object which can be further modified.
 */
SWFButtonRecord
SWFButton_addCharacter(SWFButton button /* button object */, 
                       SWFCharacter character /* character to be added */, 
                       byte state /* state description */)
{
	SWFMatrix m;
	SWFButtonRecord record;
	SWFCharacter **depsPtr = &CHARACTER(button)->dependencies;
	int *depCount = &CHARACTER(button)->nDependencies;
	
	if ( SWFCharacter_isFinished((SWFCharacter)button) )
	{
		SWF_warn("Can't alter a button after it's been added to another character");
		return NULL;
	}

	SWFCharacter_getDependencies(character, depsPtr, depCount);
	SWFCharacter_addDependency((SWFCharacter)button, character);
	SWFCharacter_setFinished(character);
	
	m = newSWFMatrix(1.0, 0, 0, 1.0, 0, 0);
	record = newSWFButtonRecord(state, character, 0, m);
	SWFButton_addRecord(button, record);
	return record;
}
Ejemplo n.º 3
0
static void
SWFMovie_addCharacterDependencies(SWFMovie movie, SWFCharacter character)
{
	SWFCharacter* deps = NULL;
	int nDeps = 0;

	if ( SWFCharacter_getDependencies(character, &deps, &nDeps) )
	{
		int i;

		for ( i = 0; i < nDeps; ++i )
			SWFMovie_addDependency(movie, deps[i]);

		free(deps);
	}
}
Ejemplo n.º 4
0
Archivo: button.c Proyecto: cran/R2SWF
/* adds a shape character 
 * Add a shape character to a button for given states
 * possible states:
 * SWFBUTTON_HIT  
 * SWFBUTTON_DOWN  
 * SWFBUTTON_OVER
 * SWFBUTTON_UP
 * states can be combined using the binary or operator    
 * deprecated! use SWFButton_addCharacter instead
 */
void SWFButton_addShape(SWFButton button, SWFCharacter character, byte flags)
{
	SWFMatrix m;
	SWF_warnOnce("SWFButton_addShape is deprecated\nUse SWFButton_addCharacter instead\n");
	if ( SWFCharacter_isFinished((SWFCharacter)button) )
		SWF_error("Can't alter a button after it's been added to another character");

	m = newSWFMatrix(1.0, 0, 0, 1.0, 0, 0);

	SWFCharacter_getDependencies((SWFCharacter)character,
									 &CHARACTER(button)->dependencies,
									 &CHARACTER(button)->nDependencies);

	SWFCharacter_addDependency((SWFCharacter)button, (SWFCharacter)character);

	SWFCharacter_setFinished(character);
	SWFButton_addRecord(button, newSWFButtonRecord(flags, character, 0, m));
}