arcade
arcade copied to clipboard
Add screenshot 1342
Fixes #1342
What about the old arcade.get_image()
and arcade.get_pixel()
? We also talked about having screenshot feature in cameras. I think get_image()
also have some history related to pixel ratio > 1.0. I don't quite remeber if we ended up scaling the screenshot itself.
also have some history related to pixel ratio > 1.0
Is this HiDPI or strange edge cases where non-square pixels exist? To my knowledge, that only exists on ancient platforms, but I figured I should double check.
I like having the additional docs.
Although, in the past, when people have wanted to do a screenshot we've just pointed them to:
image = get_image()
image.save('screenshot.png', 'PNG')
This seems like a lot to add to the library for screenshots when two-lines can also run a screenshot.
If we do add it, can we get some unit tests?
TL;DR:
- We have some unit tests already
- It seems since it's all at once instead of over 3+ years
-
save_image
is clear and discoverable
The Precedent is 2-3 Feature Exposures
This seems like a lot to add to the library for screenshots
In the past, we slowly added features to the top-level namespace, Window
, and View
. Two of the top examples:
Feature | Window |
View |
Top-level |
---|---|---|---|
Clearing | Window.clear() |
View.clear() |
arcade.start_render() (arcade.get_window.clear() ) |
Setting BG color | Window.background_color |
View.background_color |
arcade.set_background_color |
Why Do It For Screenshots?
-
View
is expected to share core API features withWindow
-
arcade.get_image
sets the precedent for exposing screenshots at the top level
Unit Tests
If we do add it, can we get some unit tests?
Can you elaborate? We already have some here:
If you'd like, we add some to explicitly cover View
.
We can revisit this in 3.x. Let's keep this PR around.
There's things like docs in there that can be salvaged.