Struct NESImage

Source
pub struct NESImage { /* private fields */ }
Expand description

An image the size of an NES screen, backed by an array.

This is a fairly big thing to have on the stack (~61k), so go easy with it, or stick it in a global somewhere.

Trait Implementations§

Source§

impl Clone for NESImage

Source§

fn clone(&self) -> NESImage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NESImage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NESImage

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Index<(usize, usize)> for NESImage

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, (x, y): (usize, usize)) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<(usize, usize)> for NESImage

Source§

fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl ReadableImage<u8> for NESImage

Source§

fn width(&self) -> usize

Can’t exceed isize::MAX
Source§

fn height(&self) -> usize

Can’t exceed isize::MAX
Source§

fn pitch(&self) -> isize

Offset from the start of one row to the start of the next row.
Source§

fn as_ptr(&self) -> *const u8

Raw const pointer to the data.
Source§

fn get(&self, loc: (usize, usize)) -> Option<&P>

Performs an optional indexing by reference, gives None for out of bounds.
Source§

fn slice(&self, r: Range<(usize, usize)>) -> ImageSlice<'_, P>

Grabs out a sub-slice of the data. Read more
Source§

fn iter(&self) -> ImageRefIter<'_, P>

Lets you iterate any image by reference.
Source§

fn to_vecimage(&self) -> VecImage<P>
where Self: Sized, P: Default + Clone,

This is like to_owned, you get your own version of the data. Read more
Source§

fn upscale(&self, scale: usize) -> VecImage<P>
where P: Copy + Default,

Scales up into a new VecImage by the given amount. Read more
Source§

impl WritableImage<u8> for NESImage

Source§

fn as_mut_ptr(&mut self) -> *mut u8

Raw mut pointer to the data.
Source§

fn get_mut(&mut self, loc: (usize, usize)) -> Option<&mut P>

Performs an optional indexing by mut reference, gives None for out of bounds.
Source§

fn slice_mut(&mut self, r: Range<(usize, usize)>) -> ImageMutSlice<'_, P>

Grabs out a mutable sub-slice of the data. Read more
Source§

fn iter_mut(&mut self) -> ImageMutRefIter<'_, P>

Lets you mutably iterate over any writable form of image.
Source§

fn set_all(&mut self, pixel: P)
where P: Clone,

Assigns all locations to be the given pixel value.
Source§

fn direct_copy<S>(&mut self, src: &S, offset: (isize, isize))
where S: ReadableImage<P>, P: Copy,

Directly copies the data from the source image into this image. Read more
Source§

fn flip_vertical(&mut self)

Flips the image vertically. Read more
Source§

fn flip_horizontal(&mut self)

Flips the image horizontally. Read more
Source§

fn inplace_counterclockwise90_square(&mut self) -> Option<()>

Performs a 90 degrees counter-clockwise rotation, in place. Read more
Source§

fn blit_generic<RI, F>(&mut self, src: &RI, offset: (isize, isize), op: F)
where RI: ReadableImage<P>, F: FnMut(P, P) -> P, P: Copy,

Modifies this image by overlaying the source image at the offset given. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.