Ejemplo n.º 1
0
        public override Rectangle getBounds(DisplayObject targetCoordinateSpace, Rectangle result = null)
        {
            if (result == null)
            {
                result = new Rectangle();
            }
            else
            {
                result.setEmpty();
            }
            tempRectangle.setEmpty();
            if (targetCoordinateSpace == null)
            {
                targetCoordinateSpace = this;
            }

            base.getBounds(targetCoordinateSpace, result);
            graphics.getBounds(targetCoordinateSpace, this, tempRectangle);

            result.union(tempRectangle, result);

            var offset = getOffsetFilter();

            result.inflate(offset, offset);

            return(result);
        }
Ejemplo n.º 2
0
        public virtual Rectangle intersection(Rectangle toIntersect)
        {
            Rectangle result = new Rectangle();
            bool      a      = isEmpty();

            if (a ? a : toIntersect.isEmpty())
            {
                result.setEmpty();
                return(result);
            }
            ;
            result.x      = Math.max(x, toIntersect.x);
            result.y      = Math.max(y, toIntersect.y);
            result.width  = Math.min(x + width, toIntersect.x + toIntersect.width) - result.x;
            result.height = Math.min(y + height, toIntersect.y + toIntersect.height) - result.y;
            bool a1 = result.width <= 0;

            if (a1 ? a1 : result.height <= 0)
            {
                result.setEmpty();
            }
            ;
            return(result);
        }