bevyengine / bevyengine/bevy

Partially overwrite images with other images

Open
#16,822 4 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Feature S-Ready-For-Implementation
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.