Get the current alpha max
static VALUE params_get_alphamax (VALUE klass) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); return rb_float_new(params->alphamax); }
Set the alpha max
max
- threshold for the detection of corners. It controls the
smoothness of the traced curve, as shown in Figure 9. The current default
is 1.0. The useful range of this parameter is from 0.0 (polygon) to 1.3334
(no corners).
static VALUE params_set_alphamax (VALUE klass, VALUE max) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); params->alphamax = NUM2DBL(max); return max; }
Turn on curve optimization
static VALUE params_set_opticurve_true (VALUE klass) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); params->opticurve = 1; return Qtrue; }
Are curves optimized
static VALUE params_get_opticurve (VALUE klass) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); return (params->opticurve == 1) ? Qtrue : Qfalse; }
Get current curve optimization tolerance
static VALUE params_get_opttolerance (VALUE klass) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); return rb_float_new(params->opttolerance); }
Set current curve optimization tolerance
amount
- defines the amount of error allowed in curve
simplification. This value only applies if optimization is true. The
current default is 0.2. Larger values tend to decrease the number of
segments, at the expense of less accuracy. The useful range is from 0 to
infinity, although in practice one would hardly choose values greater than
1 or so. For most purposes, the default value is a good tradeoff between
space and accuracy.
static VALUE params_set_opttolerance (VALUE klass, VALUE tolerance) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); params->opttolerance = NUM2DBL(tolerance); return tolerance; }
Get the current turd size
static VALUE params_get_turdsize (VALUE klass) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); return rb_int_new(params->turdsize); }
Set the turd size
threshold
- used to “despeckle” the bitmap to be traced, by
removing all curves whose enclosed area is below the given threshold.
Default is 2.
static VALUE params_set_turdsize (VALUE klass, VALUE size) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); params->turdsize = NUM2INT(size); return size; }
Get the current Turnpolicy
static VALUE params_get_turnpolicy (VALUE klass) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); return rb_int_new(params->turnpolicy); }
Set the current Turnpolicy
static VALUE params_set_turnpolicy (VALUE klass, VALUE policy) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); params->turnpolicy = NUM2INT(policy); return policy; }
Turn off curve optimization
static VALUE params_set_opticurve_false (VALUE klass) { potrace_param_t *params; Data_Get_Struct(klass, potrace_param_t, params); params->opticurve = 0; return Qfalse; }