예제 #1
0
        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];
                    }
                }
            });
        }
예제 #2
0
        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];
                    }
                }
            });
        }
예제 #3
0
        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];
                    }
                }
            });
        }
예제 #4
0
        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];
                }
            });
        }