Struct blit::BlitBuffer
source · pub struct BlitBuffer { /* private fields */ }
Expand description
A data structure holding a color and a mask buffer to make blitting on a buffer real fast.
Implementations§
source§impl BlitBuffer
impl BlitBuffer
sourcepub fn blit(&self, dst: &mut [u32], dst_width: usize, offset: (i32, i32))
pub fn blit(&self, dst: &mut [u32], dst_width: usize, offset: (i32, i32))
Blit the image on a buffer using bitwise operations–this is a lot faster than
blit_with_mask_color
.
sourcepub fn blit_rect(
&self,
dst: &mut [u32],
dst_width: usize,
offset: (i32, i32),
sub_rect: (i32, i32, i32, i32)
)
pub fn blit_rect(
&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.
sourcepub fn from_buffer(src: &[u32], width: i32, mask_color: Color) -> Self
pub fn from_buffer(src: &[u32], width: i32, mask_color: Color) -> Self
Create a instance from a buffer of Color
data.
sourcepub fn save<P>(&self, path: P) -> Result<(), Box<dyn Error>>where
P: AsRef<Path>,
pub fn save<P>(&self, path: P) -> Result<(), Box<dyn Error>>where
P: AsRef<Path>,
Saves the buffer to a file at the path specified. A custom binary format is used for this.
sourcepub fn open<P>(path: P) -> Result<Self, Box<dyn Error>>where
P: AsRef<Path>,
pub fn open<P>(path: P) -> Result<Self, Box<dyn Error>>where
P: AsRef<Path>,
Create a new buffer from a file at the path specified. The file needs to be the custom binary format.
Trait Implementations§
source§impl Debug for BlitBuffer
impl Debug for BlitBuffer
source§impl<'de> Deserialize<'de> for BlitBuffer
impl<'de> Deserialize<'de> for BlitBuffer
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more