Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. void
  2. scanline_calculate_result(gint32 image_ID, gdouble* scanline) {
  3.  
  4.  
  5.  
  6.     gint32 active_drawable;
  7.     GimpDrawable* active_drawable_pt;
  8.     GimpPixelRgn pr;
  9.     gint w,h;
  10.     struct scanline sline;
  11.  
  12.     active_drawable=gimp_image_get_active_drawable(image_ID);
  13.     active_drawable_pt = gimp_drawable_get(active_drawable);
  14.    
  15.     w = gimp_drawable_width(active_drawable);
  16.     h = gimp_drawable_height(active_drawable);
  17.     gimp_pixel_rgn_init(&pr,
  18.             active_drawable_pt,
  19.             0,
  20.             0,
  21.             w,
  22.             h,
  23.             FALSE,
  24.             FALSE);
  25.  
  26.    
  27.     guchar *buf = malloc(w*h*4);
  28.     gimp_pixel_rgn_get_rect(&pr, buf,0,0,w,h);
  29. /* manipulate buf as a bitmap of size wxh */
  30. /* here depending on the image used, i get different results */
  31.  
  32.  
  33.     gimp_drawable_detach(active_drawable_pt);
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement