Re: Rgba to pixbuf



Mario Kemper <mario kemper googlemail com> writes:

Image/Base/Gtk2/Gdk/Pixbuf.pm

Hehe.  Not a thing of beauty, but it works :).

The 'copy_area' part is very slow,

Yep.

because it creates a new pixbuf for
every single pixel and puts it on the final pixbuf. 

An app is allowed to mangle the bytes of the pixbuf data area.  Maybe
some sort of $pixbuf->set_pixels_substr() at the perl level could change
bytes in the future.

Is there any way to 'pack' all rgba values at once and use this packed
scalar to create the final pixbuf?

Yes, just concatenate the $data strings.  The pixels of the first row,
then the pixels of the second row, etc.  The "rowstride" thing is
4*$width, being how many bytes there are in each row.


-- 
I played a country and western song backwards to check for evil
messages.  It sounded just the same except it was about a fella whose
wife stood by him while he brought in a successful harvest and his dog
recovered from a long illness.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]