Пример #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);
        }