Beispiel #1
0
static Bool svg_video_get_transform_behavior(GF_TraverseState *tr_state, SVGAllAttributes *atts, Fixed *cx, Fixed *cy, Fixed *angle)
{
	SFVec2f pt;
	if (!atts->transformBehavior) return GF_FALSE;
	if (*atts->transformBehavior == SVG_TRANSFORMBEHAVIOR_GEOMETRIC)
		return GF_FALSE;

	pt.x = atts->x ? atts->x->value : 0;
	pt.y = atts->y ? atts->y->value : 0;
	gf_mx2d_apply_point(&tr_state->transform, &pt);
	*cx = pt.x;
	*cy = pt.y;

	*angle = 0;
	switch (*atts->transformBehavior) {
	case SVG_TRANSFORMBEHAVIOR_PINNED:
		break;
	case SVG_TRANSFORMBEHAVIOR_PINNED180:
		*angle = GF_PI;
		break;
	case SVG_TRANSFORMBEHAVIOR_PINNED270:
		*angle = -GF_PI/2;
		break;
	case SVG_TRANSFORMBEHAVIOR_PINNED90:
		*angle = GF_PI/2;
		break;
	}
	return GF_TRUE;
}
Beispiel #2
0
GF_Err evg_surface_set_path(GF_SURFACE _this, GF_Path *gp)
{
#ifndef INLINE_POINT_CONVERSION
	u32 i;
	GF_Point2D pt;
#endif
	EVGSurface *surf = (EVGSurface *)_this;

	if (!surf) return GF_BAD_PARAM;
	if (!gp || !gp->n_points) {
		surf->ftoutline.n_points = 0;
		surf->ftoutline.n_contours = 0;
		return GF_OK;
	}
	gf_path_flatten(gp);
	surf->ftoutline.n_points = gp->n_points;
	surf->ftoutline.n_contours = gp->n_contours;

	surf->ftoutline.tags = gp->tags;
	surf->ftoutline.contours = (s32*) gp->contours;

	/*store path bounds for gradient/textures*/
	gf_path_get_bounds(gp, &surf->path_bounds);
	/*invert Y (ft uses min Y)*/
	surf->path_bounds.y -= surf->path_bounds.height;

	surf->ftoutline.flags = 0;
	if (gp->flags & GF_PATH_FILL_ZERO_NONZERO) surf->ftoutline.flags = GF_PATH_FILL_ZERO_NONZERO;

#ifdef INLINE_POINT_CONVERSION
	surf->ftoutline.n_points = gp->n_points;
	surf->ftoutline.points = gp->points;
	surf->ftparams.mx = &surf->mat;
#else
	if (surf->pointlen < gp->n_points) {
		surf->points = gf_realloc(surf->points, sizeof(EVG_Vector) * gp->n_points);
		if (surf->points == NULL) {
			surf->pointlen = 0;
			return GF_OUT_OF_MEM;
		}
		surf->pointlen = gp->n_points;
	}
	surf->ftoutline.points = surf->points;
	
	for (i=0; i<gp->n_points; i++) {
		pt = gp->points[i];
		gf_mx2d_apply_point(&surf->mat, &pt);
#ifdef GPAC_FIXED_POINT
		surf->points[i].x = pt.x;
		surf->points[i].y = pt.y;
#else
		/*move to 16.16 representation*/
		surf->points[i].x = (u32) (pt.x * 0x10000L);
		surf->points[i].y = (u32) (pt.y * 0x10000L);
#endif
	}
#endif
	return GF_OK;
}