[Gtk-sharp-list] Setting pixels colors of a Pixbuf
Duncan Mak
duncan@ximian.com
13 Mar 2003 18:27:03 -0500
--=-Geg3Ijhozc+VyE2bTiVg
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Mon, 2003-03-10 at 05:33, Stephane SOPPERA wrote:
> >
> >
> >>>Gdk.Pixbuf.Pixels.
> >>>
> >>>I am afraid that using byte [] might make a copy of the data, so we
> >>>should probably use byte * as the return value.
> >>>
Miguel asked me to look into this. I tried marking the metadata and all
that, but it didn't seem to work. I tried pretty hard to convince the
generator to give me a 'byte *', but it just kept on changing it into a
C# byte.
My solution is this: mark the existing Pixels stuff as hidden, and just
provide what we want in the custom file.
Patch attached. If it's good, I'll commit it.
Duncan.
--=-Geg3Ijhozc+VyE2bTiVg
Content-Disposition: attachment; filename=pixbuf.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=pixbuf.patch; charset=ISO-8859-1
Index: sources/Gdk.metadata
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/sources/Gdk.metadata,v
retrieving revision 1.12
diff -u -p -r1.12 Gdk.metadata
--- sources/Gdk.metadata 1 Mar 2003 22:18:09 -0000 1.12
+++ sources/Gdk.metadata 13 Mar 2003 23:28:08 -0000
@@ -182,4 +182,16 @@
</attribute>
</data>
</rule>
+
+<rule>
+ <class name=3D"GdkPixbuf">
+ <method>GetPixels</method>
+ </class>
+ <data>
+ <attribute target=3D"method">
+ <name>hidden</name>
+ <value>1</value>
+ </attribute>
+ </data>
+</rule>
</metadata>
Index: gdk/Pixbuf.custom
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/gdk/Pixbuf.custom,v
retrieving revision 1.3
diff -u -p -r1.3 Pixbuf.custom
--- gdk/Pixbuf.custom 19 Feb 2003 06:00:27 -0000 1.3
+++ gdk/Pixbuf.custom 13 Mar 2003 23:28:08 -0000
@@ -145,3 +145,16 @@
public Gdk.Pixbuf CompositeColorSimple(int dest_width, int dest_height, =
Gdk.InterpType interp_type, int overall_alpha, int check_size, System.Drawi=
ng.Color color1, System.Drawing.Color color2) {
return CompositeColorSimple (dest_width, dest_height, interp_type, over=
all_alpha, check_size, (uint) color1.ToArgb (), (uint) color2.ToArgb ());
}
+
+//
+// the 'Pixels' property
+//
+ [DllImport("libgdk_pixbuf-2.0-0.dll")]
+ static extern unsafe byte* gdk_pixbuf_get_pixels(IntPtr raw);
+
+ public unsafe byte* Pixels {
+ get {
+ byte *ret =3D gdk_pixbuf_get_pixels (Handle);
+ return ret;
+ }
+ }
Index: api/gdk-api.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/api/gdk-api.xml,v
retrieving revision 1.14
diff -u -p -r1.14 gdk-api.xml
--- api/gdk-api.xml 1 Mar 2003 22:18:09 -0000 1.14
+++ api/gdk-api.xml 13 Mar 2003 23:28:08 -0000
@@ -2518,7 +2518,7 @@
<parameter type=3D"const-gchar*" name=3D"key"/>
</parameters>
</method>
- <method name=3D"GetPixels" cname=3D"gdk_pixbuf_get_pixels">
+ <method name=3D"GetPixels" cname=3D"gdk_pixbuf_get_pixels" hidden=3D=
"1">
<return-type type=3D"guchar*"/>
</method>
<method name=3D"GetRowstride" cname=3D"gdk_pixbuf_get_rowstride">
--=-Geg3Ijhozc+VyE2bTiVg--