Example #1
0
void 
SWFGradientMatrix_update(SWFMatrix matrix, SWFRect bounds)
{
	int w, h;
	float scaleX, scaleY;
	SWFMatrix tmp;
	if(bounds == NULL)
		return;

	w = SWFRect_getWidth(bounds);
	h = SWFRect_getHeight(bounds);
	scaleX = w / GRADIENT_SIZE;
	scaleY = h / GRADIENT_SIZE;

	/* update matrix translation first, to be realtive to the gradient's 
	 * coordinate system. */
	SWFMatrix_moveTo(matrix, SWFMatrix_getTranslateX(matrix) / scaleX, 
		SWFMatrix_getTranslateY(matrix) / scaleY);
	
	tmp = newSWFMatrix(scaleX, 0, 0, scaleY, bounds->minX + w/2,  bounds->minY + h/2);
	/* temporary matrix scales gradient to given bounds and centers it. */
	/* all transformations done by the user are "applied" on the tmp matrix */
	/* matrix = matrix * tmp -> "matrix is followed by tmp" */
	SWFMatrix_multiply(matrix, tmp);
	destroySWFMatrix(tmp);	
}
Example #2
0
int
SWFCharacter_getScaledWidth(SWFCharacter character)
{
	return SWFRect_getWidth(character->bounds);
}