[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-gtk-sharp-list
Subject:    Re: [Gtk-sharp-list] Get colour of pixel in Gdk.Pixmap
From:       Dan Winship <danw () novell ! com>
Date:       2005-06-24 15:35:41
Message-ID: 1119627341.14673.24.camel () twelve-monkeys ! boston ! ximian ! com
[Download RAW message or body]

On Fri, 2005-06-24 at 17:24 +0200, Thomas Pryds Lauritsen wrote:
> I have a Gdk.Pixmap p from which I need to fetch the colour of certain
> pixels. Something like
> 
> Gdk.Color c = p.getColorOfPixel(x, y);
> 
> would be preferred, but I haven't been able to find any info on this
> matter. Surely this must be possible, but the question is: how?

The "Pixels" property gives you access to the raw pixel data. However,
it's an unmanaged array, so you'll need to use unsafe code to work with
it.

http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#image-data

gives an example of C code that accesses individual pixels directly. The
unsafe C# code would be similar.

-- Dan


_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic