diff options
Diffstat (limited to 'perl-install/mygtk2.pm')
-rw-r--r-- | perl-install/mygtk2.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index 6d1ca13f4..113cc2ff6 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -312,6 +312,8 @@ sub _gtk__Pixbuf { # Image_using_pixmap is rendered using DITHER_MAX which is much better on 16bpp displays sub _gtk__Image_using_pixmap { &_gtk__Image } +# Image_using_pixbuf is rendered using DITHER_MAX & transparency which is much better on 16bpp displays +sub _gtk__Image_using_pixbuf { &_gtk__Image } sub _gtk__Image { my ($w, $opts, $class) = @_; @@ -323,6 +325,20 @@ sub _gtk__Image { my ($w, $file) = @_; my $pixmap = mygtk2::pixmap_from_pixbuf($w, gtknew('Pixbuf', file => $file)); $w->set_from_pixmap($pixmap, undef); + } : $class =~ /using_pixbuf/ ? sub { + my ($w, $file) = @_; + my $pixbuf = _pixbuf_render_alpha(gtknew('Pixbuf', file => $file), 255); + my ($width, $height) = ($pixbuf->get_width, $pixbuf->get_height); + $w->set_size_request($width, $height); + $w->signal_connect(expose_event => sub { + if (!$w->{x}) { + my $alloc = $w->allocation; + $w->{x} = $alloc->x; + $w->{y} = $alloc->y; + } + $pixbuf->render_to_drawable($w->window, $w->style->fg_gc('normal'), + 0, 0, $w->{x}, $w->{y}, $width, $height, 'max', 0, 0); + }); } : sub { my ($w, $file, $o_size) = @_; my $pixbuf = gtknew('Pixbuf', file => $file, if_($o_size, size => $o_size), flip => delete $opts->{flip}); |