mirror of
https://github.com/visioncortex/vtracer.git
synced 2026-09-28 06:51:21 -07:00
Expose simplify in the Python and Node bindings
Config(simplify=...) / property in Python; simplify option in Node, with the tolerance documented in .pyi, index.d.ts, and both READMEs. The Node README's option list also catches up with the clustering rename and the binary/watershed options, and test.js drops the stale colorMode key (silently ignored since the rename, so its bw assertion was testing the default path) and asserts simplify shrinks output.
This commit is contained in:
@@ -140,6 +140,7 @@ impl PyConfig {
|
||||
length_threshold = 4.0,
|
||||
max_iterations = 10,
|
||||
splice_threshold = 45,
|
||||
simplify = None,
|
||||
path_precision = 2,
|
||||
palette = None,
|
||||
max_colors = None,
|
||||
@@ -162,6 +163,7 @@ impl PyConfig {
|
||||
length_threshold: f64,
|
||||
max_iterations: usize,
|
||||
splice_threshold: i32,
|
||||
simplify: Option<f64>,
|
||||
path_precision: u32,
|
||||
palette: Option<Vec<String>>,
|
||||
max_colors: Option<usize>,
|
||||
@@ -188,8 +190,7 @@ impl PyConfig {
|
||||
length_threshold,
|
||||
max_iterations,
|
||||
splice_threshold,
|
||||
// Curve simplification is not surfaced in the Python API yet.
|
||||
simplify: None,
|
||||
simplify,
|
||||
path_precision: Some(path_precision),
|
||||
palette,
|
||||
max_colors,
|
||||
@@ -331,6 +332,15 @@ impl PyConfig {
|
||||
self.inner.splice_threshold = v;
|
||||
}
|
||||
|
||||
#[getter]
|
||||
fn simplify(&self) -> Option<f64> {
|
||||
self.inner.simplify
|
||||
}
|
||||
#[setter]
|
||||
fn set_simplify(&mut self, v: Option<f64>) {
|
||||
self.inner.simplify = v;
|
||||
}
|
||||
|
||||
#[getter]
|
||||
fn path_precision(&self) -> Option<u32> {
|
||||
self.inner.path_precision
|
||||
|
||||
Reference in New Issue
Block a user