コード例 #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]));
                    }
                }
            }
        }
コード例 #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]));
            }
            }
            }
        }
コード例 #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]));
                    }
                }
            }
        }
コード例 #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);
            }
        }
コード例 #5
0
ファイル: TestDrawable.cs プロジェクト: unhammer/gimp-sharp
        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);
            }
        }
コード例 #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]));
            }
            }
            }
        }