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

Various image improvements #1461

Merged
merged 6 commits into from
Dec 31, 2020

Conversation

richard-uk1
Copy link
Collaborator

@richard-uk1 richard-uk1 commented Dec 13, 2020

Currently blocked on a new release of piet.

This patch adds 3 features:

  1. Allow the user to specify a subrectangle of an image to display.
  2. Add a Send + Sync bound to dyn Errors from image. This means that, for example, you can load an image on a dedicated IO thread, and pass the error back to the UI thread.
  3. Improve support for rendering svg images in the Svg widget.

This allows, for example, a sprite sheet to be shared between multiple Image widgets. It also allows my motivating use case, which is an image viewer where the user can zoom in on part of the image.

I've made the changes so they are backwards compatible.

Update: this patch is growing a bit, but each commit is completely disjoint and can be reviewed/accepted separately.

Note: edited heavily.

@richard-uk1
Copy link
Collaborator Author

richard-uk1 commented Dec 13, 2020

I didn't realise that ImageBuf already uses reference counting, so Image doesn't need to.

I've also added a test to check that an empty image doesnt cause a panic. I think the test will currently fail, but I have a PR in for piet (#365) that will let it pass.

@richard-uk1 richard-uk1 added the S-blocked waits for another PR or dependency label Dec 13, 2020
@richard-uk1 richard-uk1 changed the title Add clip_area and from_shared to Image. Various image improvements Dec 13, 2020
@richard-uk1 richard-uk1 force-pushed the image_clip_and_share branch 2 times, most recently from c60a2e3 to 880e560 Compare December 19, 2020 22:32
@cmyr cmyr mentioned this pull request Dec 23, 2020
@cmyr
Copy link
Member

cmyr commented Dec 30, 2020

@derekdreery any interest in getting this landed? I'd like to do a release shortly.

@richard-uk1
Copy link
Collaborator Author

Ooh I'll revisit.

@richard-uk1
Copy link
Collaborator Author

Currently working on this.

@richard-uk1
Copy link
Collaborator Author

Looks like the new rust version introduced some new clippy lints. I'll fix them in this PR.

@richard-uk1
Copy link
Collaborator Author

I will submit a piet patch.

@richard-uk1
Copy link
Collaborator Author

Ok with the +Send+Sync patch for piet, this will be read to merge.

Also add a test to check rendering an empty picture doesn't cause a
panic
This commit improves the coverage and accuracy of svg support in the
`Svg` widget.
@richard-uk1 richard-uk1 removed the S-blocked waits for another PR or dependency label Dec 31, 2020
@richard-uk1
Copy link
Collaborator Author

Woop clippy fixed 🎆

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

Looks good!

@richard-uk1 richard-uk1 merged commit e9f1430 into linebender:master Dec 31, 2020
@richard-uk1 richard-uk1 deleted the image_clip_and_share branch December 31, 2020 23:09
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