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,
  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?

GPG fingerprint: D54D 1AEE B11C CE9B A02B  C5DD 526F 01E8 564E E4B6

Engineering consulting with open source tools

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

Gimp-developer mailing list

Reply via email to