فهرست منبع

Fixed get pixel on texture

flabbet 1 سال پیش
والد
کامیت
38febe83d8

+ 2 - 3
src/PixiEditor.DrawingApi.Core/Texture.cs

@@ -96,9 +96,8 @@ public class Texture : IDisposable
     {
         if (vecI.X < 0 || vecI.X >= Size.X || vecI.Y < 0 || vecI.Y >= Size.Y)
             return null;
-
-        //TODO:
-        return Color.Empty;
+        
+        return Surface.PeekPixels().GetPixelColor(vecI.X, vecI.Y);
     }
 
     public void Dispose()

+ 1 - 1
src/PixiEditor.DrawingApi.Skia/Implementations/SkiaSurfaceImplementation.cs

@@ -31,7 +31,7 @@ namespace PixiEditor.DrawingApi.Skia.Implementations
             SKPixmap pixmap = ManagedInstances[drawingSurface.ObjectPointer].PeekPixels();
             if (pixmap == null)
             {
-                return drawingSurface.Snapshot().PeekPixels();
+                pixmap = (Bitmap.FromImage(drawingSurface.Snapshot()).Native as SKBitmap).PeekPixels();
             }
 
             return _pixmapImplementation.CreateFrom(pixmap);