Re: JPG Image in print context



Printing a RGB(A) image is as simple as this:

$context->beginpage('1');
my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file('pr0n.jpg');
# move to the desidered place on the paper, barring paper margins, scale
# and translate, whistle twice and give a kiss to whoever is nearest to
# you.
if ($pixbuf->get_has_alpha) {
$context->rgbaimage($pixbuf->get_pixels,
    $pixbuf->get_width,
    $pixbuf->get_height,
    $pixbuf->get_rowstride);
}
else                    {
$context->rgbimage($pixbuf->get_pixels,
   $pixbuf->get_width,
   $pixbuf->get_height,
   $pixbuf->get_rowstride);
}
$context->showpage;

I tested. This doesn't work at all



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