[Workspaces] Add encoder parameter to bitmap.save() (#36228)

* [Workspaces] Add encoder parameter to bitmap.save()

* 1 more call fixed

* Move repeated code to the csharp library
This commit is contained in:
Laszlo Nemeth
2024-12-05 20:27:28 +01:00
committed by GitHub
parent f7c9c80ab2
commit a9123bfc23
4 changed files with 30 additions and 4 deletions

View File

@@ -153,7 +153,8 @@ namespace WorkspacesEditor.Utils
}
using MemoryStream memory = new();
previewBitmap.Save(memory, ImageFormat.Png);
WorkspacesCsharpLibrary.DrawHelper.SaveBitmap(previewBitmap, memory);
memory.Position = 0;
BitmapImage bitmapImage = new();
@@ -311,7 +312,9 @@ namespace WorkspacesEditor.Utils
}
using MemoryStream memory = new();
previewBitmap.Save(memory, ImageFormat.Png);
WorkspacesCsharpLibrary.DrawHelper.SaveBitmap(previewBitmap, memory);
memory.Position = 0;
BitmapImage bitmapImage = new();

View File

@@ -94,7 +94,7 @@ namespace WorkspacesEditor.Utils
FileStream fileStream = new FileStream(path, FileMode.CreateNew);
using (var memoryStream = new MemoryStream())
{
icon.Save(memoryStream, ImageFormat.Png);
WorkspacesCsharpLibrary.DrawHelper.SaveBitmap(icon, memoryStream);
BinaryWriter iconWriter = new BinaryWriter(fileStream);
if (fileStream != null && iconWriter != null)