summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-09-24 22:18:54 +0000
committerThierry Vignaud <tv@mandriva.org>2008-09-24 22:18:54 +0000
commit3295bf216e37dd2c95d8056ce4a50082406cfb82 (patch)
treee1fef4b0a70207797dc1c7fd3c1bc72d1ad52855 /perl-install
parent40a08b5681335665375233421ce1344c8155d10b (diff)
downloaddrakx-3295bf216e37dd2c95d8056ce4a50082406cfb82.tar
drakx-3295bf216e37dd2c95d8056ce4a50082406cfb82.tar.gz
drakx-3295bf216e37dd2c95d8056ce4a50082406cfb82.tar.bz2
drakx-3295bf216e37dd2c95d8056ce4a50082406cfb82.tar.xz
drakx-3295bf216e37dd2c95d8056ce4a50082406cfb82.zip
(_gtk__Image_using_pixbuf) introduce new 'Image_using_pixbuf' widget:
like 'Image_using_pixmap', it renders using DITHER_MAX which is much better on 16bpp displays but it also handle transparancy
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/mygtk2.pm16
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});