App-Guiio

 view release on metacpan or  search on metacpan

setup/import_export/png.pl  view on Meta::CPAN


register_import_export_handlers 
	(
	png => 
		{
		IMPORT => undef ,
		EXPORT => \&export_png,
		},
	) ;

sub export_png
{
my ($self, $elements_to_save, $file)  = @_ ;

if($self->{CREATE_BACKUP} && -e $file)
	{
	use File::Copy;
	copy($file,"$file.bak") or die "export_pod: Copy failed while making backup copy: $!";		
	}

my $alloc = $self->{widget}->allocation;
my $pixbuf = Gtk2::Gdk::Pixbuf->get_from_drawable
			(
			$self->{PIXMAP},
			$self->{widget}->window->get_colormap,
			0, 0,
			0, 0,
			$alloc->width, $alloc->height
			);
			
$pixbuf->save($file, "png" );

return ;
}



( run in 0.746 second using v1.01-cache-2.11-cpan-98e64b0badf )