Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

macOS: Screenshot

Open Suplanus opened this issue 5 years ago • 8 comments
trafficstars

Description of Change

Screenshot for macOS I thought it would be easy... hours later after testing with CGWindowListCreateImage and much more (CGImage.ScreenImage), this is the only way I can find out.

Documentation By default only the app windows are visible. But macOS is asking to set the permission in the settings. The security setting have to be enabled to get all apps on screen.

image

image

PR Checklist

  • [ ] Has tests (if omitted, state reason in description)
  • [ ] Has samples (if omitted, state reason in description)
  • [ ] Rebased on top of main at time of PR
  • [ ] Changes adhere to coding standard
  • [ ] Updated documentation (see walkthrough)

Suplanus avatar Oct 08 '20 15:10 Suplanus

I committed the changes. Looks much better, thanks @mattleibow 💖 Perhaps you can have a second look at it.

Suplanus avatar Oct 09 '20 06:10 Suplanus

This is the only platform where we take an actual screenshot instead of an application screenshot. I think this should work the same across uwp/macos/win32

Mrnikbobjeff avatar Oct 14 '20 15:10 Mrnikbobjeff

@Mrnikbobjeff You make an important point... What does screenshot mean to people?

I think this should be a separate feature. At least for mobile where we may not be able to or want to. However, it is also very often the case where all the app cares about is the app. Thus, I feel that this is maybe a separate feature? Like some option to pick the app or the screen?

Can we make this PR snap the window for now - for consistency - and then start a new PR for the screen. I think that might be what we want to do so we can focus on consistency. The whole screen will be unexpected if macOS is the only platform.

mattleibow avatar Oct 14 '20 16:10 mattleibow

Good point! I was thinking about that too, at writing the implementation. But for example on iOS its not only the app "window". If you are using split-mode on iPad, also other "windows" will be captured. I doesn't tested UWP. But if the behavior is that only the "window" is captured, I think thats wrong:

  1. iOS & Android capture full screen
  2. Multi-Window app would not be captured

Second thing I was thinking about is: What about multiple screens? On iOS for example Carplay or Desktop external Display.

In short my suggestion:

  • Current implementation should be screenshot (whole screen)
  • UWP have to be changed

Suplanus avatar Oct 15 '20 05:10 Suplanus

Android does not take a complete screenshot on my device. It only captures my application: Split tiny application window: screenshot Manual screenshot with hardware buttons Screenshot_20201015-124353

Mrnikbobjeff avatar Oct 15 '20 10:10 Mrnikbobjeff

Oh... my fault. I tested on iOS as well. There is also only the App visible. I will fix this PR. But also think it should have a other behavoir. image

Suplanus avatar Oct 15 '20 11:10 Suplanus

I have updated the code. So we need no interop methods any more. Thanks for all your suggestions!

image

Suplanus avatar Oct 15 '20 11:10 Suplanus

Is there a reason why it's not merged?

Suplanus avatar Nov 27 '20 07:11 Suplanus

While this is supercool! I don't think it's feasible to take this in anymore at this point in the lifespan anymore. Maybe something can be salvaged and put into .NET MAUI?

A big thank you for all the time and effort here!

jfversluis avatar Jul 03 '23 09:07 jfversluis