@@ -5,17 +5,13 @@ use super::config::{ColorMode, Config, ConverterConfig, Hierarchical};
5
5
use super :: svg:: SvgFile ;
6
6
use fastrand:: Rng ;
7
7
use visioncortex:: color_clusters:: { KeyingAction , Runner , RunnerConfig , HIERARCHICAL_MAX } ;
8
- use visioncortex:: {
9
- approximate_circle_with_spline, Color , ColorImage , ColorName , CompoundPath , PathSimplifyMode ,
10
- } ;
8
+ use visioncortex:: { Color , ColorImage , ColorName } ;
11
9
12
10
const NUM_UNUSED_COLOR_ITERATIONS : usize = 6 ;
13
11
/// The fraction of pixels in the top/bottom rows of the image that need to be transparent before
14
12
/// the entire image will be keyed.
15
13
const KEYING_THRESHOLD : f32 = 0.2 ;
16
14
17
- const SMALL_CIRCLE : i32 = 12 ;
18
-
19
15
/// Convert an in-memory image into an in-memory SVG
20
16
pub fn convert ( img : ColorImage , config : Config ) -> Result < SvgFile , String > {
21
17
let config = config. into_converter_config ( ) ;
@@ -171,28 +167,15 @@ fn color_image_to_svg(mut img: ColorImage, config: ConverterConfig) -> Result<Sv
171
167
let mut svg = SvgFile :: new ( width, height, config. path_precision ) ;
172
168
for & cluster_index in view. clusters_output . iter ( ) . rev ( ) {
173
169
let cluster = view. get_cluster ( cluster_index) ;
174
- let paths = if matches ! ( config. mode, PathSimplifyMode :: Spline )
175
- && cluster. rect . width ( ) < SMALL_CIRCLE
176
- && cluster. rect . height ( ) < SMALL_CIRCLE
177
- && cluster. to_shape ( & view) . is_circle ( )
178
- {
179
- let mut paths = CompoundPath :: new ( ) ;
180
- paths. add_spline ( approximate_circle_with_spline (
181
- cluster. rect . left_top ( ) ,
182
- cluster. rect . width ( ) ,
183
- ) ) ;
184
- paths
185
- } else {
186
- cluster. to_compound_path (
187
- & view,
188
- false ,
189
- config. mode ,
190
- config. corner_threshold ,
191
- config. length_threshold ,
192
- config. max_iterations ,
193
- config. splice_threshold ,
194
- )
195
- } ;
170
+ let paths = cluster. to_compound_path (
171
+ & view,
172
+ false ,
173
+ config. mode ,
174
+ config. corner_threshold ,
175
+ config. length_threshold ,
176
+ config. max_iterations ,
177
+ config. splice_threshold ,
178
+ ) ;
196
179
svg. add_path ( paths, cluster. residue_color ( ) ) ;
197
180
}
198
181
0 commit comments