Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This seems to be a problem in the gtk-sharp&lt;->gdk-pixbuf interoperation.</p> <p>Apparently on every OS except windows, <code>gdk_pixbuf_new_from_file</code> takes file name encoded in utf8. On windows, however, this function is renamed to <code>gdk_pixbuf_new_from_file_utf8</code> and replaced by a wrapper that does locale conversion and proceeds to call the utf8 version. gtk-sharp doesn't know this and uses <code>gdk_pixbuf_new_from_file</code> passing utf8 argument, hence the unexpected extra locale conversion on windows breaks the filename.</p> <p>As a workaround I have suggested to use the <code>Pixbuf</code> constructor that takes a <code>Stream</code> instead of a filename, but the poster has reported that doesn't load his image properly.</p> <p><strong>Update:</strong> Luckily the Pixbuf wrapper class has a constructor that accepts the raw IntPtr of an existing pixbuf object. As such, the code in the buggy constructor can be duplicated, fixed and hidden in some helper methods, such as:</p> <pre><code>[DllImport("libgdk_pixbuf-2.0-0.dll")] static extern IntPtr gdk_pixbuf_new_from_file_utf8(IntPtr filename, out IntPtr error); static Pixbuf CreatePixbufWin32(string filename) { IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename); IntPtr error = IntPtr.Zero; IntPtr raw = gdk_pixbuf_new_from_file_utf8(native_filename, out error); GLib.Marshaller.Free(native_filename); if (error != IntPtr.Zero) throw new GLib.GException(error); return new Pixbuf(raw); } static Pixbuf CreatePixbuf(string filename) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { return CreatePixbufWin32(filename); } return new Pixbuf(filename); } </code></pre> <p>I have tested this with success. Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload