Skip to content

Add support for Gray8 images#11331

Open
lambdachad wants to merge 5 commits intoslint-ui:masterfrom
lambdachad:gray8
Open

Add support for Gray8 images#11331
lambdachad wants to merge 5 commits intoslint-ui:masterfrom
lambdachad:gray8

Conversation

@lambdachad
Copy link
Copy Markdown

Adds support for Gray8 images, which resolves #11329.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 10, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

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

Thanks.

This adds the public API slint::Image::from_gray8() and the Gray8Pixel type.
And it has an implementation for skia.

I think that's good already, although i don't know if Gray8 images are so common and you can always convert to rgb888.
Did you see performance improvements by using that?

Because from the description of issue #11329 , i had the feeling you wanted to have a Gray8Pixel as a target for the software renderer, (like we have Rgb565) and implement the TargetPixel trait for it, which could have more significant impact in the rendering speed of the software renderer

Comment thread internal/renderers/femtovg/images.rs Outdated
femtovg::ImageFlags::PREMULTIPLIED,
),
SharedImageBuffer::Gray8(_) => {
unimplemented!("Gray8 images are not supported by the femtovg renderer")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ok great, added this too in latest.

Comment thread internal/renderers/software/scene.rs Outdated
Comment thread internal/renderers/software/target_pixel_buffer.rs Outdated
@lambdachad
Copy link
Copy Markdown
Author

Thanks.

This adds the public API slint::Image::from_gray8() and the Gray8Pixel type. And it has an implementation for skia.

I think that's good already, although i don't know if Gray8 images are so common and you can always convert to rgb888. Did you see performance improvements by using that?

Because from the description of issue #11329 , i had the feeling you wanted to have a Gray8Pixel as a target for the software renderer, (like we have Rgb565) and implement the TargetPixel trait for it, which could have more significant impact in the rendering speed of the software renderer

I already have a renderer target using Gray8 with Skia and that works great. It's mostly to save memory and performance because since we're using Skia, we're able to use Gray8 there to render directly to our grayscale framebuffer which then shows up on the E-INK screen.

@lambdachad
Copy link
Copy Markdown
Author

Regarding performance improvements, we did see a big increase after switching to Gray8 with Skia. Although to be fair, previously we used the Software renderer and manually converted the pixels with the classic formula to Gray8 and wrote that into the framebuffer for displaying.

@lambdachad
Copy link
Copy Markdown
Author

Regarding Gray8Pixel for software renderer, that could easily be added also.

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.

Add support for Gray8 images natively

3 participants