예제 #1
0
        public Bitmap Union(Bitmap bitmap, Location location)
        {
            var newValues = new bool[this.Width, this.Height];

            // first, copy in to a mutable array
            foreach (var x in HorizontalRange)
                foreach (var y in VerticalRange)
                    newValues[x, y] = this[x, y];

            // Second, insert the other bitmal
            foreach (var x in bitmap.HorizontalRange)
                foreach (var y in bitmap.VerticalRange)
                    newValues[x + location.X, y + location.Y] |= bitmap[x, y];

            return new Bitmap(newValues);
        }
예제 #2
0
        internal Bitmap Intersection(Bitmap bitmap, Location location)
        {
            var newValues = new bool[this.Width, this.Height];

            foreach (var x in bitmap.HorizontalRange)
                foreach (var y in bitmap.VerticalRange)
                    newValues[x + location.X, y + location.Y] = bitmap[x, y] && this[x + location.X, y + location.Y];

            return new Bitmap(newValues);
        }