[Gtk-sharp-list] Gdk.Pixbuf.Pixels property type changed, why?

ivan.guzvinec@telemach.net ivan.guzvinec@telemach.net
Fri, 04 Jun 2004 04:33:46 +0200


I upgraded gtk# from 0.16 to 0.93 and I'm getting errors recompiling my project.

Error message:
ImageStore.cs(398) error CS0021: Type `System.IntPtr' does not have any indexers

   m_nC = pic.Pixels[ipix] + nStepB;

So I investigated and found that the Gdk.Pixbuf.Pixels property is no longer of
type byte*, but instead of type IntPtr.

// the 'Pixels' property
   static extern IntPtr gdk_pixbuf_get_pixels(IntPtr raw);
   public unsafe IntPtr Pixels {
   get {
       IntPtr ret = gdk_pixbuf_get_pixels (Handle);
       return ret;

Why did this change?
How can I now use Gdk.Pixbuf.Pixels property to get/set individual pixels inside
a Pixbuf? (I need to be able to do "pixbuf.Pixels[index] = color;" too)