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 transparency support to render_to_surface. #801

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TheNachoBIT
Copy link
Contributor

This tiny PR adds the feature suggested in #549.

It adds transparency support for render_to_surface, with the addition of being able to render scenes on top of already rendered stuff with this function by giving you the option to choose if you want to clear the screen before drawing via an extra argument called "clear". If the check is true, it clears the screen before drawing the scene; if it is false, it doesn't.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

I'd like a slight change in the API, but these changes look reasonable

@@ -502,6 +502,7 @@ impl Renderer {
scene: &Scene,
surface: &SurfaceTexture,
params: &RenderParams,
clear: bool,
Copy link
Member

Choose a reason for hiding this comment

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

A bare boolean parameter is very rarely understandable. I think the best solution here would be to move clear into being a field of RendererOptions. (We'd need to also then make it a field of Renderer).

Clearly that's not ideal in all cases. I hope that we can remove render_to_surface entirely soon. But that's been planned for probably a year, so...

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