[−][src]Struct blit::BlitBuffer
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]
&self,
dst: &mut [u32],
dst_width: usize,
offset: (i32, i32),
sub_rect: (i32, i32, i32, i32)
)
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]
C: Into<Color>,
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]
P: AsRef<Path>,
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]
P: AsRef<Path>,
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for BlitBuffer
[src]
Auto Trait Implementations
impl RefUnwindSafe for BlitBuffer
impl Send for BlitBuffer
impl Sync for BlitBuffer
impl Unpin for BlitBuffer
impl UnwindSafe for BlitBuffer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,