Changes

Jump to navigation Jump to search
Line 167: Line 167:  
== Using Pixbuf ==
 
== 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.
+
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. Although, I didn't do this because I consider that the image handling done in Get Books is really simple and we don't have the necessity to use Cairo here.
    
So, what I did is keep using Pixbuf with Gtk3 version of the Activity. We need to replace and import some things:
 
So, what I did is keep using Pixbuf with Gtk3 version of the Activity. We need to replace and import some things:
Line 212: Line 212:     
  GdkPixbuf.InterpType.BILINEAR
 
  GdkPixbuf.InterpType.BILINEAR
 +
 +
 +
=== Save the GdkPixbuf into a buffer ===
 +
 +
This was very difficult to find out. The gtk2 version of the code was using <pre>pixbuf.save_to_callback</pre> to save the Image on the Journal's Preview Entry but that function no longer exist in Gtk3. So, I found a similar one called <pre>pixbuf.save_to_callbackv</pre> that I couldn't find out how to use it. Even more, I realized that this function call another callback function that doesn't do so much. Reading I found an alternative (and easier) way to do this using <pre>pibuxf.save_to_bufferv</pre>:
 +
 +
succes, data = pixbuf2.save_to_bufferv('png', [], [])
    
= Notes =
 
= Notes =
266

edits

Navigation menu