[Gtk-sharp-list] From Gtk+ to Gtk#
Wed, 09 Mar 2005 13:28:17 +0000
This is not linear, but I'll try to help you. First of all, C# is 100%
object oriented, so many things appear a little different from the
original API. Yet, object support methods but somethings work even a
little bit more different, for instance most *_get_* and *_set_* become
properties in C# world.
For example, in your code to get the dimensions:
ht = yourpixbufferObject.Height;
wt = yourpixbufferObject.Width;
this warps to the ..._get_... and if there was a set it would be:
yourpixbufferObject.Height = ht;
Yet, many things are different, for instance that properties are read-
only, so you can't set them. You must use methods.
Anyway, you should see monodoc references to see the details for the
Gtk# implementations. Mosts things will sound familiar to you.
Now, about the Color of pixels, it looks to me that isn't implemented
yet. The property returns a System.IntPtr or (in C language) a int
pointer. The documentation states that this pointer points to the real
data, so you can use it as you would do C - who knows a copy paste would
work... lol. I've no experience in using C code from C# side, so I can't
tell you for sure if you will not need to use the "unsafe" option in mcs
to work out this pointer.
Anyway, a GTK# guru can tell you better, but I tried to put you in the
On Wed, 2005-03-09 at 11:30 +0100, email@example.com wrote:
> I'd like to know how can I translate this code
> (http://cybernetics.freewebspace.com/gtk/improc/node14.html) from from
> Gtk+ to Gtk#. I paste the code below.
> The main question is: how can I set/get the colors from every individual
> pixel from a Pixbuf?
> void draw_normal_border(GdkPixbuf *pb,int red,int green,int blue)
> int ht,wt;
> int i=0,j=0;
> int flag=0;
> int border=10; //10 pixels wide border.
> int rowstride=0;
> gchar *pixel;
> flag=0;//reset flag every time.
> if(i< (border))
> else if(i > (ht-border))
> else if(j < (border)*3)
> else if(j > (wt-border)*3)
> Gtk-sharp-list maillist - Gtkfirstname.lastname@example.org
Alexandre Miguel Pedro Gomes,