Re: Plugin that can open a drawable on screen. What am I doing wrong?

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

 



Louise Hoffman wrote:
> Now I don't get any errors, but I don't see the pixel either...
> 
>   /* Trying to set a pixel at x=5,y=5 with value 150 in 24 bit color */
>   const guint8 *pixel;
>   pixel = (guint8 *) "150";
>   gboolean s;
>   s = gimp_drawable_set_pixel (layer, 5, 5, 24, pixel);
>   printf ("Was the pixel set?: %i", s);

Hi again!

No you got an error. 0, or FALSE, means "error" which you can read in 
the documentation for the function:

http://developer.gimp.org/api/2.0/libgimp/libgimp-gimpdrawable.html#gimp-drawable-set-pixel

There you can also read that the num_channels parameter shall be the 
"The number of channels for the pixel.". You try to pass the number of 
bits, 24. Even that is wrong since you create the layer with an alpha 
channel, so the correct wrong thing to pass would be 32.

  / Martin

-- 

My GIMP Blog:
http://www.chromecode.com/
"Reducing UI clutter, docking bars removed"
_______________________________________________
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