Skip to content

Conversation

@peckpeck
Copy link

Hi,

I found your crate useful for embedded because it is simple and doesn't use simd.
Here is a patch to implement what is needed to make is embedded-graphics compatible.

What do you think ?

@peckpeck
Copy link
Author

I see no updates since long ago in your repository.

Do you think I could help you maintain it ?

@bschwind
Copy link
Owner

bschwind commented Sep 7, 2025

Hey thanks for the PR and sorry for the late reply. I like the idea of passing a closure or a trait implementation to let the user decide how to handle the incoming pixels, that could open the API up to use more of a streaming approach. I'm less sure of some of the embedded-graphics specific code in this PR though, I don't think things like draw and draw_sub_image should be part of the responsibility of this crate.

So in general, I'm in favor of making the API more flexible if it helps you integrate embedded graphics, but they should be flexible enough that they don't need to pull in embedded-graphics as a direct dependency, if that makes sense.

@bschwind
Copy link
Owner

bschwind commented Sep 7, 2025

I see no updates since long ago in your repository.

Do you think I could help you maintain it ?

I'd prefer to keep things as-is for now. I may not be super responsive as my open source projects are just maintained as a hobby, but I do get around to stuff eventually.

@peckpeck
Copy link
Author

peckpeck commented Sep 7, 2025

draw and draw_sub_image are necessary to use Png<C> inside an embedded-graphics image.

I made embedded-graphics-core an optional dependency so that you don't build with it by default, and all embedded-graphics code is behind a #[cfg]. Otherwise, I would need a separate new crate to hold this code.

@peckpeck
Copy link
Author

peckpeck commented Sep 7, 2025

On a second thought, I think I can do that, create a new crate.
This means I can remove the embedded-graphics dependency, this also means some refactoring is needed to make proper public structures usable from outside of this crate.


let mut compressed_data: Vec<u8> =
Vec::with_capacity(header.width as usize * header.height as usize * 3);
let mut compressed_data: Vec<u8> = Vec::new();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is compressed data, creating it with uncompressed size is wasteful

@peckpeck
Copy link
Author

peckpeck commented Sep 8, 2025

Here it is.
I rewrote the patch so that there is no reference to embedded-graphics. I can now write embedded-graphics code elsewhere.

Please read with w=1 since github doesn't handle moved code very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants