pub fn blit(&mut self, source: &Image, location: Vector2<i32>) {
        if let Some((dest_rect, src_rect)) =
            Rect::intersect_relative_to_both(self.dimensions(), source.dimensions(), location)
        {
            let mut dest_view = self.create_view_mut(dest_rect.clone().convert());
            let src_view = source.create_view(src_rect.convert());

            for row in 0..(dest_rect.dimensions.y as u32) {
                let dest = dest_view.get_row_rgba8_mut(row);
                let src = src_view.get_row_rgba8(row);

                dest.clone_from_slice(src);
            }
        }
    }
/// Blit another image on to self. The location is the relative offset of the (0,0) pixel of the
/// source image relative to self's (0,0) pixel.
///
/// # Example
///
/// ```
/// # use riddle_image::*; use riddle_math::*;
/// let mut source = Image::new(1,1);
/// source.set_pixel(0, 0, Color::<u8>::RED);
///
/// let mut dest = Image::new(2,1);
/// dest.blit(&source, Vector2::new(1, 0));
///
/// assert_eq!(Color::ZERO, dest.get_pixel(0,0));
/// assert_eq!(Color::RED, dest.get_pixel(1, 0));
/// ```
Blit another image on to self. The location is the relative offset of the (0,0) pixel of the
source image relative to self's (0,0) pixel.
Blit another image on to self . The location is the relative offset of the ( 0 0 ) pixel of the source image relative to self ' s ( 0 0 ) pixel .
pub fn blit(&mut self, source: &Image, location: Vector2<i32>) {
        if let Some((dest_rect, src_rect)) =
            Rect::intersect_relative_to_both(self.dimensions(), source.dimensions(), location)
        {
            let mut dest_view = self.create_view_mut(dest_rect.clone().convert());
            let src_view = source.create_view(src_rect.convert());
            for row in 0..(dest_rect.dimensions.y as u32) {
                let dest = dest_view.get_row_rgba8_mut(row);
                let src = src_view.get_row_rgba8(row);
                dest.clone_from_slice(src);
            }
        }
    }
pub fn blit ( & mut self , source : & Image , location : Vector2 < i32 > ) { if let Some ( ( dest_rect , src_rect ) ) = Rect :: intersect_relative_to_both ( self . dimensions ( ) , source . dimensions ( ) , location ) { let mut dest_view = self . create_view_mut ( dest_rect . clone ( ) . convert ( ) ) ; let src_view = source . create_view ( src_rect . convert ( ) ) ; for row in 0 .. ( dest_rect . dimensions . y as u32 ) { let dest = dest_view . get_row_rgba8_mut ( row ) ; let src = src_view . get_row_rgba8 ( row ) ; dest . clone_from_slice ( src ) ; } } }
Blit another image on to self.
Blit another image on to self .
&mut self
source
&Image
location
Vector2<i32>
&mut self
source
&Image
location
Vector2<i32>
example
None
use riddle_image::*; use riddle_math::*;
let mut source = Image::new(1,1);
source.set_pixel(0, 0, Color::::RED).




let mut source = Image :: new ( 1 1 ) ; source . set_pixel ( 0 0 Color :::: RED ) .