Re: GdkPixbuf API proposial
- From: Oleg Klimov <quif land ru>
- To: gtk-devel-list gnome org
- Subject: Re: GdkPixbuf API proposial
- Date: Fri, 21 Feb 2003 15:54:34 +0300
New features:
<..>
- GdkPixbufClippingRegion object (2 structs, 13 function calls)
- now possible to draw lines, polygons etc
Code example:
void draw_textured_line(
GdkPixbuf* dest,
gdouble x1, gdouble y1, gdouble x2, gdouble y2,
gdouble thickness,
GdkPixbuf* texture, gdouble texture_angle)
{
gint bound_x, bound_y, bound_width, bound_height;
GdkPixbuf* region = gdk_pixbuf_clip_region_new(0, 0, dest->width,
dest->height);
gdk_pixbuf_clip_region_line(region, x1, y1, x2, y2, thickness);
gdk_pixbuf_clip_region_circle(region, x1, y1, thickness);
gdk_pixbuf_clip_region_circle(region, x2, y2, thickness);
gdk_pixbuf_clip_region_get_bounds(region,
&bound_x, &bound_y, &bound_width, &bound_height);
GdkPixbuf* tmp;
tmp = gdk_pixbuf_new(..., bound_width, bound_height);
GdkPixbufTransform* trans;
trans = gdk_pixbuf_affine_new();
gdk_pixbuf_affine_rotate(GDK_PIXBUF_AFFINE(trans), texture_angle);
gdk_pixbuf_transform_set_edge_mode(trans, GDK_PIXBUF_EDGE_TILE);
gdk_pixbuf_transform_render(trans, tmp, texture);
gdk_pixbuf_copy_region(dest, region, tmp, bound_x, bound_y);
g_object_unref( <all used objects> );
}
(sorry for some typos...:)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]