Commit 7e1ea2d
Use global settings for autotrace
Changed files (3)
modifiedbirdfont-autotrace/AutoTrace.valamodifiedlibbirdfont/BackgroundImage.valamodifiedlibbirdfont/DrawingTools.vala
Diff
@@ -116,9 +116,9 @@ class AutoTrace { font = BirdFont.new_font (); bg = new BackgroundImage (f); - bg.set_trace_resolution (details);- bg.set_threshold (cutoff);- bg.set_trace_simplification (simplification);+ DrawingTools.auto_trace_resolution.set_value_round (details);+ DrawingTools.background_threshold.set_value_round (details);+ DrawingTools.auto_trace_simplify.set_value_round (simplification); bg.set_high_contrast (true); g = new Glyph.no_lines ("");@@ -42,9 +42,6 @@ public class BackgroundImage { private string path; public bool high_contrast = false;- private double trace_resolution = 1.0;- private double threshold = 1.0;- private double simplification = 0.5; private Gee.ArrayList<TracedPoint> points = new Gee.ArrayList<TracedPoint> (); private Gee.ArrayList<TracedPoint> start_points = new Gee.ArrayList<TracedPoint> (); @@ -108,10 +105,7 @@ public class BackgroundImage { bg.img_scale_y = img_scale_y; bg.img_rotation = img_rotation; - bg.simplification = simplification;- bg.threshold = threshold; bg.high_contrast = high_contrast;- bg.trace_resolution = trace_resolution; foreach (BackgroundSelection b in selections) { bg.selections.add (b);@@ -124,18 +118,10 @@ public class BackgroundImage { selections.add (bs); } - public void set_trace_simplification (double s) {- simplification = s;- }- public void set_high_contrast (bool t) { high_contrast = t; } - public void set_trace_resolution (double t) {- trace_resolution = t;- }- public double get_margin_width () { return ((size_margin - get_img ().get_width ()) / 2.0); }@@ -684,10 +670,6 @@ public class BackgroundImage { updated (); } - public void set_threshold (double t) {- threshold = t;- }- ImageSurface get_contrast_image () { ImageSurface s; Context c;@@ -702,6 +684,10 @@ public class BackgroundImage { ImageSurface img; ImageSurface ns;++ double trace_resolution = DrawingTools.auto_trace_resolution.get_value ();+ double threshold = DrawingTools.background_threshold.get_value ();+ double simplification = DrawingTools.auto_trace_simplify.get_value (); thres = (threshold - 0.5) * 255; @@ -1174,6 +1160,7 @@ public class BackgroundImage { TracedPoint average_point; int pi; ImageSurface img;+ double simplification = DrawingTools.auto_trace_simplify.get_value (); img = (contrast_image == null) ? get_contrast_image () : (!) contrast_image; @@ -64,12 +64,12 @@ public class DrawingTools : ToolCollection { public static CutBackgroundTool cut_background; Tool show_bg; Tool bg_selection;- SpinButton background_threshold;+ public static SpinButton background_threshold; public static SpinButton background_scale; Tool high_contrast_background;- SpinButton auto_trace_resolution;+ public static SpinButton auto_trace_resolution; Tool auto_trace;- SpinButton auto_trace_simplify;+ public static SpinButton auto_trace_simplify; Tool delete_background; Tool rectangle;@@ -733,7 +733,6 @@ public class DrawingTools : ToolCollection { if (bg != null) { b = (!) bg;- b.set_threshold (background_threshold.get_value ()); b.update_background (); } });@@ -751,7 +750,6 @@ public class DrawingTools : ToolCollection { if (bg != null) { b = (!) bg;- b.set_trace_resolution (auto_trace_resolution.get_value ()); b.update_background (); } });@@ -763,14 +761,6 @@ public class DrawingTools : ToolCollection { auto_trace_simplify.show_icon (true); auto_trace_simplify.new_value_action.connect ((self) => {- Glyph g = MainWindow.get_current_glyph ();- BackgroundImage? bg = g.get_background_image ();- BackgroundImage b;- - if (bg != null) {- b = (!) bg;- b.set_trace_simplification (auto_trace_simplify.get_value ());- } }); draw_tool_modifiers.add_tool (auto_trace_simplify);