|
@@ -2,7 +2,9 @@
|
|
|
using System.IO;
|
|
|
using ChunkyImageLib;
|
|
|
using ChunkyImageLib.DataHolders;
|
|
|
+using PixiEditor.DrawingApi.Core.ColorsImpl;
|
|
|
using PixiEditor.DrawingApi.Core.Numerics;
|
|
|
+using PixiEditor.DrawingApi.Core.Surface;
|
|
|
using SkiaSharp;
|
|
|
using Xunit;
|
|
|
|
|
@@ -25,30 +27,30 @@ public class ChunkyImageTests
|
|
|
public void LoadDemo()
|
|
|
{
|
|
|
var path = @"C:\Users\egor0\Desktop\SpazzS1.png";
|
|
|
- ImportImage(path, new VecI(5,5));
|
|
|
+ ImportImage(path, new VecI(5, 5));
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
|
public void Dispose_ComplexImage_ReturnsAllChunks()
|
|
|
{
|
|
|
ChunkyImage image = new ChunkyImage(new(ChunkyImage.FullChunkSize, ChunkyImage.FullChunkSize));
|
|
|
- image.EnqueueDrawRectangle(new(new(5, 5), new(80, 80), 0, 2, SKColors.AliceBlue, SKColors.Snow));
|
|
|
+ image.EnqueueDrawRectangle(new(new(5, 5), new(80, 80), 0, 2, Colors.AliceBlue, Colors.Snow));
|
|
|
using (Chunk target = Chunk.Create())
|
|
|
{
|
|
|
image.DrawMostUpToDateChunkOn(new(0, 0), ChunkResolution.Full, target.Surface.DrawingSurface, VecI.Zero);
|
|
|
image.CancelChanges();
|
|
|
image.EnqueueResize(new(ChunkyImage.FullChunkSize * 4, ChunkyImage.FullChunkSize * 4));
|
|
|
- image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, SKColors.AliceBlue, SKColors.Snow, SKBlendMode.Multiply));
|
|
|
+ image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, Colors.AliceBlue, Colors.Snow, BlendMode.Multiply));
|
|
|
image.CommitChanges();
|
|
|
- image.SetBlendMode(SKBlendMode.Overlay);
|
|
|
- image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, SKColors.AliceBlue, SKColors.Snow, SKBlendMode.Multiply));
|
|
|
- image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, SKColors.AliceBlue, SKColors.Snow));
|
|
|
+ image.SetBlendMode(BlendMode.Overlay);
|
|
|
+ image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, Colors.AliceBlue, Colors.Snow, BlendMode.Multiply));
|
|
|
+ image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, Colors.AliceBlue, Colors.Snow));
|
|
|
image.CommitChanges();
|
|
|
- image.SetBlendMode(SKBlendMode.Screen);
|
|
|
- image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, SKColors.AliceBlue, SKColors.Snow));
|
|
|
+ image.SetBlendMode(BlendMode.Screen);
|
|
|
+ image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, Colors.AliceBlue, Colors.Snow));
|
|
|
image.CancelChanges();
|
|
|
- image.SetBlendMode(SKBlendMode.SrcOver);
|
|
|
- image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, SKColors.AliceBlue, SKColors.Snow));
|
|
|
+ image.SetBlendMode(BlendMode.SrcOver);
|
|
|
+ image.EnqueueDrawRectangle(new(VecD.Zero, image.CommittedSize, 0, 2, Colors.AliceBlue, Colors.Snow));
|
|
|
}
|
|
|
image.Dispose();
|
|
|
|
|
@@ -61,9 +63,9 @@ public class ChunkyImageTests
|
|
|
const int chunkSize = ChunkyImage.FullChunkSize;
|
|
|
ChunkyImage image = new ChunkyImage(new VecI(chunkSize * 2));
|
|
|
image.EnqueueDrawRectangle
|
|
|
- (new ShapeData(new VecD(chunkSize), new VecD(chunkSize * 2), 0, 0, SKColors.Transparent, SKColors.Red));
|
|
|
+ (new ShapeData(new VecD(chunkSize), new VecD(chunkSize * 2), 0, 0, Colors.Transparent, Colors.Red));
|
|
|
image.CommitChanges();
|
|
|
- Assert.Equal(SKColors.Red, image.GetCommittedPixel(new VecI(chunkSize + chunkSize / 2)));
|
|
|
+ Assert.Equal(Colors.Red, image.GetCommittedPixel(new VecI(chunkSize + chunkSize / 2)));
|
|
|
image.Dispose();
|
|
|
Assert.Equal(0, Chunk.ChunkCounter);
|
|
|
}
|
|
@@ -74,8 +76,8 @@ public class ChunkyImageTests
|
|
|
const int chunkSize = ChunkyImage.FullChunkSize;
|
|
|
ChunkyImage image = new ChunkyImage(new VecI(chunkSize * 2));
|
|
|
image.EnqueueDrawRectangle
|
|
|
- (new ShapeData(new VecD(chunkSize), new VecD(chunkSize * 2), 0, 0, SKColors.Transparent, SKColors.Red));
|
|
|
- Assert.Equal(SKColors.Red, image.GetMostUpToDatePixel(new VecI(chunkSize + chunkSize / 2)));
|
|
|
+ (new ShapeData(new VecD(chunkSize), new VecD(chunkSize * 2), 0, 0, Colors.Transparent, Colors.Red));
|
|
|
+ Assert.Equal(Colors.Red, image.GetMostUpToDatePixel(new VecI(chunkSize + chunkSize / 2)));
|
|
|
image.Dispose();
|
|
|
Assert.Equal(0, Chunk.ChunkCounter);
|
|
|
}
|
|
@@ -86,17 +88,17 @@ public class ChunkyImageTests
|
|
|
const int chunkSize = ChunkyImage.FullChunkSize;
|
|
|
ChunkyImage image = new ChunkyImage(new VecI(chunkSize * 2));
|
|
|
image.EnqueueDrawRectangle
|
|
|
- (new ShapeData(new VecD(chunkSize), new VecD(chunkSize * 2), 0, 0, SKColors.Transparent, SKColors.Red));
|
|
|
+ (new ShapeData(new VecD(chunkSize), new VecD(chunkSize * 2), 0, 0, Colors.Transparent, Colors.Red));
|
|
|
image.CommitChanges();
|
|
|
- image.SetBlendMode(SKBlendMode.SrcOver);
|
|
|
+ image.SetBlendMode(BlendMode.SrcOver);
|
|
|
image.EnqueueDrawRectangle(new ShapeData(
|
|
|
new VecD(chunkSize),
|
|
|
new VecD(chunkSize * 2),
|
|
|
0,
|
|
|
0,
|
|
|
- SKColors.Transparent,
|
|
|
- new SKColor(0, 255, 0, 128)));
|
|
|
- Assert.Equal(new SKColor(127, 128, 0), image.GetMostUpToDatePixel(new VecI(chunkSize + chunkSize / 2)));
|
|
|
+ Colors.Transparent,
|
|
|
+ new Color(0, 255, 0, 128)));
|
|
|
+ Assert.Equal(new Color(127, 128, 0), image.GetMostUpToDatePixel(new VecI(chunkSize + chunkSize / 2)));
|
|
|
image.Dispose();
|
|
|
Assert.Equal(0, Chunk.ChunkCounter);
|
|
|
}
|
|
@@ -111,8 +113,8 @@ public class ChunkyImageTests
|
|
|
new VecD(chunkSize * 10),
|
|
|
0,
|
|
|
0,
|
|
|
- SKColors.Transparent,
|
|
|
- SKColors.Red));
|
|
|
+ Colors.Transparent,
|
|
|
+ Colors.Red));
|
|
|
image.CommitChanges();
|
|
|
Assert.Collection(
|
|
|
image.FindAllChunks(),
|