void SWFShape_drawScaledLine(SWFShape shape, int dx, int dy) { ShapeRecord record; if ( shape->isEnded ) return; if ( dx == 0 && dy == 0 ) return; record = newShapeRecord(shape, SHAPERECORD_LINETO); SWF_assert(SWFOutput_numSBits(dx) < 18); SWF_assert(SWFOutput_numSBits(dy) < 18); record.record.lineTo->dx = dx; record.record.lineTo->dy = dy; shape->xpos += dx; shape->ypos += dy; SWFRect_includePoint(SWFCharacter_getBounds(CHARACTER(shape)), shape->xpos, shape->ypos, shape->lineWidth); SWFRect_includePoint(shape->edgeBounds, shape->xpos, shape->ypos, 0); }
/* if the current shape record isn't a style change record, add one */ static ShapeRecord addStyleRecord(SWFShape shape) { if ( shape->nRecords > 0 && shape->records[shape->nRecords-1].type == SHAPERECORD_STATECHANGE ) { return shape->records[shape->nRecords-1]; } else return newShapeRecord(shape, SHAPERECORD_STATECHANGE); }
/* THAGA */ void SWFShape_newStyles(SWFShape shape) { ShapeRecord record; shape->isUsingNewStyles = TRUE; if (shape->isNewStylesLast == TRUE) { int i; record = shape->records[shape->nRecords-1]; for ( i=0; i<*shape->nFills; ++i ) { SWFMatrix matrix = SWFFillStyle_getMatrix((*shape->fills)[i]); if ( matrix != NULL ) destroySWFMatrix(matrix); /* gradients and bitmaps are destroyed separately */ free((*shape->fills)[i]); } if ( *shape->fills != NULL ) free(*shape->fills); for ( i=0; i<*shape->nLines; ++i ) free((*shape->lines)[i]); if ( *shape->lines != NULL ) free(*shape->lines); } else { record = newShapeRecord(shape, SHAPERECORD_STATECHANGE); } record.record.stateChange->flags |= SWF_SHAPE_FILLSTYLE0FLAG; record.record.stateChange->flags |= SWF_SHAPE_FILLSTYLE1FLAG; record.record.stateChange->flags |= SWF_SHAPE_LINESTYLEFLAG; record.record.stateChange->flags |= SWF_SHAPE_NEWSTYLEFLAG; shape->lines = &record.record.stateChange->lines; shape->fills = &record.record.stateChange->fills; shape->nLines = &record.record.stateChange->nLines; shape->nFills = &record.record.stateChange->nFills; shape->isNewStylesLast = TRUE; *shape->lines = NULL; *shape->fills = NULL; *shape->nLines = 0; *shape->nFills = 0; }
void SWFShape_drawScaledCurve(SWFShape shape, int controldx, int controldy, int anchordx, int anchordy) { ShapeRecord record; if ( shape->isEnded ) return; if ( controldx == 0 && controldy == 0 && anchordx == 0 && anchordy == 0 ) return; // printf("curve %i,%i, %i, %i\n", controldx, controldy, anchordx, anchordy); record = newShapeRecord(shape, SHAPERECORD_CURVETO); record.record.curveTo->controlx = controldx; record.record.curveTo->controly = controldy; record.record.curveTo->anchorx = anchordx; record.record.curveTo->anchory = anchordy; if ( SWFOutput_numSBits(controldx) >= 18 || SWFOutput_numSBits(controldy) >= 18 || SWFOutput_numSBits(anchordx) >= 18 || SWFOutput_numSBits(anchordy) >= 18 ) SWF_error("Curve parameters too large"); /* including the control point is sloppy, but safe.. */ shape->xpos += controldx; shape->ypos += controldy; SWFRect_includePoint(SWFCharacter_getBounds(CHARACTER(shape)), shape->xpos, shape->ypos, shape->lineWidth); SWFRect_includePoint(shape->edgeBounds, shape->xpos, shape->ypos, 0); shape->xpos += anchordx; shape->ypos += anchordy; SWFRect_includePoint(SWFCharacter_getBounds(CHARACTER(shape)), shape->xpos, shape->ypos, shape->lineWidth); SWFRect_includePoint(shape->edgeBounds, shape->xpos, shape->ypos, 0); }