Utilities.Media.SwiftBitmap.operator C# (CSharp) Méthode

operator() public static méthode

Implements the operator &.
public static operator ( ) : SwiftBitmap
Résultat SwiftBitmap
        public static SwiftBitmap operator &(SwiftBitmap Image1, SwiftBitmap Image2)
        {
            Contract.Requires<ArgumentNullException>(Image1 != null, "Image1");
            Contract.Requires<ArgumentNullException>(Image2 != null, "Image2");
            Image1.Lock();
            Image2.Lock();
            var Result = new SwiftBitmap(Image1.Width, Image1.Height);
            Result.Lock();
            Parallel.For(0, Result.Width, x =>
            {
                for (int y = 0; y < Result.Height; ++y)
                {
                    var Pixel1 = Image1.GetPixel(x, y);
                    var Pixel2 = Image2.GetPixel(x, y);
                    Result.SetPixel(x, y,
                        Color.FromArgb(Pixel1.R & Pixel2.R,
                            Pixel1.G & Pixel2.G,
                            Pixel1.B & Pixel2.B));
                }
            });
            Image2.Unlock();
            Image1.Unlock();
            return Result.Unlock();
        }