Crate simple_blit
source ·Expand description
§simple-blit
Provides simple blitting from one surface to another with some possible transformations.
§Example
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
&mut GenericSurface::new(&mut dest, size(5, 5)).unwrap(),
// where to blit
point(1, 1),
&GenericSurface::new(&src, size(4, 4)).unwrap(),
// where to blit from
point(0, 0),
// size of the area
size(3, 3),
// 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 features
pixels-integration(off by default): implementsSurfaceandSurfaceMutforPixels.image-integration(off by default): implementsSurfaceandSurfaceMutforImageSurfaceserde(off by default): implementsSerializeandDeserializefor surface types andTransform.
§License
As of version 1.0.0, this crate’s license has been changed from MIT to MIT-0 (aka MIT No Attribution).
Structs§
- Generic surface with width and height.
- A ‘surface’ that holds a single value, like a plain-colored rectangle.
Enums§
- Transformations that can be applied when blitting.
Traits§
- 2D immutable surface trait.
- 2D mutable surface trait.
Functions§
- Blit part of one surface to another, cloning the values.
- Blit part of one surface to another, converting the values.
- Blit part of one surface to another, ignoring the
maskvalues. - Blit one whole surface to another.
- Blit part of one surface to another (generalized function).
- Quickly construct a
Point. - Quickly construct a
Size.
Type Aliases§
- Point type.
- Size type.