gdk-sharp 2.12.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. GLib.Object

PixbufLoader is a 'passive' pixbuf loader. It's not actively read pix buf data, but 'listen' for incoming data instead. It's useful in a case where you want to read the image data in small chunks. Typical use of PixbufLoader is when you want to read a very large image data or reading image from a slow media (such as a slow network connection).

You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.

`using System; using System.IO; using Gtk; using Gdk; namespace GtkDemo { public class PixbufLoaderSample : Gtk.Window { static Gdk.PixbufLoader pixbufLoader; private uint timeout_id; private static Gtk.Image progressiveImage; private VBox vbox; BinaryReader imageStream; static void Main () { Application.Init (); new PixbufLoaderSample (); Application.Run (); } public PixbufLoaderSample () : base ("images") { this.DeleteEvent += new DeleteEventHandler (WindowDelete); this.BorderWidth = 8; vbox = new VBox (false, 8); vbox.BorderWidth = 8; this.Add (vbox); Label label = new Gtk.Label ("Progressive image loading"); label.UseMarkup = true; vbox.PackStart (label); Gtk.Frame frame = new Gtk.Frame (); frame.ShadowType = ShadowType.In; Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f); alignment.Add (frame); vbox.PackStart (alignment, false, false, 0); // Create an empty image for now; the progressive loader // will create the pixbuf and fill it in. progressiveImage = new Gtk.Image (); frame.Add (progressiveImage); StartProgressiveLoading (); this.ShowAll (); } private void WindowDelete (object o, DeleteEventArgs args) { this.Hide (); this.Destroy (); args.RetVal = true; } private void StartProgressiveLoading () { /* This is obviously totally contrived (we slow down loading * on purpose to show how incremental loading works). * The real purpose of incremental loading is the case where * you are reading data from a slow source such as the network. * The timeout simply simulates a slow data source by inserting * pauses in the reading process. */ timeout_id = GLib.Timeout.Add (150, new GLib.TimeoutHandler (ProgressiveTimeout)); } private bool ProgressiveTimeout () { if (imageStream == null) { // note you need to provide your own image // at that location to run this sample imageStream = new BinaryReader (new StreamReader ("images/alphatest.png").BaseStream); pixbufLoader = new Gdk.PixbufLoader (); pixbufLoader.AreaPrepared += new EventHandler (ProgressivePreparedCallback); pixbufLoader.AreaUpdated += new AreaUpdatedHandler (ProgressiveUpdatedCallback); } if (imageStream.PeekChar () != -1) { byte[] bytes = imageStream.ReadBytes (256); pixbufLoader.Write (bytes, (uint) bytes.Length); return true; // leave the timeout active } else { imageStream.Close (); return false; // removes the timeout } } static void ProgressivePreparedCallback (object obj, EventArgs args) { Gdk.Pixbuf pixbuf = pixbufLoader.Pixbuf; pixbuf.Fill (0xaaaaaaff); progressiveImage.FromPixbuf = pixbuf; } static void ProgressiveUpdatedCallback (object obj, AreaUpdatedArgs args) { progressiveImage.QueueDraw (); } } }`
- Constructor
  2.12.0.0
  Default constructor
- Constructor
  2.12.0.0
  System.Obsolete
  a
  Protected Constructor.
  Chain to this constructor if you have manually registered a native value for your subclass.
- Constructor
  2.12.0.0
  The containing the image.
  Loads a Pixbuf in a buffer.
  See also
- Constructor
  2.12.0.0
  Pointer to the C object.
  Internal constructor

  This is an internal constructor, and should not be used by user code.

- Constructor
  2.12.0.0
  a containing the image.
  Loads a Pixbuf from a .
  See also
- Constructor
  2.12.0.0
  a
  To be added
  To be added
- Constructor
  2.12.0.0
  The that contains the image.

  If the value is , the image will be looked up on the calling assembly.

  The name given as the resource in the assembly.
  Loads a Pixbuf embedded in an assembly.
  See also
- Constructor
  2.12.0.0
  The containing the image.
  The required width of the pixbuf.
  The required height of the pixbuf.
  Loads a Pixbuf in a buffer with a specific size.
  See also
- Constructor
  2.12.0.0
  a containing the image.
  a specifying the required width.
  a specifying the required height.
  Loads a Pixbuf from a , creating it with a specific size.
  See also
- Constructor
  2.12.0.0
  a
  a
  a
  To be added
  To be added
- Constructor
  2.12.0.0
  The that contains the image.

  If the value is , the image will be looked up on the calling assembly.

  The name given as the resource in the assembly.
  The required width of the pixbuf.
  The required height of the pixbuf.
  Loads a Pixbuf embedded in an assembly with a specific size.
  See also
- Property
  2.12.0.0
  Gdk.PixbufAnimation To be added an object of type To be added
- Event
  2.12.0.0
  GLib.Signal("area_prepared")
  System.EventHandler Emitted when the area of the PixbufLoader is prepared.
- Event
  2.12.0.0
  GLib.Signal("area_updated")
  Gdk.AreaUpdatedHandler Emitted when the area of the PixbufLoader is updated with data.
- Method
  2.12.0.0
  System.Boolean Closes the loader. returns true on successful close and false on error. During the close, PixbufLoader will parse any data that has not been parsed. If the data is incomplete or corrupted, this method will return false.
- Event
  2.12.0.0
  GLib.Signal("closed")
  System.EventHandler Emitted when the PixbufLoader is closed.
- Property
  2.12.0.0
  Gdk.PixbufFormat To be added a To be added
- Property
  2.12.0.0
  GLib.GType GType Property. a Returns the native value for .
- Method
  2.12.0.0
  Gdk.PixbufLoader `` the name of the resource Loads a pixbuf from a resource file. a This creates a pixbuf loader to load from a resource in the calling assembly. This is equivalent to using the constructor with a assembly.
- Method
  2.12.0.0
  Gdk.PixbufLoader `` a To be added a To be added
- Method
  2.12.0.0
  GLib.DefaultSignalHandler(ConnectionMethod="OverrideAreaPrepared", Type=typeof(Gdk.PixbufLoader))
  System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event.
- Method
  2.12.0.0
  GLib.DefaultSignalHandler(ConnectionMethod="OverrideAreaUpdated", Type=typeof(Gdk.PixbufLoader))
  System.Void `` `` `` `` a a a a Default handler for the event. Override this method in a subclass to provide a default handler for the event.
- Method
  2.12.0.0
  GLib.DefaultSignalHandler(ConnectionMethod="OverrideClosed", Type=typeof(Gdk.PixbufLoader))
  System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event.
- Method
  2.12.0.0
  GLib.DefaultSignalHandler(ConnectionMethod="OverrideSizePrepared", Type=typeof(Gdk.PixbufLoader))
  System.Void `` `` a a Default handler for the event. Override this method in a subclass to provide a default handler for the event.
- Property
  2.12.0.0
  Gdk.Pixbuf The Pixbuf that is being loaded. an object of type
- Method
  2.12.0.0
  System.Void `` `` a a Set the size of the image that will be loaded.
- Event
  2.12.0.0
  GLib.Signal("size_prepared")
  Gdk.SizePreparedHandler Emitted when the PixbufLoader has prepared its size.
- Method
  2.12.0.0
  System.Boolean `` a Parses the bytes into the image data. a This is an overload to , which determines the length automatically.
- Method
  2.12.0.0
  System.Obsolete("Replaced by Write (byte[], ulong) for 64 bit portability")
  System.Boolean `` `` a a Writes a Pixbuf to a buffer. a This overload is obsolete and has been replaced by a ulong version for 64 bit compatibility.
- Method
  2.12.0.0
  System.Boolean `` `` array of bytes buffer to parse. number of bytes to parse. Parses the next count bytes of image data from buffer buf. returns true if data was parsed and loaded succesfully.

  If the return value is false, the PixbufLoader will be closed.