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

Refactor inter-context-canvas api #21

Merged
merged 8 commits into from
Nov 18, 2024
Merged

Refactor inter-context-canvas api #21

merged 8 commits into from
Nov 18, 2024

Conversation

almarklein
Copy link
Member

@almarklein almarklein commented Nov 14, 2024

Closes #20

This will break compatibility with wgpu-py. So let's keep this draft for now.

Stuff that allows use of other contexts:

  • Rename _rc_get_present_info() -> _rc_get_present_methods()
  • Rename the "image" present method to "bitmap".
  • Document what _rc_get_present_info() can/should return.
  • Refactor canvas.get_context() mechanics. Can now load a context from anywhere.
  • Document the API that a context should have in order to play nice with the above.

Supporting get_context("bitmap"):

  • Implement a simple BitmapRenderingContext.
  • Implement a BitmapToScreenAdapter to help contexts like the above to render to screen for canvases that only support the screen present-method.

Other:

  • Show example-snippets in docs and readme
  • Examples.
  • Tests.

This needs to go at the same time as pygfx/wgpu-py#642, because it's mutually dependent. Interesting 🤔

@almarklein
Copy link
Member Author

This docs page is I think a good summary of what I'm trying to achieve here: https://rendercanvas--21.org.readthedocs.build/21/contextapi.html

@almarklein almarklein marked this pull request as ready for review November 15, 2024 14:16
@almarklein almarklein merged commit 8ae174f into main Nov 18, 2024
11 checks passed
@almarklein almarklein deleted the get_context branch November 18, 2024 11:34
@almarklein almarklein mentioned this pull request Nov 18, 2024
40 tasks
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.

Scope: who can render to our canvas?
1 participant