コード例 #1
0
 /// <summary>
 /// Intersect (bit and) two bitmaps
 /// </summary>
 /// <param name="other">bitmaps which will be intersected with this one</param>
 public void And(Bitmap other) 
 { 
     int[] b1 = bitmap;
     int[] b2 = other.bitmap;
     int len = b1.Length < b2.Length ? b1.Length : b2.Length;
     int i;
     for (i = 0; i < len; i++) { 
         b1[i] &= b2[i];
     }
     while (i < b1.Length) { 
         b1[i++] = 0;
     }
     if (n_bits > other.n_bits) { 
         n_bits = other.n_bits;
     }
 }
コード例 #2
0
 /// <summary>
 /// Excluysive OR (xor) of two bitmaps
 /// </summary>
 /// <param name="other">bitmaps which will be combined with this one</param>
 public void Xor(Bitmap other) 
 { 
     int[] b1 = bitmap;
     int[] b2 = other.bitmap;
     if (b1.Length < b2.Length) { 
         bitmap = new int[b2.Length];
         Array.Copy(b1, 0, bitmap, 0, b1.Length);
         b1 = bitmap;
     }
     int len = b1.Length < b2.Length ? b1.Length : b2.Length;
     for (int i = 0; i < len; i++) { 
         b1[i] ^= b2[i];
     }
     if (n_bits < other.n_bits) { 
         n_bits = other.n_bits;
     }
 }