|
|
@@ -2,8 +2,10 @@
|
|
|
using ChunkyImageLib;
|
|
|
using PixiEditor.Helpers.Extensions;
|
|
|
using Drawie.Backend.Core;
|
|
|
+using Drawie.Backend.Core.Bridge;
|
|
|
using Drawie.Backend.Core.Numerics;
|
|
|
using Drawie.Backend.Core.Surfaces.ImageData;
|
|
|
+using Drawie.Interop.Avalonia.Core;
|
|
|
using Drawie.Numerics;
|
|
|
|
|
|
namespace PixiEditor.Helpers;
|
|
|
@@ -38,6 +40,7 @@ public static class SurfaceHelpers
|
|
|
|
|
|
public static unsafe byte[] ToByteArray(this Surface surface, ColorType colorType = ColorType.Bgra8888, AlphaType alphaType = AlphaType.Premul, ColorSpace colorSpace = null)
|
|
|
{
|
|
|
+ using var ctx = IDrawieInteropContext.Current.EnsureContext();
|
|
|
int width = surface.Size.X;
|
|
|
int height = surface.Size.Y;
|
|
|
var imageInfo = new ImageInfo(width, height, colorType, alphaType, colorSpace == null ? surface.ImageInfo.ColorSpace : colorSpace);
|