Files
vectorcraft/crates/trace/src/logo/mod.rs
T
bflatastic 761cc2371a Image Trace: Ignore Color, and the Auto Color and Outline presets
Against the documented panel (https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/image-trace-panel-options.html):

- Ignore Color: "Ignores a specific color while tracing. Use the color picker to selectively ignore a color."
  The panel's Ignore White is now Ignore Color with a colour button beside it (white until another colour is
  picked); `imageTrace.make` takes `ignoreColor: "#rrggbb"` beside `ignoreWhite`, and leaves out the palette
  colours within about 30 levels of it. Documents saved before have no such setting and ignore white as they
  did. Flat Logo mode leaves out white only.
- Auto Color ("Creates a posterized image from a photo or artwork"): Color mode with the Automatic palette.
- Outline ("Simplifies the image to black outlines"): Black and White with Create: Strokes and no fills.
- The Outline preset's name is translated as a preset's name, not as the Outline view's.

Measured (docs/image-trace-quality.md): Auto Color on flat art is 0.140 px off on average with 4.0 paths (16
Colors: 0.141, 4.2). Outline on the line inputs, the first measure of Create: Strokes: 0.310 px off on average,
1.84 at worst, 81 anchors for 5 lines (Line Art's filled outlines: 0.055, 0.96, 46).
2026-10-13 08:04:32 +07:00

32 lines
1.4 KiB
Rust

//! Logo mode: flat-colour logos traced to clean, sub-pixel-accurate vector shapes.
//!
//! The tracer in the other modes follows hard pixel edges, so an outline can only be as good as
//! the pixel grid. Here each pixel is read as a *blend* of the logo's flat colours, the blend is
//! interpolated smoothly, and every outline is placed where two colours are equally present, to a
//! fraction of a pixel. The outlines are then cleaned the way a person would: corners the blur
//! rounded are put back, straight runs and circular arcs become exact lines and arcs, and the
//! rest is fitted with as few Bézier curves as the tolerance allows. Areas of transparency
//! fully enclosed by artwork (letters knocked out of a badge, the counters of an "o") are painted
//! white, so the logo reads the same on any background; with Ignore White they stay real holes.
//! Flat-colour logos only: gradients and photos are refused ([`TraceError::NotFlat`](crate::TraceError)).
mod bezier;
mod field;
mod geom;
mod march;
mod outline;
mod palette;
mod pipeline;
mod restore;
#[cfg(test)]
mod tests;
#[cfg(test)]
mod testutil;
mod unmix;
pub(crate) use geom::{Cubic, all_within, resample_closed, resample_open, sample_cubics};
pub(crate) use outline::{Stats, Style, fit_open, fit_outline};
pub(crate) use palette::parse_hex;
pub(crate) use pipeline::trace_logo;
pub(crate) use restore::RestoreParams;