public void PutGetPixel() { // Fill with some color var foreground = new RGB(22, 55, 77); Context.Push(); Context.Foreground = foreground; _drawable.Fill(FillType.Foreground); Context.Pop(); var expected = new Pixel(33, 66, 99); // Fill with different color, using shadow using (var pf = new PixelFetcher(_drawable, true)) { for (int y = 0; y < _height; y++) { for (int x = 0; x < _width; x++) { pf[y, x] = expected; } } } // check that original hasn't changed using (var pf = new PixelFetcher(_drawable, false)) { for (int y = 0; y < _height; y++) { for (int x = 0; x < _width; x++) { Assert.AreEqual(foreground, pf[y, x].Color); } } } _drawable.MergeShadow(true); // and now the orginal should be changed using (var pf = new PixelFetcher(_drawable, false)) { for (int y = 0; y < _height; y++) { for (int x = 0; x < _width; x++) { Assert.IsTrue(expected.IsSameColor(pf[y, x])); } } } }
public void This() { using (var pf = new PixelFetcher(_drawable, false)) { var expected = new Pixel(33, 66, 99); for (int y = 0; y < _height; y++) { for (int x = 0; x < _width; x++) { pf[y, x] = expected; Assert.IsTrue(expected.IsSameColor(pf[y, x])); } } } }
public void Fill() { // Fill with some color RGB foreground = new RGB(22, 55, 77); Context.Push(); Context.Foreground = foreground; _drawable.Fill(FillType.Foreground); Context.Pop(); using (PixelFetcher pf = new PixelFetcher(_drawable, false)) { Pixel pixel = pf[_height / 2, _width / 2]; Assert.AreEqual(foreground, pixel.Color); } }