PixelArray<BGRAb> CreateAlphaMask(int width, int height) { PixelArray<BGRAb> alphaMask = new PixelArray<BGRAb>(width, height); for (int row = 0; row < height; row++) for (int column = 0; column < width; column++) { BGRAb pixel = alphaMask.RetrievePixel(column, row); float fraction = (float)column / copyBuffer.Width; pixel.Alpha = (byte)(255 - fraction * 255); alphaMask.AssignPixel(column, row, pixel); } return alphaMask; }
unsafe public static PixelArray<Lumb> Copy(PixelArray<Lumb> dst, GDIDIBSection src) { if (dst.Orientation != src.Orientation) return null; int imageSize = src.Width * src.Height; Lumb* dstPointer = (Lumb*)dst.Pixels.ToPointer(); BGRb* srcPointer = (BGRb*)src.Pixels.ToPointer(); for (int y = 0; y < src.Height; y++) for (int x = 0; x < src.Width; x++) { dst.AssignPixel(x, y, new Lumb(NTSCGray.ToLuminance(*srcPointer))); } return dst; }