[Gimp-developer] Drawing a line in a GIMP plugin
Adam C Powell IV
hazelsct at debian.org
Fri May 29 14:51:42 PDT 2009
Hi,
I'm a relative newbie trying to have a GIMP plugin draw a line (among
other things).
I found gdk_draw_line which seems to be what I want. But I don't know
what to do about drawable. I of course have the GimpDrawable, and I
have a guint8 array which holds the data from the GimpDrawable:
gint32 drawable_ID;
int x1, y1, x2, y2;
guint8 *source_data;
GimpDrawable *drawable;
GimpPixelRgn source_region;
if (!(drawable = (GimpDrawable *) gimp_drawable_get (drawable_ID)))
return FALSE;
has_selection = gimp_drawable_mask_bounds (drawable_ID,
&x1, &y1, &x2, &y2);
if (!(source_data = g_new (guchar, drawable->bpp * (x2-x1) * (y2-y1))))
return FALSE;
gimp_pixel_rgn_init (&source_region, drawable, x1, y1, x2-x1, y2-y1, FALSE,
FALSE);
gimp_pixel_rgn_get_rect (&source_region, source_data, x1, y1, x2-x1, y2-y1);
But I don't see how to get or make a GdkDrawable which I can pass to
gdk_draw_line. Do I need to create a GdkPixmap from source_data, and
draw into that?
Thanks,
-Adam
--
GPG fingerprint: D54D 1AEE B11C CE9B A02B C5DD 526F 01E8 564E E4B6
Engineering consulting with open source tools
http://www.opennovation.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /lists/gimp-developer/attachments/20090529/c3e141f0/attachment-0001.bin
More information about the Gimp-developer
mailing list