pub fn single_l8_to_paths(
    buffer: &mut ImageBuffer<Luma<u8>, Vec<u8>>,
    luma: Luma<u8>,
    closepaths: bool
) -> String
This is supported on crate feature image only.
Expand description

A function that takes an image buffer, an 8-bit luminance value and an option as input and return a string of SVG Path commands as output.

Examples

use image::{GrayImage, Luma};
use contour_tracing::single_l8_to_paths;
  • A simple example with the closepaths option set to true:
let mut image_buffer = GrayImage::new(3, 3);
let foreground_color: image::Luma<u8> = Luma([1]);

image_buffer.put_pixel(0, 0, foreground_color);
image_buffer.put_pixel(1, 1, foreground_color);
image_buffer.put_pixel(2, 2, foreground_color);

println!("{}", single_l8_to_paths(&mut image_buffer, foreground_color, true));