public void ConstructorOne() { var pixel = new Pixel(3); Assert.AreEqual(0, pixel.Red); Assert.AreEqual(0, pixel.Green); Assert.AreEqual(0, pixel.Blue); }
public void CopyFrom() { var pixel = new Pixel(3); var src = new byte[]{11, 12, 13}; pixel.CopyFrom(src, 0); Assert.AreEqual(src, pixel.Bytes); }
public void ConstructorThree() { var pixel = new Pixel(11, 12, 13); Assert.AreEqual(11, pixel.Red); Assert.AreEqual(12, pixel.Green); Assert.AreEqual(13, pixel.Blue); }
public void ConstructorFor() { var pixel = new Pixel(11, 12, 13, 255); Assert.AreEqual(11, pixel.Red); Assert.AreEqual(12, pixel.Green); Assert.AreEqual(13, pixel.Blue); Assert.AreEqual(255, pixel.Alpha); }
public void ConstructorTwo() { var rgb = new byte[]{11, 12, 13}; var pixel = new Pixel(rgb); Assert.AreEqual(11, pixel.Red); Assert.AreEqual(12, pixel.Green); Assert.AreEqual(13, pixel.Blue); }
public void AddOne() { var pixel1 = new Pixel(11, 12, 13); var pixel2 = new Pixel(1, 1, 1); pixel1.Add(pixel2); Assert.AreEqual(12, pixel1.Red); Assert.AreEqual(13, pixel1.Green); Assert.AreEqual(14, pixel1.Blue); }
public void TestFill() { var color = new Pixel(12, 13, 14); var iterator = new RgnIterator(_drawable, RunMode.Noninteractive); iterator.IterateDest((x, y) => {return color;}); iterator.IterateSrc(pixel => pixel.IsSameColor(color)); }
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 SetBytes() { var rgb = new byte[]{11, 12, 13}; var pixel = new Pixel(3) {Bytes = rgb}; Assert.AreEqual(rgb, pixel.Bytes); }
public void IsSameColor() { var pixel1 = new Pixel(11, 12, 13); var pixel2 = new Pixel(11, 12, 13); var pixel3 = new Pixel(21, 22, 23); Assert.IsTrue(pixel1.IsSameColor(pixel2)); Assert.IsFalse(pixel1.IsSameColor(pixel3)); }
public void GetSetRed() { var pixel = new Pixel(3) {Red = 127}; Assert.AreEqual(127, pixel.Red); }
public void GetSetGreen() { var pixel = new Pixel(3) {Green = 127}; Assert.AreEqual(127, pixel.Green); }
public void GetSetBlue() { var pixel = new Pixel(3) {Blue = 127}; Assert.AreEqual(127, pixel.Blue); }
public void FillTwo() { var pixel = new Pixel(11, 12, 13); pixel.Fill(x => {return x + 1;}); Assert.AreEqual(12, pixel.Red); Assert.AreEqual(13, pixel.Green); Assert.AreEqual(14, pixel.Blue); }
public void FillOne() { var pixel = new Pixel(3); pixel.Fill(() => {return 11;}); Assert.AreEqual(11, pixel.Red); Assert.AreEqual(11, pixel.Green); Assert.AreEqual(11, pixel.Blue); }
public void PutPixel(int x, int y, Pixel pixel) { gimp_pixel_fetcher_put_pixel(_ptr, x, y, pixel.Bytes); }
public void GetSetXY() { var pixel = new Pixel(11, 12, 13) {X = 123, Y = 321}; Assert.AreEqual(123, pixel.X); Assert.AreEqual(321, pixel.Y); }
public void HasAlpha() { var pixel = new Pixel(1); Assert.IsFalse(pixel.HasAlpha); pixel = new Pixel(2); Assert.IsTrue(pixel.HasAlpha); pixel = new Pixel(3); Assert.IsFalse(pixel.HasAlpha); pixel = new Pixel(4); Assert.IsTrue(pixel.HasAlpha); }
public void CopyTo() { var rgb = new byte[]{11, 12, 13}; var pixel = new Pixel(3) {Bytes = rgb}; var dest = new byte[3]; pixel.CopyTo(dest, 0); Assert.AreEqual(dest, pixel.Bytes); }
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])); } } } }