Matthew Braid wrote:
> Hi all,
>
> I'm using xpm's for the images for a bunch of action
buttons. This
> works quite nicely.
>
> These action buttons also have corresponding entries in
a menu (in
> case the action buttons have been hidden) and I'd like
to put the same
> images in next to their corresponding menu entry.
Unfortunately, other
> than actually making an XPM file that defines a smaller
image, I can't
> figure out how to 'resize' the images.
>
> The images are created like so:
>
> $img = Gtk2::Image->new;
>
$img->set_from_file("/path/to/image.xpm");
>
> Is there anything I can do from there to make a resized
version, or do
> I have to follow a different path there?
Firstly, I don't do a lot of work with images, so this
mightn't be the
best way to do it
Gtk2::Gdk::Pixbuf has image scaling support, eg:
$pixbuf = $pixbuf->scale_simple(
$width,
$height,
'nearest'
);
I don't know if you can make a Gtk2::Gdk::Pixbuf directly
from an xpm -
never tried, probably works, but I'm sure there's a way.
Once you've got
your scaled image, you can go:
$img = Gtk2::Image->new_from_pixbuf ( $pixbuf );
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting.com.au
website: http://www.nusconsult
ing.com.au
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
|