Exemplo n.º 1
0
        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]));
                    }
                }
            }
        }
Exemplo n.º 2
0
        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]));
            }
            }
            }
        }
Exemplo n.º 3
0
        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]));
                    }
                }
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
        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]));
            }
            }
            }
        }