Re: Missing object method: new_from_file_at_size



Unfortunately new_from_file() doesn't work either :( It seems like *nothing* from Gtk::Gdk has bindings in Windows.

What *does* work is:

$self->{icons}->{CONNECTION} = Gtk3::Image->new_from_file( $icon_folder . "/connection.png" )->get_pixbuf;

I don't immediately see how to scale the image, but it's something I can work around ... possibly by pre-rendering the images at the desired size.

Dan

On Wed, Oct 22, 2014 at 5:19 AM, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
On 20.10.2014 13:56, Daniel Kasak wrote:
> *** unhandled exception in callback:
> ***   Can't locate object method "new_from_file_at_size" via package
> "Gtk3::Gdk::Pixbuf" at window/browser.pm <http://browser.pm> line 84.
> ***  ignoring at C:/strawberry/perl/site/lib/Gtk3.pm line 318.

Weird.  As you say, it works fine on Linux:

# perl -MGtk3=-init -E'say Gtk3::Gdk::Pixbuf->new_from_file_at_size
("/usr/share/icons/Humanity/actions/24/gtk-ok.svg", 24, 24)'
Gtk3::Gdk::Pixbuf=HASH(0x1feb6b0)

Do you still have the GdkPixbuf-2.0.gir from which GdkPixbuf-2.0.typelib
was generated?  It should contain an entry akin to this:

      <constructor name="new_from_file_at_size"
                   c:identifier="gdk_pixbuf_new_from_file_at_size"
                   version="2.4"
                   throws="1">
        <doc xml:space="preserve">...</doc>
        <return-value transfer-ownership="full">
          <doc xml:space="preserve">...</doc>
          <type name="Pixbuf" c:type="GdkPixbuf*"/>
        </return-value>
        <parameters>
          <parameter name="filename" transfer-ownership="none">
            <doc xml:space="preserve">Name of file to load, in the GLib
file name encoding</doc>
            <type name="utf8" c:type="const char*"/>
          </parameter>
          <parameter name="width" transfer-ownership="none">
            <doc xml:space="preserve">The width the image should have or
-1 to not constrain the width</doc>
            <type name="gint" c:type="int"/>
          </parameter>
          <parameter name="height" transfer-ownership="none">
            <doc xml:space="preserve">The height the image should have
or -1 to not constrain the height</doc>
            <type name="gint" c:type="int"/>
          </parameter>
        </parameters>
      </constructor>

To work around the missing binding, try to use new_from_file_at_scale()
or simply new_from_file() and scale_simple().
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]