public override ThumbnailCollection GetThumbnailRepresentations(int width, int height) { ThumbnailCollection collection = new ThumbnailCollection (); int [] seconds = {0, 5, 10, 15, 20, 60}; foreach (int second in seconds) { ThumbnailCollection.ItemTask task; ThumbVideo thumb; thumb = new ThumbVideo (); thumb.filename = filename; thumb.second = second; task = new ThumbnailCollection.ItemTask (thumb); task.ThumbnailIndex = second; task.DoEventHandler += delegate (object obj, EventArgs args) { ThumbnailCollection.ItemTask item = (ThumbnailCollection.ItemTask) obj; ThumbVideo thumbv = (ThumbVideo) item.Data; Gdk.Pixbuf im = Backends.GStreamer.Thumbnail.VideoScreenshot (thumbv.filename, thumbv.second); if (im == null) return; int max = Math.Max (im.Width, im.Height); Gdk.Pixbuf scaled = im.ScaleSimple (width * im.Width / max, height * im.Height / max, InterpType.Nearest); item.Pixbuf = scaled; im.Dispose (); }; collection.AddItem (task); } return collection; }
public override ThumbnailCollection GetThumbnailRepresentations(int width, int height) { ThumbnailCollection collection = new ThumbnailCollection (); int idx = 0; foreach (SlideImage image in images) { ThumbnailCollection.ItemTask task = new ThumbnailCollection.ItemTask (image); task.ThumbnailIndex = idx++; task.DoEventHandler += delegate (object obj, EventArgs args) { ThumbnailCollection.ItemTask item = (ThumbnailCollection.ItemTask) obj; SlideImage img = (SlideImage) item.Data; Gdk.Pixbuf im = Backends.ThumbnailCache.Factory.Provider.GetThumbnail (img.image, width, height); if (im == null) im = new Gdk.Pixbuf (img.image); int max = Math.Max (im.Width, im.Height); Gdk.Pixbuf scaled = im.ScaleSimple (width * im.Width / max, height * im.Height / max, InterpType.Nearest); item.Pixbuf = scaled; im.Dispose (); }; collection.AddItem (task); } return collection; }