[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


Hi,

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
defined"

ImageStore.cs@398:
   ...
   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.

./gdk/Pixbuf.custom:
//
// the 'Pixels' property
//
   [DllImport("libgdk_pixbuf-2.0-0.dll")]
   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)

Thanks,
Ivan