Win32 | Android | Browser - Support reading images from clipboard #19930
+184
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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; png > jpg > bmp.
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.
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