Example #1
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 PointF(x, y)));
        }
Example #2
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, new Point(0, 0));

            return(targetMask[xToTest][yToTest]);
        }
Example #3
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);
        }
Example #4
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);


            Vector2        bottomLeft  = new Vector2(projectionLeft, projectionBottom);
            Vector2        bottomRight = new Vector2(projectionLeft + width * Math.Abs(scaleX), projectionBottom);
            Vector2        topLeft     = new Vector2(projectionLeft, projectionBottom + height * Math.Abs(scaleY));
            Vector2        topRight    = new Vector2(projectionLeft + width * Math.Abs(scaleX), projectionBottom + height * Math.Abs(scaleY));
            AGSBoundingBox square      = new AGSBoundingBox(bottomLeft, bottomRight, topLeft, topRight);

            return(mask.IsMasked(new PointF(x, y), square, scaleX, scaleY));
        }
Example #5
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));
        }