https://github.com/b0ney/iced-texture-canvas
https://github.com/b0ney/iced-texture-canvas
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/b0ney/iced-texture-canvas
- Owner: B0ney
- License: mit
- Created: 2024-05-28T21:16:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-27T19:15:03.000Z (11 months ago)
- Last Synced: 2025-07-27T20:51:52.616Z (11 months ago)
- Language: Rust
- Size: 167 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Iced Texture Canvas (WIP)
A widget similar to a [`image::Viewer`](https://docs.iced.rs/iced/widget/image/viewer/index.html) that lets you view bitmap data but with added enhancements.
What sets this apart is that you can freely modify the image data without re-allocating or resorting to locks. This is good if you need to display frequently changing image data.
Instead of using [`image::Handle`](https://docs.iced.rs/iced/advanced/image/enum.Handle.html), this crate provides `iced_texture::Bitmap` an rgba buffer stored on the CPU.
And to view that buffer, you use `iced_texture::texture`.
```rust
use iced_texture_canvas::{bitmap, texture_canvas};
// create your bitmap image
let mut bitmap = bitmap(500, 500);
// fill it with color
bitmap.buffer_mut().fill(0xffffffff);
// display it in your view method
texture_canvas(&bitmap)
```
The api also takes a few inspirations from [`MouseArea`](https://docs.iced.rs/iced/widget/struct.MouseArea.html)
# Run Example
```
cargo run -p demo
```
# Todos
* API improvements
* Documentation
* Move scaling and positioning to user state.
* Explore abstracting over image formats instead of just rgba.
# Limitations
* Only works if you're using the wgpu renderer.