Skip to main content

Pixels

Struct Pixels 

Source
pub struct Pixels { /* private fields */ }

Implementations§

Source§

impl Pixels

Source

pub fn new(width: u32, height: u32) -> Pixels

Source

pub fn filled(width: u32, height: u32, color: Color) -> Pixels

Source

pub fn from_rgba( width: u32, height: u32, data: impl Into<Vec<u8>>, ) -> Option<Pixels>

Source

pub fn width(&self) -> u32

Source

pub fn height(&self) -> u32

Source

pub fn is_empty(&self) -> bool

Source

pub fn id(&self) -> u64

Source

pub fn revision(&self) -> u64

Source

pub fn pixel_count(&self) -> usize

Source

pub fn data(&self) -> &[u8] ⓘ

Source

pub fn data_mut(&mut self) -> &mut [u8] ⓘ

Source

pub fn into_data(self) -> Vec<u8> ⓘ

Source

pub fn index(&self, x: i32, y: i32) -> Option<usize>

Source

pub fn contains(&self, x: i32, y: i32) -> bool

Source

pub fn get(&self, x: i32, y: i32) -> Option<Color>

Source

pub fn set(&mut self, x: i32, y: i32, color: Color) -> bool

Source

pub fn blend(&mut self, x: i32, y: i32, color: Color) -> bool

Source

pub fn fill(&mut self, color: Color)

Source

pub fn fill_rect(&mut self, rect: Rect, color: Color) -> Rect

Source

pub fn blend_rect(&mut self, rect: Rect, color: Color) -> Rect

Source

pub fn blit(&mut self, src: &Pixels, dx: i32, dy: i32) -> Rect

Source

pub fn blend_from(&mut self, src: &Pixels, dx: i32, dy: i32) -> Rect

Source

pub fn clear(&mut self)

Source

pub fn crop(&self, rect: Rect) -> Pixels

Source

pub fn flip_horizontal(&mut self)

Source

pub fn flip_vertical(&mut self)

Source

pub fn rotate180(&mut self)

Source

pub fn resize_nearest(&self, width: u32, height: u32) -> Pixels

Source

pub fn resize_bilinear(&self, width: u32, height: u32) -> Pixels

Source

pub fn thumbnail(&self, max_dim: u32) -> Pixels

Source

pub fn scaled_to_fit(&self, max_dim: u32) -> Option<Pixels>

Source

pub fn sample_nearest(&self, fx: f32, fy: f32) -> Color

Source

pub fn sample_bilinear(&self, fx: f32, fy: f32) -> Color

Source

pub fn for_each_pixel(&mut self, f: impl FnMut(i32, i32, Color) -> Color)

Source

pub fn map(&self, f: impl FnMut(i32, i32, Color) -> Color) -> Pixels

Source

pub fn grayscale(&self) -> Pixels

Source

pub fn inverted(&self) -> Pixels

Source

pub fn tinted(&self, color: Color) -> Pixels

Source

pub fn multiply_alpha(&self, factor: f32) -> Pixels

Source

pub fn has_alpha(&self) -> bool

Source

pub fn opaque_bounds(&self) -> Option<Rect>

Source

pub fn to_source(&self) -> ImageSource

Source

pub fn into_source(self) -> ImageSource

Trait Implementations§

Source§

impl Clone for Pixels

Source§

fn clone(&self) -> Pixels

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Pixels

Source§

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

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

impl Default for Pixels

Source§

fn default() -> Pixels

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

impl Eq for Pixels

Source§

impl PartialEq for Pixels

Source§

fn eq(&self, other: &Pixels) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> ViewState for T
where T: Default + 'static,