Crates.io | simple-blit |
lib.rs | simple-blit |
version | 2.0.0 |
source | src |
created_at | 2023-11-13 08:01:25.644245 |
updated_at | 2024-06-09 09:21:34.300188 |
description | Provides simple blitting from one surface to another with some possible transformations. |
homepage | |
repository | https://github.com/Solar-Falcon/simple-blit |
max_upload_size | |
id | 1033359 |
size | 31,560 |
Provides simple blitting from one surface to another with some possible transformations.
use simple_blit::*;
let mut dest: [u8; 25] = [
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
];
let src: [u8; 16] = [
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
];
blit(
// construct a surface which holds width and height
GenericSurface::new(&mut dest, size(5, 5))
.unwrap()
// offset on the destination
.offset_surface_mut(point(1, 1)),
// you can borrow the surface if you don't want to drop it
// (the destination has to be borrowed mutably of course)
&GenericSurface::new(&src, size(4, 4))
.unwrap()
.sub_surface(
point(0, 0), // source offset
size(3, 3) // size of the area to copy
),
// no transformations
Default::default(),
);
assert_eq!(dest, [
0, 0, 0, 0, 0,
0, 1, 1, 1, 0,
0, 1, 1, 1, 0,
0, 1, 1, 1, 0,
0, 0, 0, 0, 0,
]);
pixels-integration
(off by default): implements Surface
and SurfaceMut
for Pixels
.image-integration
(off by default): implements Surface
and SurfaceMut
for ImageSurface
serde
(off by default): implements Serialize
and Deserialize
for surface types and Transform
.As of version 1.0.0, this crate's license has been changed from MIT to MIT-0 (aka MIT No Attribution).