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

Add support to draw to an off screen buffer #387

Merged
merged 4 commits into from
Sep 11, 2022
Merged

Conversation

tushar5526
Copy link
Member

@tushar5526 tushar5526 commented Sep 7, 2022

Related to #386

The basic design of the Graphics object is like following.

Graphics is declared as an empty abstract class. In case other renderers, have their own implementations of it. Almost each Processing API is also a method of Graphics object so I skipped defining abstract methods for each of them. As that would be too much redundant code and time-consuming.

In the skia implementation, I am creating a new Renderer, canvas, surface, path and paint for each graphics object.

Then the methods are binded to the Graphics objects in a kind of unconventional way, but it works properly.

The major scope of improvement here is to use a GPU-backed surface for smoother rendering. I need to dig more into how glfw contexts work and how can I create an offscreen context for surfaces.

Currently it's a CPU backed surface and the offscreen sketches are not that smooth. I will open an issue for this.

Copy link
Member

@ziyaointl ziyaointl left a comment

Choose a reason for hiding this comment

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

This is quite impressive! The bind mechanism is simple and elegant. I think not defining a full interface for Graphics is fine, we just need documentation/examples somewhere to showcase its general capabilities.

@tushar5526
Copy link
Member Author

Yes, I will be updating examples and write a few tutorials for it.

@tushar5526 tushar5526 merged commit c390a59 into master Sep 11, 2022
@tushar5526 tushar5526 deleted the skia-pgraphics branch September 11, 2022 17:26
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