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 screenshot features for linux and win32 #266

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Beanow
Copy link
Member

@Beanow Beanow commented May 16, 2021

Sharing for reference. Hopefully can serve as a starting point, not sure I can figure out much more myself.

  • Linux
    • Visible
    • Full document
  • Win32
    • Visible
    • Full document: no luck

MicrosoftEdge/WebView2Feedback#529 (comment)

  • WinRT: haven't looked at.
  • Macos
    • Visible
    • Full document: not sure yet

@wusyong
Copy link
Member

wusyong commented May 28, 2021

I updated the snapshot handler on mac and now it can handle the snapshot now.
The next thing to do is to convert UIImage to bytes.

@wusyong
Copy link
Member

wusyong commented May 28, 2021

okay, now basic mac support is also done.
While we are exploring full document on mac, I feel like we should think about the API too.
It only supports PNG at the moment. It feels weird to pass a vector of bytes.
Perhaps the parameter should just be a path to create the file?

@Beanow
Copy link
Member Author

Beanow commented May 28, 2021

Great stuff @wusyong

I feel like we should think about the API too.
It only supports PNG at the moment. It feels weird to pass a vector of bytes.
Perhaps the parameter should just be a path to create the file?

The current API was a dirty hack to get some image from A to B 😄.
For many browser implementations, they offer saving to file, but also copy to clipboard. And some apps may want to do their own processing of the image? Being able to grab some image buffer could have some utility.
So that's why I thought about passing some platform independent image handle to the callback.
Bonus that the platform specific screenshot implementations don't need to include file IO.

@wusyong
Copy link
Member

wusyong commented May 28, 2021

If that's so, I think we could pass an image type we define instead of vector then.
It could provide methods to create file, copy to clipboard and support many other file formats.

@Beanow
Copy link
Member Author

Beanow commented May 28, 2021

Yeah that sounds good to me.
Possibly we could get rid of the cairo png dependency for Linux with that as well at least in the screenshot stage.

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