public static RemoveRedeye ( Gdk src, Gdk area ) : Gdk.Pixbuf | ||
src | Gdk | |
area | Gdk | |
Résultat | Gdk.Pixbuf |
protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile) { Gdk.Rectangle area = new Gdk.Rectangle(State.Selection.x, State.Selection.y, State.Selection.width, State.Selection.height); int threshold = Preferences.Get <int> (Preferences.EDIT_REDEYE_THRESHOLD); return(PixbufUtils.RemoveRedeye(input, area, threshold)); }
protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile) { Rectangle selection = FSpot.Utils.PixbufUtils.TransformOrientation((int)State.PhotoImageView.PixbufOrientation <= 4 ? input.Width : input.Height, (int)State.PhotoImageView.PixbufOrientation <= 4 ? input.Height : input.Width, State.Selection, State.PhotoImageView.PixbufOrientation); int threshold = Preferences.Get <int> (Preferences.EDIT_REDEYE_THRESHOLD); return(PixbufUtils.RemoveRedeye(input, selection, threshold)); }
// FIXME this design sucks, I'm just doing it this way while // I redesign the editing system. private void ProcessImage(bool redeye) { int x, y, width, height; if (!photo_view.GetSelection(out x, out y, out width, out height)) { string msg = Catalog.GetString("No selection available"); string desc = Catalog.GetString("This tool requires an active selection. Please select a region of the photo and try the operation again"); HigMessageDialog md = new HigMessageDialog((Gtk.Window) this.Toplevel, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); return; } Photo photo = (Photo)Item.Current; try { Pixbuf original_pixbuf = photo_view.CompletePixbuf(); if (original_pixbuf == null) { return; } Pixbuf edited; if (redeye) { Gdk.Rectangle area = new Gdk.Rectangle(x, y, width, height); edited = PixbufUtils.RemoveRedeye(original_pixbuf, area, (int)Preferences.Get(Preferences.EDIT_REDEYE_THRESHOLD)); } else // Crop (I told you it was ugly) { edited = new Pixbuf(original_pixbuf.Colorspace, original_pixbuf.HasAlpha, original_pixbuf.BitsPerSample, width, height); original_pixbuf.CopyArea(x, y, width, height, edited, 0, 0); } bool create_version = photo.DefaultVersionId == Photo.OriginalVersionId; photo.SaveVersion(edited, create_version); ((PhotoQuery)query).Commit(Item.Index); // FIXME the fact that the selection doesn't go away is a bug in ImageView, it should // be fixed there. photo_view.Pixbuf = edited; original_pixbuf.Dispose(); photo_view.UnsetSelection(); photo_view.Fit = true; if (PhotoChanged != null) { PhotoChanged(this); } } catch (System.Exception e) { ShowError(e, photo); } }