bevyengine / bevyengine/bevy

Implement the Iterator trait for Image

Open
#17,941 8 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Usability D-Straightforward S-Ready-For-Implementation X-Uncontroversial
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?

If a texture has it's transparent areas encoded as a mock color. It'd be nice to iterate through the pixels to replace the mock color with transparency

## What solution would you like?

bevy::prelude Struct Image should implement the Iterator trait

## What alternative(s) have you considered?

Right now to iterate through all the pixels of a texture you have to make a for loop with 2 indexes. Iterator doesn't have any overhead and is easier to read and write.

## Additional context

Imagine the green is the mock color and is supposed to be replaced with a 0 alpha value (absolute transparency):
![Image](https://github.com/user-attachments/assets/54b54993-f291-4d90-9347-785c14d5c584)

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.