[][src]Struct blit::BlitBuffer

pub struct BlitBuffer { /* fields omitted */ }

A data structure holding a color and a mask buffer to make blitting on a buffer real fast.

Methods

impl BlitBuffer[src]

pub fn blit(&self, dst: &mut [u32], dst_width: usize, offset: (i32, i32))[src]

Blit the image on a buffer using bitwise operations--this is a lot faster than blit_with_mask_color.

pub fn blit_rect(
    &self,
    dst: &mut [u32],
    dst_width: usize,
    offset: (i32, i32),
    sub_rect: (i32, i32, i32, i32)
)
[src]

Blit a section of the image on a buffer.

pub fn from_buffer<C>(src: &[u32], width: i32, mask_color: C) -> Self where
    C: Into<Color>, 
[src]

Create a instance from a buffer of Color data.

pub fn save<P>(&self, path: P) -> Result<(), Box<dyn Error>> where
    P: AsRef<Path>, 
[src]

Saves the buffer to a file at the path specified. A custom binary format is used for this.

pub fn open<P>(path: P) -> Result<Self, Box<dyn Error>> where
    P: AsRef<Path>, 
[src]

Create a new buffer from a file at the path specified. The file needs to be the custom binary format.

pub fn from_memory(buffer: &[u8]) -> Result<Self, Box<dyn Error>>[src]

Create a new buffer from a file at the path specified. The array needs to be the custom binary format.

pub fn size(&self) -> (i32, i32)[src]

Get the size of the buffer in pixels.

pub fn width(&self) -> i32[src]

Get the width of the buffer in pixels.

pub fn height(&self) -> i32[src]

Get the height of the buffer in pixels.

pub fn mask_color(&self) -> Color[src]

Get the color of the mask.

pub fn to_raw_buffer(&self) -> Vec<u32>[src]

Get the raw pixels buffer, this is a costly operation.

Trait Implementations

impl Debug for BlitBuffer[src]

impl<'de> Deserialize<'de> for BlitBuffer[src]

impl Serialize for BlitBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.