Re: JPG Image in print context
- From: Emmanuele Bassi <ebassi gmail com>
- To: ADIS - CPD <jorge adis com br>
- Cc: gtk-perl-list gnome org
- Subject: Re: JPG Image in print context
- Date: Thu, 28 Apr 2005 17:30:11 +0200
On Thu, 2005-04-28 at 11:52 -0300, ADIS - CPD wrote:
To which you must pass the pixel buffer (255 value marking and one-byte
per pixel, three-byte per pixel and four-byte per pixel, respectively).
So, you must convert a JPEG image to the appropriate buffer (using
pack).
Whats the format of pack to covert it?
Okay, I'm officially drunk (without even touching a beer in 24...
erhm... 12 hours! That ought to be a record!)
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;
It could be interesting to write an example.
Ciao,
Emmanuele.
--
Emmanuele Bassi <ebassi gmail com>
Web site: http://log.emmanuelebassi.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]