arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Add screenshot 1342

Open sabadam32 opened this issue 10 months ago • 5 comments

Fixes #1342

sabadam32 avatar Mar 29 '24 04:03 sabadam32

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.

einarf avatar Mar 29 '24 18:03 einarf

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.

pushfoo avatar Mar 31 '24 01:03 pushfoo

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?

pvcraven avatar Apr 11 '24 14:04 pvcraven

TL;DR:

  1. We have some unit tests already
  2. It seems since it's all at once instead of over 3+ years
  3. 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?

  1. View is expected to share core API features with Window
  2. 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.

pushfoo avatar Apr 11 '24 17:04 pushfoo

We can revisit this in 3.x. Let's keep this PR around.

There's things like docs in there that can be salvaged.

einarf avatar Jun 27 '24 13:06 einarf