Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageDrawables should be able to report errors #668

Open
rfuest opened this issue Mar 28, 2022 · 2 comments
Open

ImageDrawables should be able to report errors #668

rfuest opened this issue Mar 28, 2022 · 2 comments
Milestone

Comments

@rfuest
Copy link
Member

rfuest commented Mar 28, 2022

For compressed images it isn't always possible to detect errors without actually decompressing the image. But an implementation of ImageDrawable can only forward errors caused by the DrawTarget and not generate other errors while an image is drawn. This means that the application isn't able to detect there type corrupted images and, for example, draw an broken image icon to notify the user.

@jamwaffles
Copy link
Member

Would an enum like the following be a sensible solution?

enum ImageDrawError<E> {
    Display(DrawTarget::Error),
    Image(E)
}

and, for example, draw an broken image icon to notify the user.

Mainly thinking out loud here: This is an interesting edge case if only DrawTarget::Errors are returned; an image was drawn to the display but there was still an error, so it reinforces the need to return image-centric errors too.

@rfuest
Copy link
Member Author

rfuest commented Mar 28, 2022

Would an enum like the following be a sensible solution?

Yes, but this will also need some changes in other parts of e-g, because Drawables can also only return DrawTarget errors. So this change should be part of the API overhaul to fix things like #613, perhaps making Drawables object safe, consider supporting DMA/async, alpha blending, ...

@jamwaffles jamwaffles added this to the 0.8 milestone Oct 14, 2022
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

No branches or pull requests

2 participants