Skip to main content

Crate smix_annotate

Crate smix_annotate 

Source
Expand description

smix-annotate — screenshot annotation.

Compose circle / arrow / text / box / line primitives onto a PNG, then emit compressed output. RFC: docs/ai-guide/rfc-v0.3.0- annotated-screenshots.md.

§Quick tour

use smix_annotate::{Annotator, Annotation, Color, Position, Compression};

let png = std::fs::read("input.png")?;
let out = Annotator::new(&png)?
    .add(Annotation::circle(Position::pixel(100, 100))
        .color(Color::RED)
        .radius(40))
    .compression(Compression::BALANCED)
    .render()?;
std::fs::write("output.png", out)?;

§v0.3.0 scope

  • 5 primitives: circle, arrow, text, box, line
  • Position resolvers: absolute pixel + normalized (0..1) (selector-relative via a11y tree — wire lives in smix-adapter-maestro runtime, not in this crate; caller resolves selector → pixel before adding annotation)
  • Named + hex + rgba color palette
  • Compression 3 presets: fast, balanced, aggressive
  • Text rendering via ab_glyph; font supplied by caller (v0.3.5 will bundle Inter + Noto Sans SC)

Re-exports§

pub use color::Color;

Modules§

color
Color parsing + palette.

Structs§

Annotator
Annotator builder.
ArrowBuilder
BoxBuilder
CircleBuilder
LineBuilder
TextBuilder

Enums§

AnnotateError
Annotation
One drawing primitive.
Compression
PNG output compression preset.
Position
Position of an annotation on the image.