Ejemplo n.º 1
0
int
completeSWFTextField(SWFBlock block)
{
	SWFTextField field = (SWFTextField)block;

	/* we're guessing how big the block's going to be.. */
	SWFOutput out =
		newSizedSWFOutput(42 
			+ ((field->varName)?strlen(field->varName):0) 
			+ ((field->string)?strlen(field->string):0));

	field->out = out;

	resetBounds(field);

	SWFOutput_writeUInt16(out, CHARACTERID(field));
	SWFOutput_writeRect(out, CHARACTER(field)->bounds);
	SWFOutput_writeUInt16(out, field->flags);

	if(field->flags & SWFTEXTFIELD_HASFONT)
	{
		SWFOutput_writeUInt16(out, CHARACTERID(field->font.fontchar));
		SWFOutput_writeUInt16(out, field->fontHeight);
	}

	if(field->flags & SWFTEXTFIELD_HASCOLOR)
	{
		SWFOutput_writeUInt8(out, field->r);
		SWFOutput_writeUInt8(out, field->g);
		SWFOutput_writeUInt8(out, field->b);
		SWFOutput_writeUInt8(out, field->a);
	}

	if ( field->flags & SWFTEXTFIELD_HASLENGTH )
		SWFOutput_writeUInt16(out, field->length);

	if(field->flags & SWFTEXTFIELD_HASLAYOUT)
	{
		SWFOutput_writeUInt8(out, field->alignment);
		SWFOutput_writeUInt16(out, field->leftMargin);
		SWFOutput_writeUInt16(out, field->rightMargin);
		SWFOutput_writeUInt16(out, field->indentation);
		SWFOutput_writeUInt16(out, field->lineSpacing);
	}

	SWFOutput_writeString(out, (byte*) field->varName);
	if ( field->flags & SWFTEXTFIELD_HASTEXT )
		SWFOutput_writeString(out, (byte*)field->string);

	/*
		XXX - if font is a real font, do we need to talk to it?
		flash 4 just makes a browser font for (editable) textfields for all fonts
	*/

	SWFOutput_byteAlign(out);
	return SWFOutput_getLength(out);
}
Ejemplo n.º 2
0
int
completeSWFPlaceObject2Block(SWFBlock block)
{
	SWFPlaceObject2Block place = (SWFPlaceObject2Block)block;
	SWFOutput out = newSizedSWFOutput(42);

	int flags =
		((place->name != NULL)			? SWF_PLACE_HAS_NAME : 0) |
		((place->ratio != -1)				? SWF_PLACE_HAS_RATIO : 0) |
		((place->masklevel != -1)		? SWF_PLACE_HAS_MASK : 0) |
		((place->cXform != NULL)		? SWF_PLACE_HAS_CXFORM : 0) |
		((place->matrix != NULL)		? SWF_PLACE_HAS_MATRIX : 0) |
		((place->character != NULL) ? SWF_PLACE_HAS_CHARACTER : 0) |
		((place->move != 0)					? SWF_PLACE_MOVE : 0) |
		((place->nActions != 0)			? SWF_PLACE_HAS_ACTIONS : 0);

	SWFOutput_writeUInt8(out, flags);
	if(place->version == 3)
	{
		flags = 0;
		if(place->hasCacheFlag) flags |= SWF_PLACE_CACHE;
		if(place->hasBlendFlag) flags |= SWF_PLACE_HAS_BLEND;
		if(place->hasFilterFlag) flags |= SWF_PLACE_HAS_FILTER;
		SWFOutput_writeUInt8(out, flags);
	}
	SWFOutput_writeUInt16(out, place->depth);
	
	if ( place->character != NULL )
		SWFOutput_writeUInt16(out, CHARACTERID(place->character));

	if ( place->matrix != NULL )
		SWFOutput_writeMatrix(out, place->matrix);

	if ( place->cXform != NULL )
		SWFOutput_writeCXform(out, place->cXform, SWF_PLACEOBJECT2);

	if ( place->ratio != -1 )
		SWFOutput_writeUInt16(out, place->ratio);

	if ( place->name != NULL )
		SWFOutput_writeString(out, (byte*)place->name);

	if ( place->masklevel != -1 )
		SWFOutput_writeUInt16(out, place->masklevel);

	if( place->version == 3 && place->hasFilterFlag)
		SWFOutput_writeFilterList(out, place->filterList);		

	if( place->version == 3 && place->hasBlendFlag)
		SWFOutput_writeUInt8(out, place->blendMode);

	place->out = out;
	writeActions(place);

	return SWFOutput_getLength(out);
}
Ejemplo n.º 3
0
static int
completeSWFProtect(SWFBlock block)
{
    SWFProtect protect = (SWFProtect)block;

    if( protect->Password ) {
        SWFOutput_writeString(protect->out, (byte*)protect->Password);
    }

    return SWFOutput_getLength(protect->out);
}
Ejemplo n.º 4
0
static int completeSWFSceneData(SWFBlock block)
{
	SWFSceneData sdata = (SWFSceneData)block;
	int i;

	sdata->out = newSWFOutput();

	SWFOutput_writeEncUInt32(sdata->out, sdata->sceneCount);
	for(i = 0; i < sdata->sceneCount; i++)
	{
		SWFOutput_writeEncUInt32(sdata->out, sdata->sceneOffset[i]);
		SWFOutput_writeString(sdata->out, 
			(unsigned char *)sdata->sceneName[i]);
	}

	SWFOutput_writeEncUInt32(sdata->out, sdata->frameLabelCount);
	for(i = 0; i < sdata->frameLabelCount; i++)
	{
		SWFOutput_writeEncUInt32(sdata->out, sdata->frameNumber[i]);
		SWFOutput_writeString(sdata->out, 
			(unsigned char *)sdata->frameLabel[i]);
	}
	return SWFOutput_getLength(sdata->out);
}