|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.Native.Interop; |
|
|
|
@ -39,9 +40,22 @@ namespace Avalonia.Native |
|
|
|
return new AvaloniaNativeCursor( cursor ); |
|
|
|
} |
|
|
|
|
|
|
|
public ICursorImpl CreateCursor(IBitmapImpl cursor, PixelPoint hotSpot) |
|
|
|
public unsafe ICursorImpl CreateCursor(IBitmapImpl cursor, PixelPoint hotSpot) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
using(var ms = new MemoryStream()) |
|
|
|
{ |
|
|
|
cursor.Save(ms); |
|
|
|
|
|
|
|
var imageData = ms.ToArray(); |
|
|
|
|
|
|
|
fixed(void* ptr = imageData) |
|
|
|
{ |
|
|
|
var avnCursor = _native.CreateCustomCursor(ptr, new IntPtr(imageData.Length), |
|
|
|
new AvnPixelSize { Width = hotSpot.X, Height = hotSpot.Y }); |
|
|
|
|
|
|
|
return new AvaloniaNativeCursor(avnCursor); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|