Ejemplo n.º 1
0
		public void AreaBoundsTest(int width, int height, 
			int expectedMinX, int expectedMaxX, int expectedMinY, int expectedMaxY,
			params int[] pointsInMask)
		{
			bool[][] array = GetArray(width, height, true, pointsInMask);

			AGSMask mask = new AGSMask(array, null);

			Assert.AreEqual(expectedMinX, mask.MinX);
			Assert.AreEqual(expectedMaxX, mask.MaxX);
			Assert.AreEqual(expectedMinY, mask.MinY);
			Assert.AreEqual(expectedMaxY, mask.MaxY);
		}
Ejemplo n.º 2
0
        public IMask ToItem(AGSSerializationContext context)
        {
            bool[][] array = new bool[MaskWidth][];
            for (int x = 0; x < MaskWidth; x++)
            {
                array[x] = new bool[MaskHeight];
                for (int y = 0; y < MaskHeight; y++)
                {
                    array[x][y] = Mask[y * MaskWidth + x];
                }
            }

            AGSMask mask = new AGSMask(array, DebugObject.ToItem(context));

            return(mask);
        }
Ejemplo n.º 3
0
		public bool IsMasked_WithProjection_Test(int width, int height, float x, float y, float projectionLeft, float projectionBottom, float scaleX, float scaleY, params int[] pointsInMask)
		{
			bool[][] array = GetArray(width, height, true, pointsInMask);
			AGSMask mask = new AGSMask(array, null);
			Mock<ISquare> square = new Mock<ISquare> ();

			AGS.API.PointF bottomLeft = new AGS.API.PointF (projectionLeft, projectionBottom);
			AGS.API.PointF bottomRight = new AGS.API.PointF (projectionLeft + width * Math.Abs(scaleX), projectionBottom);
			AGS.API.PointF topLeft = new AGS.API.PointF (projectionLeft, projectionBottom + height * Math.Abs(scaleY));
			AGS.API.PointF topRight = new AGS.API.PointF (projectionLeft + width * Math.Abs(scaleX), projectionBottom + height * Math.Abs(scaleY));
			square.Setup(s => s.BottomLeft).Returns(bottomLeft);
			square.Setup(s => s.BottomRight).Returns(bottomRight);
			square.Setup(s => s.TopLeft).Returns(topLeft);
			square.Setup(s => s.TopRight).Returns(topRight);

			return mask.IsMasked(new AGS.API.PointF (x, y), square.Object, scaleX, scaleY);
		}
Ejemplo n.º 4
0
		public bool IsMaskedTest(int width, int height, float x, float y, params int[] pointsInMask)
		{
			bool[][] array = GetArray(width, height, true, pointsInMask);
			AGSMask mask = new AGSMask(array, null);
			return mask.IsMasked(new AGS.API.PointF (x, y));
		}
Ejemplo n.º 5
0
		public bool ApplyToMaskTest(int width, int height, int xToTest, int yToTest, params int[] pointsInMask)
		{
			bool[][] targetMask = GetArray(width, height, true, 0,0, 1,1, 2,2);
			bool[][] sourceMask = GetArray(width, height, true, pointsInMask);
			AGSMask mask = new AGSMask (sourceMask, null);
			mask.ApplyToMask(targetMask);

			return targetMask[xToTest][yToTest];
		}