mirror of
https://github.com/DarthAffe/HPPH.git
synced 2025-12-13 05:48:57 +00:00
Compare commits
No commits in common. "32664a29715582bdf0ebf0f580a40cb50299f369" and "3f4c7abdfe5b61dffb9f359ccf3c1314d6cd10a6" have entirely different histories.
32664a2971
...
3f4c7abdfe
@ -748,7 +748,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void IndexerWrongXBig()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -756,7 +756,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void IndexerWrongYBig()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -764,7 +764,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void IndexerWrongXSmall()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -772,7 +772,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void IndexerWrongYSmall()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -780,7 +780,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageWrongX()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -788,7 +788,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageWrongY()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -796,7 +796,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageWrongWidth()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -804,7 +804,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageWrongHeight()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -812,7 +812,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInvalidSizeWidth()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -820,7 +820,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInvalidSizeHeight()
|
||||
{
|
||||
Image<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -828,7 +828,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInterfaceWrongX()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -836,7 +836,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInterfaceWrongY()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -844,7 +844,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInterfaceWrongWidth()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -852,7 +852,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInterfaceWrongHeight()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -860,7 +860,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInterfaceInvalidSizeWidth()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -868,7 +868,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInterfaceInvalidSizeHeight()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -876,7 +876,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void ColumnsIndexerToBig()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -884,7 +884,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void ColumnsIndexerToSmall()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -892,7 +892,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void RowsIndexerToBig()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -900,7 +900,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void RowsIndexerToSmall()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -908,7 +908,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void ColumnIndexerToBig()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -916,7 +916,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void ColumnIndexerToSmall()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -924,7 +924,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void RowIndexerToBig()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
@ -932,7 +932,7 @@ public class ImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void RowIndexerToSmall()
|
||||
{
|
||||
IImage image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20);
|
||||
|
||||
@ -296,7 +296,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void IndexerWrongXBig()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -304,7 +304,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void IndexerWrongYBig()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -312,7 +312,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void IndexerWrongXSmall()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -320,7 +320,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void IndexerWrongYSmall()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -328,7 +328,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageWrongX()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -336,7 +336,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageWrongY()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -344,7 +344,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageWrongWidth()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -352,7 +352,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageWrongHeight()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -360,7 +360,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInvalidSizeWidth()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -368,7 +368,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SubImageInvalidSizeHeight()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -376,7 +376,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void ColumnsIndexerToBig()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -384,7 +384,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void ColumnsIndexerToSmall()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -392,7 +392,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void RowsIndexerToBig()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -400,7 +400,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void RowsIndexerToSmall()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -408,7 +408,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void ColumnIndexerToBig()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -416,7 +416,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void ColumnIndexerToSmall()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -424,7 +424,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void RowIndexerToBig()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
@ -432,7 +432,7 @@ public class RefImageTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void RowIndexerToSmall()
|
||||
{
|
||||
RefImage<ColorRGB> image = TestDataHelper.CreateTestImage<ColorRGB>(10, 20).AsRefImage();
|
||||
|
||||
@ -33,12 +33,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorBGR> converted = TestDataHelper.CreateTestImage<ColorRGB>(1920, 1080).ConvertTo<ColorBGR>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
Assert.AreEqual(TestDataHelper.GetColorFromLocation<ColorBGR>(x, y), converted[x, y], $"Wrong color at x: {x}, y: {y}");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -69,12 +63,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorARGB> converted = TestDataHelper.CreateTestImage<ColorRGBA>(1920, 1080).ConvertTo<ColorARGB>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
Assert.AreEqual(TestDataHelper.GetColorFromLocation<ColorARGB>(x, y), converted[x, y], $"Wrong color at x: {x}, y: {y}");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -105,12 +93,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorBGRA> converted = TestDataHelper.CreateTestImage<ColorRGBA>(1920, 1080).ConvertTo<ColorBGRA>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
Assert.AreEqual(TestDataHelper.GetColorFromLocation<ColorBGRA>(x, y), converted[x, y], $"Wrong color at x: {x}, y: {y}");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -141,12 +123,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorRGB> converted = TestDataHelper.CreateTestImage<ColorRGBA>(1920, 1080).ConvertTo<ColorRGB>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
Assert.AreEqual(TestDataHelper.GetColorFromLocation<ColorRGB>(x, y), converted[x, y], $"Wrong color at x: {x}, y: {y}");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -177,12 +153,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorBGR> converted = TestDataHelper.CreateTestImage<ColorRGBA>(1920, 1080).ConvertTo<ColorBGR>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
Assert.AreEqual(TestDataHelper.GetColorFromLocation<ColorBGR>(x, y), converted[x, y], $"Wrong color at x: {x}, y: {y}");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -213,20 +183,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorRGBA> converted = TestDataHelper.CreateTestImage<ColorRGB>(1920, 1080).ConvertTo<ColorRGBA>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
{
|
||||
ColorABGR refColor = TestDataHelper.GetColorFromLocation<ColorABGR>(x, y);
|
||||
ColorRGBA color = converted[x, y];
|
||||
|
||||
Assert.AreEqual(255, color.A, $"Wrong A at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.R, color.R, $"Wrong R at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.G, color.G, $"Wrong G at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.B, color.B, $"Wrong B at x: {x}, y: {y}");
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -257,20 +213,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorARGB> converted = TestDataHelper.CreateTestImage<ColorRGB>(1920, 1080).ConvertTo<ColorARGB>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
{
|
||||
ColorABGR refColor = TestDataHelper.GetColorFromLocation<ColorABGR>(x, y);
|
||||
ColorARGB color = converted[x, y];
|
||||
|
||||
Assert.AreEqual(255, color.A, $"Wrong A at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.R, color.R, $"Wrong R at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.G, color.G, $"Wrong G at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.B, color.B, $"Wrong B at x: {x}, y: {y}");
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -301,20 +243,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorBGRA> converted = TestDataHelper.CreateTestImage<ColorRGB>(1920, 1080).ConvertTo<ColorBGRA>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
{
|
||||
ColorABGR refColor = TestDataHelper.GetColorFromLocation<ColorABGR>(x, y);
|
||||
ColorBGRA color = converted[x, y];
|
||||
|
||||
Assert.AreEqual(255, color.A, $"Wrong A at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.R, color.R, $"Wrong R at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.G, color.G, $"Wrong G at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.B, color.B, $"Wrong B at x: {x}, y: {y}");
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -345,20 +273,6 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorABGR> converted = TestDataHelper.CreateTestImage<ColorRGB>(1920, 1080).ConvertTo<ColorABGR>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
{
|
||||
ColorABGR refColor = TestDataHelper.GetColorFromLocation<ColorABGR>(x, y);
|
||||
ColorABGR color = converted[x, y];
|
||||
|
||||
Assert.AreEqual(255, color.A, $"Wrong A at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.R, color.R, $"Wrong R at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.G, color.G, $"Wrong G at x: {x}, y: {y}");
|
||||
Assert.AreEqual(refColor.B, color.B, $"Wrong B at x: {x}, y: {y}");
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -389,11 +303,5 @@ public class ConvertTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IImage<ColorBGR> converted = TestDataHelper.CreateTestImage<ColorRGB>(1920, 1080).ConvertTo<ColorBGR>();
|
||||
|
||||
for (int y = 0; y < converted.Height; y++)
|
||||
for (int x = 0; x < converted.Width; x++)
|
||||
Assert.AreEqual(TestDataHelper.GetColorFromLocation<ColorBGR>(x, y), converted[x, y], $"Wrong color at x: {x}, y: {y}");
|
||||
}
|
||||
}
|
||||
@ -16,14 +16,6 @@ public class SystemDrawingTests
|
||||
IImage image2 = bitmap.ToImage();
|
||||
|
||||
Assert.AreEqual(IColorFormat.BGR, image2.ColorFormat);
|
||||
for (int y = 0; y < image.Height; y++)
|
||||
for (int x = 0; x < image.Width; x++)
|
||||
{
|
||||
Assert.AreEqual(image[x, y].A, image2[x, y].A, $"{x}-{y}");
|
||||
Assert.AreEqual(image[x, y].R, image2[x, y].R, $"{x}-{y}");
|
||||
Assert.AreEqual(image[x, y].G, image2[x, y].G, $"{x}-{y}");
|
||||
Assert.AreEqual(image[x, y].B, image2[x, y].B, $"{x}-{y}");
|
||||
}
|
||||
|
||||
image2 = image2.ConvertTo<ColorRGB>();
|
||||
|
||||
@ -38,14 +30,6 @@ public class SystemDrawingTests
|
||||
IImage image2 = bitmap.ToImage();
|
||||
|
||||
Assert.AreEqual(IColorFormat.BGRA, image2.ColorFormat);
|
||||
for (int y = 0; y < image.Height; y++)
|
||||
for (int x = 0; x < image.Width; x++)
|
||||
{
|
||||
Assert.AreEqual(image[x, y].A, image2[x, y].A);
|
||||
Assert.AreEqual(image[x, y].R, image2[x, y].R);
|
||||
Assert.AreEqual(image[x, y].G, image2[x, y].G);
|
||||
Assert.AreEqual(image[x, y].B, image2[x, y].B);
|
||||
}
|
||||
|
||||
image2 = image2.ConvertTo<ColorRGBA>();
|
||||
|
||||
|
||||
@ -174,14 +174,12 @@ public static unsafe partial class PixelHelper
|
||||
tar += bytesPerVector;
|
||||
}
|
||||
|
||||
Span<byte> buffer = stackalloc byte[missingElements * BPP];
|
||||
for (int i = 0; i < missingElements; i++)
|
||||
{
|
||||
buffer[(i * BPP) + 0] = src[(i * BPP) + maskVector[0]];
|
||||
buffer[(i * BPP) + 1] = src[(i * BPP) + maskVector[1]];
|
||||
buffer[(i * BPP) + 2] = src[(i * BPP) + maskVector[2]];
|
||||
tar[(i * BPP) + 0] = src[(i * BPP) + maskVector[0]];
|
||||
tar[(i * BPP) + 1] = src[(i * BPP) + maskVector[1]];
|
||||
tar[(i * BPP) + 2] = src[(i * BPP) + maskVector[2]];
|
||||
}
|
||||
buffer.CopyTo(new Span<byte>(tar, buffer.Length));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -193,14 +191,12 @@ public static unsafe partial class PixelHelper
|
||||
byte* missingSrc = sourcePtr + (batches * batchSize * BPP);
|
||||
byte* missingTar = targetPtr + (batches * batchSize * BPP);
|
||||
|
||||
Span<byte> buffer = stackalloc byte[missing * BPP];
|
||||
for (int i = 0; i < missing; i++)
|
||||
{
|
||||
buffer[(i * BPP) + 0] = missingSrc[(i * BPP) + maskVector[0]];
|
||||
buffer[(i * BPP) + 1] = missingSrc[(i * BPP) + maskVector[1]];
|
||||
buffer[(i * BPP) + 2] = missingSrc[(i * BPP) + maskVector[2]];
|
||||
missingTar[(i * BPP) + 0] = missingSrc[(i * BPP) + maskVector[0]];
|
||||
missingTar[(i * BPP) + 1] = missingSrc[(i * BPP) + maskVector[1]];
|
||||
missingTar[(i * BPP) + 2] = missingSrc[(i * BPP) + maskVector[2]];
|
||||
}
|
||||
buffer.CopyTo(new Span<byte>(missingTar, buffer.Length));
|
||||
}
|
||||
|
||||
void Process(int index)
|
||||
@ -221,14 +217,12 @@ public static unsafe partial class PixelHelper
|
||||
tar += bytesPerVector;
|
||||
}
|
||||
|
||||
Span<byte> buffer = stackalloc byte[missingElements * BPP];
|
||||
for (int i = 0; i < missingElements; i++)
|
||||
{
|
||||
buffer[(i * BPP) + 0] = src[(i * BPP) + maskVector[0]];
|
||||
buffer[(i * BPP) + 1] = src[(i * BPP) + maskVector[1]];
|
||||
buffer[(i * BPP) + 2] = src[(i * BPP) + maskVector[2]];
|
||||
tar[(i * BPP) + 0] = src[(i * BPP) + maskVector[0]];
|
||||
tar[(i * BPP) + 1] = src[(i * BPP) + maskVector[1]];
|
||||
tar[(i * BPP) + 2] = src[(i * BPP) + maskVector[2]];
|
||||
}
|
||||
buffer.CopyTo(new Span<byte>(tar, buffer.Length));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -298,15 +292,13 @@ public static unsafe partial class PixelHelper
|
||||
tar += bytesPerVector;
|
||||
}
|
||||
|
||||
Span<byte> buffer = stackalloc byte[missingElements * BPP];
|
||||
for (int i = 0; i < missingElements; i++)
|
||||
{
|
||||
buffer[(i * BPP) + 0] = src[(i * BPP) + maskVector[0]];
|
||||
buffer[(i * BPP) + 1] = src[(i * BPP) + maskVector[1]];
|
||||
buffer[(i * BPP) + 2] = src[(i * BPP) + maskVector[2]];
|
||||
buffer[(i * BPP) + 3] = src[(i * BPP) + maskVector[3]];
|
||||
tar[(i * BPP) + 0] = src[(i * BPP) + maskVector[0]];
|
||||
tar[(i * BPP) + 1] = src[(i * BPP) + maskVector[1]];
|
||||
tar[(i * BPP) + 2] = src[(i * BPP) + maskVector[2]];
|
||||
tar[(i * BPP) + 3] = src[(i * BPP) + maskVector[3]];
|
||||
}
|
||||
buffer.CopyTo(new Span<byte>(tar, buffer.Length));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -318,15 +310,13 @@ public static unsafe partial class PixelHelper
|
||||
byte* missingSrc = sourcePtr + (batches * batchSize * BPP);
|
||||
byte* missingTar = targetPtr + (batches * batchSize * BPP);
|
||||
|
||||
Span<byte> buffer = stackalloc byte[missing * BPP];
|
||||
for (int i = 0; i < missing; i++)
|
||||
{
|
||||
buffer[(i * BPP) + 0] = missingSrc[(i * BPP) + maskVector[0]];
|
||||
buffer[(i * BPP) + 1] = missingSrc[(i * BPP) + maskVector[1]];
|
||||
buffer[(i * BPP) + 2] = missingSrc[(i * BPP) + maskVector[2]];
|
||||
buffer[(i * BPP) + 3] = missingSrc[(i * BPP) + maskVector[3]];
|
||||
missingTar[(i * BPP) + 0] = missingSrc[(i * BPP) + maskVector[0]];
|
||||
missingTar[(i * BPP) + 1] = missingSrc[(i * BPP) + maskVector[1]];
|
||||
missingTar[(i * BPP) + 2] = missingSrc[(i * BPP) + maskVector[2]];
|
||||
missingTar[(i * BPP) + 3] = missingSrc[(i * BPP) + maskVector[3]];
|
||||
}
|
||||
buffer.CopyTo(new Span<byte>(missingTar, buffer.Length));
|
||||
}
|
||||
|
||||
void Process(int index)
|
||||
@ -347,20 +337,18 @@ public static unsafe partial class PixelHelper
|
||||
tar += bytesPerVector;
|
||||
}
|
||||
|
||||
Span<byte> buffer = stackalloc byte[missingElements * BPP];
|
||||
for (int i = 0; i < missingElements; i++)
|
||||
{
|
||||
buffer[(i * BPP) + 0] = src[(i * BPP) + maskVector[0]];
|
||||
buffer[(i * BPP) + 1] = src[(i * BPP) + maskVector[1]];
|
||||
buffer[(i * BPP) + 2] = src[(i * BPP) + maskVector[2]];
|
||||
buffer[(i * BPP) + 3] = src[(i * BPP) + maskVector[3]];
|
||||
tar[(i * BPP) + 0] = src[(i * BPP) + maskVector[0]];
|
||||
tar[(i * BPP) + 1] = src[(i * BPP) + maskVector[1]];
|
||||
tar[(i * BPP) + 2] = src[(i * BPP) + maskVector[2]];
|
||||
tar[(i * BPP) + 3] = src[(i * BPP) + maskVector[3]];
|
||||
}
|
||||
buffer.CopyTo(new Span<byte>(tar, buffer.Length));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void ConvertWiden3To4Bytes(ReadOnlySpan<byte> source, Span<byte> target, IColorFormat sourceFormat, IColorFormat targetFormat)
|
||||
{
|
||||
const int SOURCE_BPP = 3;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user