コード例 #1
0
ファイル: Histogram.cs プロジェクト: neuroradiology/f-spot
 public Gdk.Pixbuf Generate(Gdk.Pixbuf input, int max_width)
 {
     Gdk.Pixbuf scaled;
     using (Gdk.Pixbuf pixbuf = Generate(input))
         scaled = PixbufUtils.ScaleToMaxSize(pixbuf, max_width, 128);
     return(scaled);
 }
コード例 #2
0
 public override Gdk.Pixbuf Load(int width, int height)
 {
     Gdk.Pixbuf full   = this.Load();
     Gdk.Pixbuf scaled = PixbufUtils.ScaleToMaxSize(full, width, height);
     full.Dispose();
     return(scaled);
 }
コード例 #3
0
ファイル: IImageFile.cs プロジェクト: neuroradiology/f-spot
 public Gdk.Pixbuf Load(int max_width, int max_height)
 {
     Gdk.Pixbuf full   = this.Load();
     Gdk.Pixbuf scaled = PixbufUtils.ScaleToMaxSize(full, max_width, max_height);
     full.Dispose();
     return(scaled);
 }
コード例 #4
0
 public override Gdk.Pixbuf Load(int width, int height)
 {
     Gdk.Pixbuf full    = this.Load();
     Gdk.Pixbuf rotated = PixbufUtils.TransformOrientation(full, this.GetOrientation(), true);
     Gdk.Pixbuf scaled  = PixbufUtils.ScaleToMaxSize(rotated, width, height);
     full.Dispose();
     return(scaled);
 }
コード例 #5
0
ファイル: SvgFile.cs プロジェクト: ArsenShnurkov/beagle-1
 public override Gdk.Pixbuf Load(int max_width, int max_height)
 {
     // FIXME this is a hack to work around a crash in the scaled
     // gdk pixbuf rsvg loader.  We load it without scaling it then scale the image
     using (System.IO.Stream stream = Open()) {
         using (Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(stream)) {
             Gdk.Pixbuf scaled = PixbufUtils.ScaleToMaxSize(pixbuf, max_width, max_height);
             return(scaled);
         }
     }
 }
コード例 #6
0
ファイル: ImageFile.cs プロジェクト: ArsenShnurkov/beagle-1
        public virtual Gdk.Pixbuf Load(int max_width, int max_height)
        {
            System.IO.Stream stream = PixbufStream();
            if (stream == null)
            {
                Gdk.Pixbuf orig   = this.Load();
                Gdk.Pixbuf scaled = PixbufUtils.ScaleToMaxSize(orig, max_width, max_height);
                orig.Dispose();
                return(scaled);
            }

            using (stream) {
                PixbufUtils.AspectLoader aspect = new PixbufUtils.AspectLoader(max_width, max_height);
                return(aspect.Load(stream, Orientation));
            }
        }
コード例 #7
0
        private void GetPreviews()
        {
            lock (camera) {
                ProgressDialog pdialog = new ProgressDialog(Catalog.GetString("Downloading Previews"),
                                                            ProgressDialog.CancelButtonType.Cancel,
                                                            camera.FileList.Count,
                                                            this.Dialog);

                int  index      = 0;
                bool load_thumb = true;
                System.Collections.ArrayList sfiles = camera.FileList;
                sfiles.Sort();
                foreach (GPhotoCameraFile file in sfiles)
                {
                    string msg = String.Format(Catalog.GetString("Downloading Preview of {0}"),
                                               file.FileName);



                    if (load_thumb && pdialog.Update(msg))
                    {
                        load_thumb = false;
                        pdialog.Hide();
                    }

                    Pixbuf scale = null;
                    if (load_thumb)
                    {
                        Pixbuf thumbscale = camera.GetPreviewPixbuf(file);
                        if (thumbscale != null)
                        {
                            scale = PixbufUtils.ScaleToMaxSize(thumbscale, 64, 64);
                            thumbscale.Dispose();
                        }
                    }

                    preview_list_store.AppendValues(file.Directory, file.FileName, scale, index);
                    index++;
                }

                file_tree.Selection.SelectAll();
                pdialog.Destroy();
            }
        }
コード例 #8
0
        private void HandleThumbnailIconViewButtonPressEvent(object sender, Gtk.ButtonPressEventArgs args)
        {
            int old_item = current_item;

            current_item = thumbnail_iconview.CellAtPosition((int)args.Event.X, (int)args.Event.Y, false);

            if (current_item < 0 || current_item >= items.Length)
            {
                current_item = old_item;
                return;
            }

            captions [old_item] = caption_textview.Buffer.Text;

            string caption = captions [current_item];

            if (caption == null)
            {
                captions [current_item] = caption = "";
            }
            caption_textview.Buffer.Text = caption;

            tag_treeview.Model = new TagStore(account.Facebook, tags [current_item], friends);

            IBrowsableItem item           = items [current_item];
            string         thumbnail_path = ThumbnailGenerator.ThumbnailPath(item.DefaultVersionUri);

            if (tag_image_eventbox.Children.Length > 0)
            {
                tag_image_eventbox.Remove(tag_image);
                tag_image.Destroy();
            }

            using (ImageFile image = new ImageFile(thumbnail_path)) {
                Gdk.Pixbuf data = image.Load();
                data             = PixbufUtils.ScaleToMaxSize(data, 400, 400);
                tag_image_height = data.Height;
                tag_image_width  = data.Width;
                tag_image        = new Gtk.Image(data);
                tag_image_eventbox.Add(tag_image);
                tag_image_eventbox.ShowAll();
            }
        }
コード例 #9
0
        void HandleDragBegin(object sender, DragBeginArgs args)
        {
            Tag [] tags  = TagHighlight;
            int    len   = tags.Length;
            int    size  = 32;
            int    csize = size / 2 + len * size / 2 + 2;

            Pixbuf container = new Pixbuf(Gdk.Colorspace.Rgb, true, 8, csize, csize);

            container.Fill(0x00000000);

            bool use_icon = false;;

            while (len-- > 0)
            {
                Pixbuf thumbnail = tags[len].Icon;

                if (thumbnail != null)
                {
                    Pixbuf small = PixbufUtils.ScaleToMaxSize(thumbnail, size, size);

                    int x = len * (size / 2) + (size - small.Width) / 2;
                    int y = len * (size / 2) + (size - small.Height) / 2;

                    small.Composite(container, x, y, small.Width, small.Height, x, y, 1.0, 1.0, Gdk.InterpType.Nearest, 0xff);
                    small.Dispose();

                    use_icon = true;
                }
            }

            if (use_icon)
            {
                Gtk.Drag.SetIconPixbuf(args.Context, container, 0, 0);
            }

            container.Dispose();
        }
コード例 #10
0
 public override Gdk.Pixbuf Load(int width, int height)
 {
     return(PixbufUtils.ScaleToMaxSize(this.Load(), width, height));
 }
コード例 #11
0
ファイル: IImageFile.cs プロジェクト: cizma/f-spot
 public Gdk.Pixbuf Load(int maxWidth, int maxHeight)
 {
     using (Gdk.Pixbuf full = Load()) {
         return(PixbufUtils.ScaleToMaxSize(full, maxWidth, maxHeight));
     }
 }