Exemplo n.º 1
0
        public void ContainsTests()
        {
            // look for 24 bit
            {
                ImageBuffer imageToSearch = new ImageBuffer(150, 150, 24, new BlenderBGR());
                imageToSearch.NewGraphics2D().Circle(new Vector2(100, 100), 3, RGBA_Bytes.Red);
                ImageBuffer circleToFind = new ImageBuffer(10, 10, 24, new BlenderBGR());
                circleToFind.NewGraphics2D().Circle(new Vector2(5, 5), 3, RGBA_Bytes.Red);
                Assert.IsTrue(imageToSearch.Contains(circleToFind), "We should be able to find the circle.");

                ImageBuffer squareToFind = new ImageBuffer(10, 10, 24, new BlenderBGR());
                squareToFind.NewGraphics2D().FillRectangle(4, 4, 8, 8, RGBA_Bytes.Red);
                Assert.IsTrue(!imageToSearch.Contains(squareToFind), "We should be not find a square.");
            }

            // look for 32 bit
            {
                ImageBuffer imageToSearch = new ImageBuffer(150, 150, 32, new BlenderBGRA());
                imageToSearch.NewGraphics2D().Circle(new Vector2(100, 100), 3, RGBA_Bytes.Red);
                ImageBuffer circleToFind = new ImageBuffer(10, 10, 32, new BlenderBGRA());
                circleToFind.NewGraphics2D().Circle(new Vector2(5, 5), 3, RGBA_Bytes.Red);
                Assert.IsTrue(imageToSearch.Contains(circleToFind), "We should be able to find the circle.");

                ImageBuffer squareToFind = new ImageBuffer(10, 10, 32, new BlenderBGRA());
                squareToFind.NewGraphics2D().FillRectangle(4, 4, 8, 8, RGBA_Bytes.Red);
                Assert.IsTrue(!imageToSearch.Contains(squareToFind), "We should be not find a square.");
            }
        }
Exemplo n.º 2
0
		public void ContainsTests()
		{
			// look for 24 bit
			{
				ImageBuffer imageToSearch = new ImageBuffer(150, 150, 24, new BlenderBGR());
				imageToSearch.NewGraphics2D().Circle(new Vector2(100, 100), 3, RGBA_Bytes.Red);
				ImageBuffer circleToFind = new ImageBuffer(10, 10, 24, new BlenderBGR());
				circleToFind.NewGraphics2D().Circle(new Vector2(5, 5), 3, RGBA_Bytes.Red);
				Assert.IsTrue(imageToSearch.Contains(circleToFind), "We should be able to find the circle.");

				ImageBuffer squareToFind = new ImageBuffer(10, 10, 24, new BlenderBGR());
				squareToFind.NewGraphics2D().FillRectangle(4, 4, 8, 8, RGBA_Bytes.Red);
				Assert.IsTrue(!imageToSearch.Contains(squareToFind), "We should be not find a square.");
			}

			// look for 32 bit
			{
				ImageBuffer imageToSearch = new ImageBuffer(150, 150, 32, new BlenderBGRA());
				imageToSearch.NewGraphics2D().Circle(new Vector2(100, 100), 3, RGBA_Bytes.Red);
				ImageBuffer circleToFind = new ImageBuffer(10, 10, 32, new BlenderBGRA());
				circleToFind.NewGraphics2D().Circle(new Vector2(5, 5), 3, RGBA_Bytes.Red);
				Assert.IsTrue(imageToSearch.Contains(circleToFind), "We should be able to find the circle.");

				ImageBuffer squareToFind = new ImageBuffer(10, 10, 32, new BlenderBGRA());
				squareToFind.NewGraphics2D().FillRectangle(4, 4, 8, 8, RGBA_Bytes.Red);
				Assert.IsTrue(!imageToSearch.Contains(squareToFind), "We should be not find a square.");
			}
		}