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

[feat] Expose a way to make images during update #1473

Closed
richard-uk1 opened this issue Dec 19, 2020 · 2 comments
Closed

[feat] Expose a way to make images during update #1473

richard-uk1 opened this issue Dec 19, 2020 · 2 comments
Labels
enhancement adds or requests a new feature
Milestone

Comments

@richard-uk1
Copy link
Collaborator

When drawing text, a widget can (re)create the textlayout during update, by getting access to the PietText. It would be nice if there was an analagous way to create piet Images during update. Currently, the image must always be rebuilt in paint or caching used in user code.

@raphlinus
Copy link
Contributor

I totally agree with this, and have been doing some light thinking. It will require some changes in the Piet API. A very rough outline of my thinking is that Piet exposes a type that I'm calling "Session" for now, which is Clone and Send, and is suitable for creating all retained resources. That includes text layouts and images, and also retained display lists going forward.

There are some questions regarding the details, one of the biggest to me is whether we continue with the gfx-hal like tower of associated types, or have a more dynamic dispatch pattern, so that creating a resource from one type of Session and using it in another is a runtime error. There are some subtle issues here, as it's also possible to get Direct2D errors using resources created on one device in a DeviceContext created from another.

@cmyr cmyr added the enhancement adds or requests a new feature label Dec 22, 2020
@cmyr cmyr added this to the piet-4.0 milestone Mar 18, 2021
@cmyr
Copy link
Member

cmyr commented Mar 30, 2021

this should now be possible as of #1677, which brings in the RenderContext::capture_image_area method.

@cmyr cmyr closed this as completed Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement adds or requests a new feature
Projects
None yet
Development

No branches or pull requests

3 participants