pub struct Element { /* private fields */ }
Expand description
Represents either a character or image tile, along with its luminance and pixel characteristics used for comparison and matching.
Implementations§
Source§impl Element
impl Element
Sourcepub fn new(
characteristics: Vec<f64>,
luminance: f64,
character: Option<char>,
image: Option<DynamicImage>,
) -> Self
pub fn new( characteristics: Vec<f64>, luminance: f64, character: Option<char>, image: Option<DynamicImage>, ) -> Self
Constructs a new Element with the given characteristics and metadata.
Sourcepub fn characteristics(&self) -> &[f64]
pub fn characteristics(&self) -> &[f64]
Returns the pixel intensity values of the element.
Sourcepub fn character(&self) -> Option<char>
pub fn character(&self) -> Option<char>
Returns the character associated with this element, if any.
Sourcepub fn image(&self) -> Option<&DynamicImage>
pub fn image(&self) -> Option<&DynamicImage>
Returns a reference to the image of this element, if available.
Sourcepub fn from_char(
font: &FontArc,
character: char,
scale: PxScale,
) -> Result<Self>
pub fn from_char( font: &FontArc, character: char, scale: PxScale, ) -> Result<Self>
Creates an element by rendering a character into an image using the provided font and scale, then converting it into luminance data.
Sourcepub fn from_image(image: DynamicImage) -> Result<Self>
pub fn from_image(image: DynamicImage) -> Result<Self>
Creates an element from an image tile by calculating its luminance characteristics.
Trait Implementations§
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
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()
.