Drawing a line in a GIMP plugin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux