public void CopyRedToAlpha(RawBitmap src) { if (BPP < 32) { return; } Parallel.For(0, Height, y => { for (int x = 0; x < Width; x++) { int idxsrc = ((x % src.Width) + (y % src.Height) * src.Width) * (src.BPP / 8); int idx = (x + y * Width) * (BPP / 8); if (src.BPP >= 24) { Image[idx + 3] = src.Image[idxsrc + 2]; } else if (src.BPP >= 8) { Image[idx + 3] = src.Image[idxsrc]; } } }); }
public void CopyRedToBlue(RawBitmap src) { Parallel.For(0, Height, y => { for (int x = 0; x < Width; x++) { int idxsrc = ((x % src.Width) + (y % src.Height) * src.Width) * (src.BPP / 8); int idx = (x + y * Width) * (BPP / 8); if (BPP >= 24 && src.BPP >= 24) { Image[idx] = src.Image[idxsrc + 2]; } else if (BPP >= 24 && src.BPP >= 8) { Image[idx] = src.Image[idxsrc]; } else if (BPP >= 8 && src.BPP >= 24) { Image[idx] = src.Image[idxsrc + 2]; } else if (BPP >= 8 && src.BPP >= 8) { Image[idx] = src.Image[idxsrc]; } } }); }
public void CopyRedToGreen(RawBitmap src) { Parallel.For(0, Height, y => { for (int x = 0; x < Width; ++x) { int idxsrc = ((x % src.Width) + (y % src.Height) * src.Width) * 4; int idx = (x + y * Width) * 4; if (BPP >= 16 && src.BPP >= 24) { Image[idx + 1] = src.Image[idxsrc + 2]; } else if (BPP >= 16 && src.BPP >= 8) { Image[idx + 1] = src.Image[idxsrc]; } else if (BPP >= 8 && src.BPP >= 24) { Image[idx] = src.Image[idxsrc + 2]; } else if (BPP >= 8 && src.BPP >= 8) { Image[idx] = src.Image[idxsrc]; } } }); }
public void CopyRedToRed(RawBitmap src) { Parallel.For(0, Height, y => { for (int x = 0; x < Width; x++) { int idxsrc = ((x % src.Width) + (y % src.Height) * src.Width) * 4; int idx = (x + y * Width) * 4; Image[idx + 2] = src.Image[idxsrc + 2]; } }); }