Re: Gtk-Perl and Pixmaps
- From: Owen Taylor <otaylor redhat com>
- To: gtk-list redhat com
- Subject: Re: Gtk-Perl and Pixmaps
- Date: 03 Oct 1999 22:20:18 -0400
Dermot Musgrove <dermot@glade.perl.connectfree.co.uk> writes:
> Dr Noonian Soong wrote:
> >
> > I've implemented that as follows and still get the same error (with a
> > different line number, of course):
> >
> > #!/usr/bin/perl
> >
> > use Gtk;
> > init Gtk;
> >
> > $win = new Gtk::Window -toplevel;
> > $cmap = $win->get_colormap;
> > ($pixmap, $mask) = Gtk::Gdk::Pixmap->colormap_create_from_xpm($win, $cmap,
> > $win->style->bg('normal'), 'pixmaps/test.xpm');
> >
> > show $win;
> > main Gtk;
> You still haven't called $win->realize; before you get_colormap.
If you use the colormap variant, you don't need to call realize() -
the colormap for a widget exists from the point it is created.
[ At least for C, and I don't see how Gtk-Perl could be different. ]
One problem is that the first parameter to
gdk_pixmap_create_from_colormap() is a GdkPixmap, not a GtkWidget;
to get the equivalent of the correct C, your probably want:
$win = new Gtk::Window 'toplevel';
$cmap = $win->get_colormap;
($pixmap, $mask) =
Gtk::Gdk::Pixmap->colormap_create_from_xpm(undef, $cmap, undef,
'pixmaps/test.xpm');
1) When providing the colormap, a window isn't needed.
2) There is no reason to provide the transparent-color argument if
you are using a mask. (GDK defaults to white or something, and
you'll never draw those pixels anyways.)
I don't know if Gtk-Perl handles 'undef' properly for those
arguments now. (It didn't at some point in the past, IIRC,
but it definitely needs to.)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]