-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Win32 | Android | Browser | iOS - Support reading from and copying images to clipboard #19930
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
base: master
Are you sure you want to change the base?
Conversation
|
You can test this PR using the following package version. |
|
is this feature going to be supported in the other platforms? (macOS, Linux ...) |
Linux, Mac and iOS will be supported |
|
You can test this PR using the following package version. |
bcae4be to
8be37e9
Compare
|
Added Browser support |
|
You can test this PR using the following package version. |
Do we attempt that before or after advertising DataFormat.Bitmap being present? |
src/Windows/Avalonia.Win32/OleDataObjectToDataTransferWrapper.cs
Outdated
Show resolved
Hide resolved
src/Windows/Avalonia.Win32/OleDataObjectToDataTransferWrapper.cs
Outdated
Show resolved
Hide resolved
src/Browser/Avalonia.Browser/BrowserClipboardDataTransferItem.cs
Outdated
Show resolved
Hide resolved
src/Browser/Avalonia.Browser/BrowserClipboardDataTransferItem.cs
Outdated
Show resolved
Hide resolved
src/Android/Avalonia.Android/Platform/ClipDataToDataTransferWrapper.cs
Outdated
Show resolved
Hide resolved
When |
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
905c904 to
89a342b
Compare
What does the pull request do?
This PR allows users to directly get a
Bitmapbitmap from clipboard if a supported image format is available. This is in addition to the currently supported text and file formats. This only supports images copied to clipboard directly, and not from a file in disk. Depending on platform, we choose the most suitable format among the available formats as the default Image data format.On Windows, the priority is; CF_BITMAP > CF_DIB > png > jpg.
On Android, we attempt to load the file in clipboard as a Bitmap, since apps can decide not to use full mimetypes when copying files to clipboard.
This pr also supports copying a Bitmap to clipboard. This is currently supported on Windows
What is the current behavior?
Users can't retrieve image data formats from clipboard on some platforms without creating a DataFormat of byte matching the system type of the image data. The process would normally be like this
DataFormat<byte>with the format name and a internal hidden AppIdThe format names are also platform specific, so each platform would need to have their own image loading logic.
What is the updated/expected behavior with this PR?
Common image formats that we know skia supports on all platforms can now be retrieved directly as a
Bitmapinstance.For example, retrieving a image in clipboard can be easily done like this;
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues