pub struct BinaryRaster(/* private fields */);Implementations§
Source§impl BinaryRaster
impl BinaryRaster
pub fn new(width: usize, height: usize) -> Self
pub fn from_raster(pixels: &[u8], width: usize) -> Self
Sourcepub fn can_fit(&self, other: &BinaryRaster, pos: (usize, usize)) -> bool
pub fn can_fit(&self, other: &BinaryRaster, pos: (usize, usize)) -> bool
Returns true if other fits within self at given pos, false otherwise
Sourcepub fn add_from_checked(
&mut self,
source: &BinaryRaster,
pos: (usize, usize),
) -> Result<(), ()>
pub fn add_from_checked( &mut self, source: &BinaryRaster, pos: (usize, usize), ) -> Result<(), ()>
Adds entire source to self at the given position if there’s no bit collision, assuming it fits Returns Ok(()) if the item was added (no collision), and Err(()) otherwise
Sourcepub fn add_from(&mut self, source: &BinaryRaster, pos: (usize, usize))
pub fn add_from(&mut self, source: &BinaryRaster, pos: (usize, usize))
Adds entire source to self at the given position without checking for collision, assuming it fits
Sourcepub fn collision_check_at(
&self,
other: &BinaryRaster,
pos: (usize, usize),
) -> bool
pub fn collision_check_at( &self, other: &BinaryRaster, pos: (usize, usize), ) -> bool
Checks if there’s any pixel overlap between other and self at given pos
Sourcepub fn get_display(&self, resolution: u32) -> String
pub fn get_display(&self, resolution: u32) -> String
Gets a String display of the raster at the desired resolution, with “■” for 1 and “ “ for 0 A resolution of 1 displays every bit, 2 displays 1/2 bits, etc.
Trait Implementations§
Source§impl Clone for BinaryRaster
impl Clone for BinaryRaster
Source§fn clone(&self) -> BinaryRaster
fn clone(&self) -> BinaryRaster
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BinaryRaster
impl Debug for BinaryRaster
Source§impl PartialEq for BinaryRaster
impl PartialEq for BinaryRaster
impl Eq for BinaryRaster
impl StructuralPartialEq for BinaryRaster
Auto Trait Implementations§
impl Freeze for BinaryRaster
impl RefUnwindSafe for BinaryRaster
impl Send for BinaryRaster
impl Sync for BinaryRaster
impl Unpin for BinaryRaster
impl UnwindSafe for BinaryRaster
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