Exemplo n.º 1
0
        internal protected override unsafe void Process(Bitmap bmp, RGBAColor *p_top, RGBAColor *p_dest, Rectangle region)
        {
            if (bmp.Size != BaseLayer.Size)
            {
                throw new ArgumentException($"The top layer ('{nameof(bmp)}') must have the same dimensions as the base layer. The required dimensions are: {BaseLayer.Width}x{BaseLayer.Height}.", nameof(bmp));
            }

            int[]        indices = GetIndices(BaseLayer, region);
            BitmapLocker lck     = BaseLayer;
            BlendMode    mode    = Mode;

            lck.LockRGBAPixels((p_base, w, h) => Parallel.For(0, indices.Length, i =>
            {
                int idx = indices[i];

                p_dest[idx] = RGBAColor.Blend(p_base[idx], p_top[idx], mode);
            }));
        }
Exemplo n.º 2
0
 private protected sealed override RGBAColor ProcessCoordinate(int x, int y, int w, int h, RGBAColor source) =>
 RGBAColor.Blend(source, ProcessCoordinate(x, y, w, h), Blending);