13 个版本 (3 个稳定版本)
2.0.0 | 2024 年 6 月 9 日 |
---|---|
1.2.0 | 2024 年 6 月 9 日 |
1.0.0 | 2024 年 2 月 20 日 |
0.8.0 | 2024 年 1 月 16 日 |
0.3.0 | 2023 年 11 月 14 日 |
#70 在 无标准库 中
每月 70 次下载
在 2 crates 中使用
31KB
778 行
simple-blit
提供从一种表面到另一种表面进行简单位块传输以及一些可能的转换。
示例
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,
]);
Cargo 功能
pixels-integration
(默认关闭): 为Pixels
实现Surface
和SurfaceMut
。image-integration
(默认关闭): 为ImageSurface
实现Surface
和SurfaceMut
。serde
(默认关闭): 为表面类型和Transform
实现Serialize
和Deserialize
。
许可证
自版本 1.0.0 以来,此 crate 的许可证已从 MIT 更改为 MIT-0(也称为 MIT 无贡献)。
依赖项
~0–31MB
~462K SLoC