Partially overwrite images with other images
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
Building on cpu drawing - I think it makes sense to apply an image to another image.
I'm personally using this for visualizing a procedural generation pipeline (drawing tiles onto a larger tilemap)
## What solution would you like?
```rust
pub trait ImageApplyExt {
fn apply(&mut self, root: UVec2, apply: &Image);
}
impl ImageApplyExt for Image {
fn apply(&mut self, root: UVec2, apply: &Image) {
for y in 0..apply.height() {
for x in 0..apply.width() {
if let Ok(new_color) = apply.get_color_at(x, y) {
if let Err(TextureAccessError::OutOfBounds {..} ) = self.set_color_at(root.x + x, root.y + y, new_color) {
// past bounds of base image - nowhere to write to
break
}
}
}
}
}
}
```
## What alternative(s) have you considered?
Let users implement this themselves.
Contributor guide
Assessment
This issue has not been assessed yet.