Re: Saving a pixmap which is larger than visible screen size



Hi,

If I understand you correctly, you are writing the updates to the screen
directly and require capturing the version currently being displayed?

If so, one way around your problem would be through a bit of re-design. 
Instead of doing any drawing directly to the screen, you should always
draw your updates to an internal pixmap and then render this pixmap to the
screen, i.e., do no real drawing directly to the display itself.

This way, the version of what is on display is always held within a
backing store pixmap and your problem doesn't exist, you always have
access to the complete pixmap, regardless the actual size vs. display
size.  Saving this to a file, then, does not involve in any way "reading"
the pixmap from the display medium itself.

richard


> Hi,
> First, I use Perl/Gtk2 but I thought I would ask here,
> since it seems to be a more informed and active list.
>
> I have been trying to figure this out for awhile, and I am
> wondering if it is even possible to do.
>
> Basically what I have, is a DrawingArea that is
> 2400 X 400.  Then I put a pixmap (of same size)
> onto it, for persistence. Then I place this into
> a ScrolledWindow.
> I then write lines to it ( 2 points at a time), like a 24-hour
> strip chart recorder. It all works fine, except where I would
> like to save the entire 2400x400 area.
>
> My 2 failed methods are below. The both run, but they only
> seem to correctly capture the visible portion of the ScrolledWindow,
> and make an incorrect 2400 X 400 jpg out of it. Like 4 identical
> images side-by-side..... not a full 2400 pixel width.
>
> So is there a way, to save a huge pixmap to file, when the pixmap
> is not entirely visible on the screen. ( I'm sort of looking for the
> equivalent of Tk's "bbox all" to capture an entire canvas).
>
>
> Using the normal method, (in Perl)
> #########################################################
> # create blank pixbuf to hold the image
> my $gdkpixbuf = Gtk2::Gdk::Pixbuf->new ('rgb',0, 8, 2400,  400);
>
> $gdkpixbuf->get_from_drawable ($area->window,
>                       undef, 0, 0, 0, 0, 2400, 400);
>
> #only jpeg and png is supported !!!! it's 'jpeg', not 'jpg'
> $gdkpixbuf->save ("$0.jpg", 'jpeg', quality => 100);
> ########################################################
>
> Trying with ImageMagick by using the X id of the DrawingArea
> ##########################################################
> my $xid = $area->window->get_xid;
> my $blob = `import -window $xid jpg:`;
>
> my $output = Image::Magick->new(magick=>'jpg');
> $output->BlobToImage( $blob );
> $output->Write( $0.'.jpg');
> ############################################################3
>
> Thanks for any pointers.
>
>
>
> --
> I'm not really a human, but I play one on earth.
> http://zentara.net/japh.html
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>





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