public void GetPixelFastNoPixelFormat() { var testBitmap = TestingHelper.GetTestBitmap(); using (var testBitmapUnlocked = TestingHelper.GetTestBitmap()) { using (var fast = new FastBitmapPixelProvider(testBitmap, true)) { for (int x = 0; x < testBitmap.Width; ++x) { for (int y = 0; y < testBitmap.Height; ++y) { var expected = NativeColor.FromDrawingColor(testBitmapUnlocked.GetPixel(x, y)); var actual = fast.GetPixel(x, y); AssertEx.AreEqual<NativeColor>(expected, actual); } } } } }
public void SetPixelFast() { var testBitmap = TestingHelper.GetTestBitmap(); using (var testBitmapUnlocked = TestingHelper.GetTestBitmap()) { using (var fast = new FastBitmapPixelProvider(testBitmap, true)) { for (int x = 0; x < testBitmap.Width; ++x) { for (int y = 0; y < testBitmap.Height; ++y) { NativeColor expected = TestingHelper.GetRandomColor(); testBitmapUnlocked.SetPixel(x, y, expected.ToDrawingColor()); fast.SetPixel(x, y, expected); var actualNative = NativeColor.FromDrawingColor(testBitmapUnlocked.GetPixel(x, y)); var actualFast = fast.GetPixel(x, y); AssertEx.AreEqual<NativeColor>(expected, actualNative); AssertEx.AreEqual<NativeColor>(expected, actualFast); } } } } }
private void SwapPixelInternal() { using (var testBitmap = TestingHelper.GetTestBitmap()) using (var fast = new FastBitmapPixelProvider(testBitmap, true)) { for (int x = 0; x < testBitmap.Width; ++x) { for (int y = 0; y < testBitmap.Height; ++y) { var expected = fast.GetPixel(x, y); var actual = fast.SwapPixel(x, y, TestingHelper.GetRandomColor()); AssertEx.AreEqual<NativeColor>(expected, actual); } } } }