示例#1
0
SWFText
newSWFText()
{
	SWFText text = (SWFText)malloc(sizeof(struct SWFText_s));

	SWFCharacterInit((SWFCharacter)text);

	CHARACTERID(text) = ++SWF_gNumCharacters;

	BLOCK(text)->type = SWF_DEFINETEXT;
	BLOCK(text)->writeBlock = writeSWFTextToMethod;
	BLOCK(text)->complete = completeSWFText;
	BLOCK(text)->dtor = (destroySWFBlockMethod) destroySWFText;

	CHARACTER(text)->bounds = newSWFRect(0,0,0,0);

	text->out = newSWFOutput();
	text->currentRecord = NULL;
	text->initialRecord = NULL;
	text->matrix = NULL;
	text->nAdvanceBits = 0;

#if TRACK_ALLOCS
	text->gcnode = ming_gc_add_node(text, (dtorfunctype) destroySWFBitmap);
#endif

	return text;
}
示例#2
0
SWFText
newSWFText()
{
    SWFRect temp_rect;

    SWFText text = (SWFText)malloc(sizeof(struct SWFText_s));

    /* If malloc failed, return NULL to signify this */
    if (NULL == text)
        return NULL;

    SWFCharacterInit((SWFCharacter)text);

    CHARACTERID(text) = ++SWF_gNumCharacters;

    BLOCK(text)->type = SWF_DEFINETEXT;
    BLOCK(text)->writeBlock = writeSWFTextToMethod;
    BLOCK(text)->complete = completeSWFText;
    BLOCK(text)->dtor = (destroySWFBlockMethod) destroySWFText;

    temp_rect = newSWFRect(0,0,0,0);

    /* If newSWFRect() failed, return NULL to signify this */
    if (NULL == temp_rect)
    {
        free(text);
        return NULL;
    }

    CHARACTER(text)->bounds = temp_rect;

    text->out = newSWFOutput();

    /* If newSWFOutput() failed, return NULL to signify this */
    if (NULL == text->out)
    {
        destroySWFRect(temp_rect);
        free(text);
        return NULL;
    }

    text->currentRecord = NULL;
    text->initialRecord = NULL;
    text->matrix = NULL;
    text->nAdvanceBits = 0;

#if TRACK_ALLOCS
    text->gcnode = ming_gc_add_node(text, (dtorfunctype) destroySWFText);
#endif

    return text;
}
示例#3
0
/*
 * create a new SWFMovieClip (Sprite) instance
 * A SWFMovieClip is a movie inside a movie. It supports 
 * adding and removing displayable objects, actions and sound
 *
 * returns a SWFMovieClip instance.
 */
SWFMovieClip
newSWFMovieClip()
{
	SWFMovieClip clip = (SWFMovieClip)newSWFSprite();
	clip = (SWFMovieClip)realloc(clip, sizeof(struct SWFMovieClip_s));

	clip->blockList = newSWFBlockList();
	clip->displayList = newSWFSpriteDisplayList();
#if TRACK_ALLOCS
	clip->gcnode = ming_gc_add_node(clip, (dtorfunctype) destroySWFMovieClip);
#endif

	return clip;
}
示例#4
0
SWFFill
newSWFFill(SWFFillStyle fillstyle)
{
	SWFFill fill = (SWFFill)malloc(sizeof(struct SWFFill_s));

	fill->fillstyle = fillstyle;
	fill->position = newSWFPosition(SWFFillStyle_getMatrix(fill->fillstyle));

#if TRACK_ALLOCS
	fill->gcnode = ming_gc_add_node(fill, (dtorfunctype) destroySWFFill);
#endif

	return fill;
}
示例#5
0
/*
 * create a new SWFMovie
 * This function creates a new SWFMovie with the specified version.
 */
SWFMovie
newSWFMovieWithVersion(int version /* Flash version */)
{
	SWFMovie movie;

	Ming_useSWFVersion(version);

	movie = (SWFMovie) malloc(sizeof(struct SWFMovie_s));

	/* If malloc failed, return NULL to signify this */
	if (movie == NULL)
		return NULL;

	movie->version = version;
	movie->blockList = newSWFBlockList();
	movie->displayList = newSWFDisplayList();
	/* Default movie dimension is hard-coded to 320x240 pixels */
	movie->bounds = newSWFRect(0, 320*20, 0, 240*20);
	movie->rate = 12.0;
	movie->totalFrames = 0;
	movie->nFrames = 0;

	movie->nExports = 0;
	movie->exports = NULL;

	movie->nImports = 0;
	movie->imports = NULL;

	movie->nFonts = 0;
	movie->fonts = NULL;

	movie->backgroundBlock = NULL;

	if(version >= 8)	
		movie->fattrs = newSWFFileAttributes();
	else
		movie->fattrs = NULL;
	movie->metadata = NULL;
	movie->limits = NULL;
	movie->symbolClass = NULL;
	movie->sceneData = NULL;
#if TRACK_ALLOCS
	movie->gcnode = ming_gc_add_node(movie, (dtorfunctype) destroySWFMovie);
#endif

	return movie;
}
示例#6
0
SWFShape
newSWFShape()
{
    SWFShape shape = (SWFShape)malloc(sizeof(struct SWFShape_s));

    /* If malloc failed, return NULL to signify this */
    if (NULL == shape)
        return NULL;

    SWFCharacterInit((SWFCharacter)shape);

    BLOCK(shape)->writeBlock = writeSWFShapeBlockToMethod;
    BLOCK(shape)->complete = completeSWFShapeBlock;
    BLOCK(shape)->dtor = (destroySWFBlockMethod) destroySWFShape;
    BLOCK(shape)->type = SWF_DEFINESHAPE3;

    CHARACTERID(shape) = ++SWF_gNumCharacters;

    shape->out = newSWFOutput();
    CHARACTER(shape)->bounds = newSWFRect(0,0,0,0);
    shape->edgeBounds = newSWFRect(0,0,0,0);

    shape->records = NULL;
    shape->lines = NULL;
    shape->fills = NULL;

    shape->nRecords = 0;
    shape->xpos = 0;
    shape->ypos = 0;
    shape->nLines = 0;
    shape->nFills = 0;
    shape->lineWidth = 0;
    shape->isMorph = FALSE;
    shape->isEnded = FALSE;
    shape->flags = 0;
    shape->useVersion = SWF_SHAPE3;

    SWFOutput_writeUInt8(shape->out, 0); /* space for nFillBits, nLineBits */

#if TRACK_ALLOCS
    shape->gcnode = ming_gc_add_node(shape, (dtorfunctype) destroySWFShape);
#endif

    return shape;
}
示例#7
0
文件: placeobject.c 项目: cran/R2SWF
SWFPlaceObject2Block
newSWFPlaceObject2Block(int depth)
{
	SWFPlaceObject2Block place = (SWFPlaceObject2Block)malloc(sizeof(struct SWFPlaceObject2Block_s));

	/* If malloc failed, return NULL to signify this */
	if (NULL == place)
		return NULL;

	SWFBlockInit((SWFBlock)place);

	BLOCK(place)->type = SWF_PLACEOBJECT2;
	BLOCK(place)->writeBlock = writeSWFPlaceObject2BlockToStream;
	BLOCK(place)->complete = completeSWFPlaceObject2Block;
	BLOCK(place)->dtor = (destroySWFBlockMethod) destroySWFPlaceObject2Block;

	place->version = 2;
	place->out = NULL;
	place->name = NULL;

	place->move = 0;
	place->matrix = NULL;
	place->cXform = NULL;
	place->character = NULL;
	place->masklevel = -1;
	place->ratio = -1;
	place->depth = depth;

	place->nActions = 0;
	place->actionORFlags = 0;
	place->actionFlags = NULL;
/*	place->actionChars = NULL;	*/
	place->actions = NULL;

	place->hasCacheFlag = 0;
	place->hasBlendFlag = 0;
	place->hasFilterFlag = 0;
	place->filterList = NULL;
#if TRACK_ALLOCS
	place->gcnode = ming_gc_add_node(place, (dtorfunctype) destroySWFPlaceObject2Block);
#endif
	return place;
}
示例#8
0
文件: dbl.c 项目: cran/R2SWF
SWFDBLBitmapData
newSWFDBLBitmapData_fromData(dblData data)
{
	SWFDBLBitmapData dbl;

	dbl = (SWFDBLBitmapData)malloc(sizeof(struct SWFDBLBitmapData_s));

	/* If malloc failed, return NULL to signify this */
	if (NULL == dbl)
		return NULL;

	SWFCharacterInit((SWFCharacter)dbl);

	CHARACTERID(dbl) = ++SWF_gNumCharacters;

	BLOCK(dbl)->writeBlock = writeSWFDBLBitmapDataToMethod;
	BLOCK(dbl)->complete = completeSWFDBLBitmap;
	BLOCK(dbl)->dtor = (destroySWFBlockMethod) destroySWFDBLBitmapData;

	dbl->width = data->width;
	dbl->height = data->height;
	dbl->format = data->format;
	dbl->format2 = data->format2;
	dbl->data = data->data;

	if(data->hasalpha)
		BLOCK(dbl)->type = SWF_DEFINELOSSLESS2;
	else
		BLOCK(dbl)->type = SWF_DEFINELOSSLESS;

	BLOCK(dbl)->length = data->length;
	BLOCK(dbl)->length += 7; /* character id, format, width, height */
	if(dbl->format == 3)
		BLOCK(dbl)->length++;

	CHARACTER(dbl)->bounds = newSWFRect(0, dbl->width, 0, dbl->height);

#if TRACK_ALLOCS
	dbl->gcnode = ming_gc_add_node(dbl, (dtorfunctype)destroySWFDBLBitmapData);
#endif

	return dbl;
}