Alpha16

Struct Alpha16 

Source
pub struct Alpha16 {
    pub pix: Vec<u8>,
    pub stride: usize,
    /* private fields */
}
Expand description

Alpha16 is an in-memory image whose At method returns color::Alpha16 values.

Fields§

§pix: Vec<u8>§stride: usize

stride is the pix stride (in bytes) between vertically adjacent pixels.

Implementations§

Source§

impl Alpha16

Source

pub fn new(r: &Rectangle) -> Self

new returns a new Alpha16 image with the given bounds.

Source

pub fn pix_offset(&self, x: isize, y: isize) -> usize

pix_offset returns the index of the first element of pix that corresponds to the pixel at (x, y).

Trait Implementations§

Source§

impl Debug for Alpha16

Source§

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

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

impl Image for Alpha16

Source§

fn color_model(&self) -> Model

color_model returns the Image’s color model.
Source§

fn bounds(&self) -> &Rectangle

bounds returns the domain for which At can return non-zero color:: The bounds do not necessarily contain the point (0, 0).
Source§

fn at(&self, x: isize, y: isize) -> Color

at returns the color of the pixel at (x, y). at(bounds().min.x, bounds().min.y) returns the upper-left pixel of the grid. at(bounds().max.x-1, bounds().max.y-1) returns the lower-right one.
Source§

fn set(&mut self, x: isize, y: isize, c: &Color)

Source§

fn opaque(&self) -> bool

opaque scans the entire image and reports whether it is fully opaque.
Source§

fn stride(&self) -> usize

stride returns the pix stride (in bytes) between vertically adjacent pixels.
Source§

fn pix(&self) -> &Vec<u8>

pix returns the image pixel data. Format of the data depends on the image type.
Source§

fn get_pix_mutable(&mut self) -> &mut Vec<u8>

get_pix_mutable returns the image data for editing. Format of the data depends on the image type.
Source§

fn bytes_per_pixel(&self) -> usize

bytes_per_pixel return how many bytes is used per pixel
Source§

fn deep_equal(&self, other: &dyn Image) -> bool

deep_equal checks that two images are exactly the same
Source§

fn get_line_data(&self, y: isize) -> &[u8]

get_line_data returns data that encode one line of pixels.

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> 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, 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.