UnsharpMask() 공개 정적인 메소드

public static UnsharpMask ( Pixbuf src, double radius, double amount, double threshold, FSpot.UI.Dialog.ThreadProgressDialog progressDialog ) : Pixbuf
src Pixbuf
radius double
amount double
threshold double
progressDialog FSpot.UI.Dialog.ThreadProgressDialog
리턴 Pixbuf
예제 #1
0
        private void HandleOkClicked(object sender, EventArgs args)
        {
            Photo photo = view.Item.Current as Photo;

            if (photo == null)
            {
                return;
            }

            try {
                Gdk.Pixbuf orig  = view.Pixbuf;
                Gdk.Pixbuf final = PixbufUtils.UnsharpMask(orig,
                                                           radius_spin.Value,
                                                           amount_spin.Value,
                                                           threshold_spin.Value);

                bool create_version = photo.DefaultVersion.IsProtected;

                photo.SaveVersion(final, create_version);
            } catch (System.Exception e) {
                string msg  = Catalog.GetString("Error saving sharpened photo");
                string desc = String.Format(Catalog.GetString("Received exception \"{0}\". Unable to save photo {1}"),
                                            e.Message, photo.Name);

                HigMessageDialog md = new HigMessageDialog(this, DialogFlags.DestroyWithParent,
                                                           Gtk.MessageType.Error,
                                                           ButtonsType.Ok,
                                                           msg,
                                                           desc);
                md.Run();
                md.Destroy();
            }

            Destroy();
        }
예제 #2
0
        public bool Convert(FilterRequest req)
        {
            var dest_uri = req.TempUri(req.Current.GetExtension());

            using (var img = App.Instance.Container.Resolve <IImageFileFactory> ().Create(req.Current)) {
                using (Pixbuf in_pixbuf = img.Load()) {
                    using (Pixbuf out_pixbuf = PixbufUtils.UnsharpMask(in_pixbuf, radius, amount, threshold, null)) {
                        FSpot.Utils.PixbufUtils.CreateDerivedVersion(req.Current, dest_uri, 95, out_pixbuf);
                    }
                }
            }

            req.Current = dest_uri;
            return(true);
        }
예제 #3
0
        public void doSharpening()
        {
            progressDialog.Fraction = 0.0;
            // FIXME: This should probably be translated
            progressDialog.Message = "Photo is being sharpened";

            okClicked = true;
            Photo photo = view.Item.Current as Photo;

            if (photo == null)
            {
                return;
            }

            try {
                Gdk.Pixbuf orig  = view.Pixbuf;
                Gdk.Pixbuf final = PixbufUtils.UnsharpMask(orig,
                                                           radius_spin.Value,
                                                           amount_spin.Value,
                                                           threshold_spin.Value,
                                                           progressDialog);

                bool create_version = photo.DefaultVersion.IsProtected;

                photo.SaveVersion(final, create_version);
                photo.Changes.DataChanged = true;
                App.Instance.Database.Photos.Commit(photo);
            } catch (System.Exception e) {
                string msg  = Catalog.GetString("Error saving sharpened photo");
                string desc = String.Format(Catalog.GetString("Received exception \"{0}\". Unable to save photo {1}"),
                                            e.Message, photo.Name);

                HigMessageDialog md = new HigMessageDialog(this, DialogFlags.DestroyWithParent,
                                                           Gtk.MessageType.Error,
                                                           ButtonsType.Ok,
                                                           msg,
                                                           desc);
                md.Run();
                md.Destroy();
            }

            progressDialog.Fraction = 1.0;
            // FIXME: This should probably be translated
            progressDialog.Message     = "Sharpening complete!";
            progressDialog.ButtonLabel = Gtk.Stock.Ok;

            Destroy();
        }
예제 #4
0
        protected override void UpdateSample()
        {
            base.UpdateSample();

            if (overlay != null)
            {
                overlay.Dispose();
            }

            overlay = null;
            if (source != null)
            {
                overlay = PixbufUtils.UnsharpMask(source,
                                                  radius_spin.Value,
                                                  amount_spin.Value,
                                                  threshold_spin.Value);
            }
        }
예제 #5
0
        public bool Convert(FilterRequest req)
        {
            Uri dest_uri = req.TempUri(System.IO.Path.GetExtension(req.Current.LocalPath));

            using (ImageFile img = ImageFile.Create(req.Current)) {
                using (Pixbuf in_pixbuf = img.Load()) {
                    using (Pixbuf out_pixbuf = PixbufUtils.UnsharpMask(in_pixbuf, radius, amount, threshold)) {
                        string destination_extension = Path.GetExtension(dest_uri.LocalPath);

                        if (Path.GetExtension(req.Current.LocalPath).ToLower() == Path.GetExtension(dest_uri.LocalPath).ToLower())
                        {
                            using (Stream output = File.OpenWrite(dest_uri.LocalPath)) {
                                img.Save(out_pixbuf, output);
                            }
                        }
                        else if (destination_extension == ".jpg")
                        {
                            // FIXME this is a bit of a nasty hack to work around
                            // the lack of being able to change the path in this filter
                            // and the lack of proper metadata copying yuck
                            Exif.ExifData exif_data;

                            exif_data = new Exif.ExifData(req.Current.LocalPath);

                            PixbufUtils.SaveJpeg(out_pixbuf, dest_uri.LocalPath, 90, exif_data);
                        }
                        else
                        {
                            throw new NotImplementedException(String.Format(Catalog.GetString("No way to save files of type \"{0}\""), destination_extension));
                        }
                    }
                }
            }

            req.Current = dest_uri;
            return(true);
        }
예제 #6
0
        public void doSharpening()
        {
            progressDialog.Fraction = 0.0;
            progressDialog.Message  = Strings.PhotoIsBeingSharpened;

            okClicked = true;

            if (!(view.Item.Current is Photo photo))
            {
                return;
            }

            try {
                Gdk.Pixbuf orig  = view.Pixbuf;
                Gdk.Pixbuf final = PixbufUtils.UnsharpMask(orig, radius_spin.Value, amount_spin.Value, threshold_spin.Value, progressDialog);

                bool create_version = photo.DefaultVersion.IsProtected;

                photo.SaveVersion(final, create_version);
                photo.Changes.DataChanged = true;
                App.Instance.Database.Photos.Commit(photo);
            } catch (Exception e) {
                string msg  = Strings.ErrorSavingSharpenedPhoto;
                string desc = Strings.ReceivedExceptionXUnableToSavePhotoName(e.Message, photo.Name);

                var md = new HigMessageDialog(this, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc);
                md.Run();
                md.Destroy();
            }

            progressDialog.Fraction    = 1.0;
            progressDialog.Message     = Strings.SharpeningCompleteExclamation;
            progressDialog.ButtonLabel = Gtk.Stock.Ok;

            Destroy();
        }