pub struct Insa { /* private fields */ }
Expand description
The main interface to image to text converion
Implementations§
source§impl Insa
impl Insa
sourcepub fn simple_on_dark() -> Insa
pub fn simple_on_dark() -> Insa
Initialize using well known round chars on dark background
sourcepub fn simple_on_bright() -> Insa
pub fn simple_on_bright() -> Insa
Initialize using well known round chars on dark background
sourcepub fn blocks() -> Insa
pub fn blocks() -> Insa
Initialize using well known block drawing elements and using background
sourcepub fn load_brushes(&mut self, font: &Font, brushes: impl AsRef<str>) -> &mut Self
pub fn load_brushes(&mut self, font: &Font, brushes: impl AsRef<str>) -> &mut Self
Load additional brushes from a font
let font = include_bytes!("../docs/unifont-15.0.01.ttf");
let font = fontdue::Font::from_bytes(font.as_ref(), fontdue::FontSettings::default())
.expect("tried and tested included font");
let mut insa = insa::Insa::default();
insa.load_brushes(&font, ".oO8°");
println!("{insa:?}")
sourcepub fn brushes_mut(&mut self) -> &mut BrushMap
pub fn brushes_mut(&mut self) -> &mut BrushMap
Mut access internal brush map
sourcepub fn invert_mut(&mut self) -> &mut bool
pub fn invert_mut(&mut self) -> &mut bool
Mut access to - does Insa invert dark/light?
sourcepub fn set_invert(&mut self, invert: bool) -> &mut Self
pub fn set_invert(&mut self, invert: bool) -> &mut Self
Should Insa invert dark/light?
sourcepub fn fixed_background_mut(&mut self) -> Option<&mut (u8, u8, u8)>
pub fn fixed_background_mut(&mut self) -> Option<&mut (u8, u8, u8)>
Mut access to - does Insa invert dark/light?
sourcepub fn set_fixed_background(&mut self, invert: Option<(u8, u8, u8)>) -> &mut Self
pub fn set_fixed_background(&mut self, invert: Option<(u8, u8, u8)>) -> &mut Self
Should Insa invert dark/light?
sourcepub fn brush_width(&self) -> u8
pub fn brush_width(&self) -> u8
The width of the brush in pixels
sourcepub fn brush_height(&self) -> u8
pub fn brush_height(&self) -> u8
The height of the brush in pixels
sourcepub fn convert<'a>(&'a self, img: &'a DynamicImage) -> ConvertIterator<'a> ⓘ
pub fn convert<'a>(&'a self, img: &'a DynamicImage) -> ConvertIterator<'a> ⓘ
Convert a raster bitmap image to text. The returned iterator reveals the number of text columns and rows
sourcepub fn convert_symbol(&self, img: &SubImage<&DynamicImage>) -> Symbol
pub fn convert_symbol(&self, img: &SubImage<&DynamicImage>) -> Symbol
Convert a single symbol, assuming position 0,0 and the symbol width and height for input
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Insa
impl Send for Insa
impl Sync for Insa
impl Unpin for Insa
impl UnwindSafe for Insa
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.