Changes

Jump to navigation Jump to search
Line 121: Line 121:     
The same happens with Gtk.Separator: [http://developer.gnome.org/gtk3/3.5/GtkVSeparator.html#GtkVSeparator.description link to the documentation]
 
The same happens with Gtk.Separator: [http://developer.gnome.org/gtk3/3.5/GtkVSeparator.html#GtkVSeparator.description link to the documentation]
 +
 +
== Using Pixbuf ==
 +
 +
As I said, this is what I did, but maybe is not the correct way to do it or there is a better way. I think that if we are porting an Activity we can take advantage of this and improve the code. manuq told me that the image handling now is done with cairo, so we should port that to cairo. I didn't do this yet, but I'm researching about this.
 +
 +
So, what I did is keep using Pixbuf with Gtk3 version of the Activity. We need to replace and import some things:
 +
 +
from gi.repository import GdkPixbuf
 +
 +
Replace:
 +
 +
gtk.gdk.PixbufLoader()
 +
 +
by:
 +
 +
GdkPixbuf.PixbufLoader()
 +
 +
and,
 +
 +
gtk.gdk.pixbuf_new_from_file(file_path)
 +
 +
by:
 +
 +
GdkPixbuf.Pixbuf.new_from_file(file_path)
 +
 +
and,
 +
 +
gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
 +
                pixbuf.get_has_alpha(),
 +
                pixbuf.get_bits_per_sample(),
 +
                image_width, image_height)
 +
 +
by:
 +
 +
GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB,
 +
                      pixbuf.get_has_alpha(),
 +
                      pixbuf.get_bits_per_sample(),
 +
                      image_width, image_height)
 +
 +
''note the '''.new''' and the '''colorspace''' in the replacement.''
 +
 +
and,
 +
 +
gtk.gdk.INTERP_BILINEAR
 +
 +
by:
 +
 +
GdkPixbuf.InterpType.BILINEAR
    
= Notes =
 
= Notes =
266

edits

Navigation menu