mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ElectronNET/Electron.NET/pull/394
Author: @zacbre
Created: 5/7/2020
Status: ✅ Merged
Merged: 5/9/2020
Merged by: @GregorBiswanger
Base:
master← Head:master📝 Commits (8)
7daac2dAdd NativeImage support, clipboard image read/write.23015a9Add System.Drawing.Common reference.e67f6c5Merge remote-tracking branch 'upstream/master'e295558Fix MenusController.cs9b27075Add full NativeImage support for Electron.NETfa51cddMerge remote-tracking branch 'upstream/master'b87d7f9Add XML commentsc9f0c43Remove using Clipboard📊 Changes
17 files changed (+915 additions, -110 deletions)
View changed files
📝
ElectronNET.API/Clipboard.cs(+34 -0)📝
ElectronNET.API/ElectronNET.API.csproj(+1 -0)➕
ElectronNET.API/Entities/AddRepresentationOptions.cs(+33 -0)➕
ElectronNET.API/Entities/BitmapOptions.cs(+13 -0)➕
ElectronNET.API/Entities/CreateFromBitmapOptions.cs(+23 -0)➕
ElectronNET.API/Entities/CreateFromBufferOptions.cs(+23 -0)📝
ElectronNET.API/Entities/NativeImage.cs(+446 -102)➕
ElectronNET.API/Entities/NativeImageJsonConverter.cs(+34 -0)➕
ElectronNET.API/Entities/ResizeOptions.cs(+23 -0)➕
ElectronNET.API/Entities/ToBitmapOptions.cs(+13 -0)➕
ElectronNET.API/Entities/ToDataUrlOptions.cs(+13 -0)➕
ElectronNET.API/Entities/ToPNGOptions.cs(+13 -0)📝
ElectronNET.Host/api/clipboard.js(+16 -0)📝
ElectronNET.Host/api/clipboard.ts(+19 -1)📝
ElectronNET.WebApp/Controllers/ClipboardController.cs(+19 -1)📝
ElectronNET.WebApp/Views/Clipboard/Index.cshtml(+188 -6)📝
ElectronNET.WebApp/wwwroot/assets/css/demo.css(+4 -0)📄 Description
This is a long time running of reading documentation and source code within Electron/Chromium itself to see how the image handling is implemented.
The main conversion that happens in this bridge is that we have an array of (float)scaleFactor=>System.Drawing.Image. We serialize these by creating a json object with the scaleFactor as the key, and a base64 encoded representation of the System.Drawing.Image. From there, we send over the serialized data. The javascript picks it up and creates an empty nativeImage. Then, we add all the representations with scale factor to the electron nativeImage.
Everything image manipulation-wise happens on the dotnet side. The only thing this is currently used for with the bridge is clipboard image reading/writing. Hopefully we can add NativeImage support to more things soon, such as Tray Icons, etc.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.