Ejemplo n.º 1
0
static void RenderBitmap(SFNode *node, void *rs)
{
	DrawableContext *ctx;
	BitmapStack *st = (BitmapStack *)Node_GetPrivate(node);
	RenderEffect2D *eff = (RenderEffect2D *)rs;

	/*we never cache anything with bitmap...*/
	Node_ClearDirty(node);

	ctx = drawable_init_context(st->graph, eff);
	if (!ctx || !ctx->h_texture ) return;
	/*always build the path*/
	Bitmap_BuildGraph(st, ctx, eff);
	/*even if set this is not true*/
	ctx->aspect.has_line = 0;
	/*this is to make sure we don't fill the path if the texture is transparent*/
	ctx->aspect.filled = 0;
	ctx->aspect.pen_props.width = 0.0;
	ctx->no_antialias = 1;

	ctx->transparent = 0;
	/*if clipper then transparent*/

	if (ctx->h_texture->transparent) {
		ctx->transparent = 1;
	} else {
		M_Appearance *app = (M_Appearance *)ctx->appear;
		if ( app->material && (Node_GetTag((SFNode *)app->material)==TAG_MPEG4_MaterialKey) ) {
			if (((M_MaterialKey*)app->material)->isKeyed) ctx->transparent = 1;
		} else if (!eff->color_mat.identity) ctx->transparent = 1;
	}

	/*bounds are stored when building graph*/	
	drawable_finalize_render(ctx, eff);
}
Ejemplo n.º 2
0
static void RenderCurve2D(SFNode *node, void *rs)
{
	DrawableContext *ctx;
	M_Curve2D *c2D = (M_Curve2D *)node;
	Drawable *cs = Node_GetPrivate(node);
	RenderEffect2D *eff = rs;

	if (!c2D->point) return;


	if (Node_GetDirty(node)) {
		drawable_reset_path(cs);
		cs->path->resolution = eff->surface->render->compositor->base_curve_resolution;
		cs->path->fineness = c2D->fineness;
		if (eff->surface->render->compositor->high_speed)  cs->path->fineness /= 2;
		build_curve2D(cs, c2D);
		Node_ClearDirty(node);
		cs->node_changed = 1;
	}

	ctx = drawable_init_context(cs, eff);
	if (!ctx) return;
	drawctx_store_original_bounds(ctx);
	drawable_finalize_render(ctx, eff);
}
Ejemplo n.º 3
0
static void RenderRectangle(SFNode *node, void *reff)
{
	DrawableContext *ctx;
	Drawable *rs = Node_GetPrivate(node);
	RenderEffect2D *eff = reff;

	if (Node_GetDirty(node)) {
		drawable_reset_path(rs);
		m4_path_add_rectangle(rs->path, 0, 0, ((M_Rectangle *) node)->size.x, ((M_Rectangle *) node)->size.y);
		Node_ClearDirty(node);
		rs->node_changed = 1;
	}
	ctx = drawable_init_context(rs, eff);
	if (!ctx) return;
	
	ctx->transparent = 0;
	/*if not filled, transparent*/
	if (!ctx->aspect.filled) {
		ctx->transparent = 1;
	} 
	/*if alpha, transparent*/
	else if (M4C_A(ctx->aspect.fill_color) != 0xFF) {
		ctx->transparent = 1;
	} 
	/*if rotated, transparent (doesn't fill bounds)*/
	else if (ctx->transform.m[1] || ctx->transform.m[3]) {
		ctx->transparent = 1;
	}
	else if (!eff->color_mat.identity) 
		ctx->transparent = 1;	

	drawctx_store_original_bounds(ctx);
	drawable_finalize_render(ctx, eff);
}
Ejemplo n.º 4
0
static void FS_Render(SFNode *node, void *rs)
{
	Bool build;
	DrawableContext *ctx;
	FSStack *st = (FSStack *) Node_GetPrivate(node);
	RenderEffect2D *eff = (RenderEffect2D *)rs;

	/*check for geometry change*/
	build = 0;
	if (Node_GetDirty(node)) {
		/*build*/
		clean_paths(st, st->graph->compositor->g_hw);
		build_shape(st, node);
		Node_ClearDirty(node);
		st->graph->node_changed = 1;
	}

	/*finalize*/
	ctx = drawable_init_context(st->graph, eff);
	if (!ctx) return;

	ctx->original = st->bounds;
	/*force width to maw width used for clipper compute*/
	if (st->max_width) {
		ctx->aspect.has_line = 1;
		ctx->aspect.pen_props.width = st->max_width;
	}
	drawable_finalize_render(ctx, eff);
}
Ejemplo n.º 5
0
static void RenderEllipse(SFNode *node, void *rs)
{
	DrawableContext *ctx;
	Drawable *cs = Node_GetPrivate(node);
	RenderEffect2D *eff = rs;

	if (Node_GetDirty(node)) {
		drawable_reset_path(cs);
		m4_path_add_ellipse(cs->path, ((M_Ellipse *) node)->radius.x, ((M_Ellipse *) node)->radius.y);
		Node_ClearDirty(node);
		cs->node_changed = 1;
	}
	ctx = drawable_init_context(cs, eff);
	if (!ctx) return;
	
	drawctx_store_original_bounds(ctx);
	drawable_finalize_render(ctx, eff);
}
Ejemplo n.º 6
0
static void svg_sani_DrawablePostRender(Drawable *cs, SVG_SANI_TransformableElement *elt, RenderEffect2D *eff, 
									Bool rectangular, Fixed path_length)
{
	GF_FieldInfo info;
	GF_Matrix2D backup_matrix;
	DrawableContext *ctx;

	if (eff->traversing_mode == TRAVERSE_GET_BOUNDS) {
		gf_node_get_field_by_name(cs->node, "display", &info);
		if (*(SVG_Display *)info.far_ptr == SVG_DISPLAY_NONE) gf_path_get_bounds(cs->path, &eff->bounds);
		return;
	}

	gf_node_get_field_by_name(cs->node, "display", &info);
	if (*(SVG_Display *)info.far_ptr == SVG_DISPLAY_NONE) return;
		
	gf_node_get_field_by_name(cs->node, "visibility", &info);
	if (*(SVG_Visibility *)info.far_ptr == SVG_VISIBILITY_HIDDEN) return;

	gf_svg_sani_apply_local_transformation(eff, (GF_Node *)elt, &backup_matrix);

	gf_node_get_field_by_name(cs->node, "fill-rule", &info);
	if (*(SVG_FillRule *)info.far_ptr == SVG_FILLRULE_NONZERO)
		cs->path->flags |= GF_PATH_FILL_ZERO_NONZERO;
	else 
		cs->path->flags &= ~GF_PATH_FILL_ZERO_NONZERO;

	ctx = svg_sani_drawable_init_context(cs, eff);
	if (ctx) {
		if (rectangular) {
			if (ctx->h_texture && ctx->h_texture->transparent) {}
			else if (GF_COL_A(ctx->aspect.fill_color) != 0xFF) {}
			else if (ctx->transform.m[1] || ctx->transform.m[3]) {}
			else {
				ctx->flags &= ~CTX_IS_TRANSPARENT;
			}
		}
		if (path_length) ctx->aspect.pen_props.path_length = path_length;
		drawable_finalize_render(ctx, eff, NULL);
	}

	gf_svg_sani_restore_parent_transformation(eff, &backup_matrix);
}
Ejemplo n.º 7
0
static void RenderILS2D(SFNode *node, void *rs)
{
	DrawableContext *ctx;
	M_IndexedLineSet2D *ils2D = (M_IndexedLineSet2D *)node;
	Drawable *cs = Node_GetPrivate(node);
	RenderEffect2D *eff = rs;

	if (!ils2D->coord) return;

	if (Node_GetDirty(node)) {
		drawable_reset_path(cs);
		build_graph(cs, ils2D);
		Node_ClearDirty(node);
		cs->node_changed = 1;
	}

	ctx = drawable_init_context(cs, eff);
	if (!ctx) return;
	/*ILS2D are NEVER filled*/
	ctx->aspect.filled = 0;
	drawctx_store_original_bounds(ctx);
	drawable_finalize_render(ctx, eff);
}
Ejemplo n.º 8
0
static void RenderPointSet2D(SFNode *node, void *rs)
{
	DrawableContext *ctx;
	M_PointSet2D *ps2D = (M_PointSet2D *)node;
	Drawable *cs = Node_GetPrivate(node);
	RenderEffect2D *eff = rs;

	if (!ps2D->coord) return;

	if (Node_GetDirty(node)) {
		drawable_reset_path(cs);
		build_graph(cs, &eff->transform, ps2D);
		Node_ClearDirty(node);
		cs->node_changed = 1;
	}

	ctx = drawable_init_context(cs, eff);
	if (!ctx) return;
	ctx->aspect.filled = 1;
	ctx->aspect.has_line = 0;
	drawctx_store_original_bounds(ctx);
	drawable_finalize_render(ctx, eff);
}