Alexandria.Raster.Flush C# (CSharp) Метод

Flush() приватный Метод

Add the dirtied rectangle to the bitmap, then clear the dirtied area.
private Flush ( ) : void
Результат void
        void Flush()
        {
            if (!IsLocked)
                return;
            if (IsDirtied) {
                BitmapData bitmapData = Image.LockBits(new Rectangle(DirtyMinX, DirtyMinY, DirtyMaxX - DirtyMinX + 1, DirtyMaxY - DirtyMinY + 1), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
                int paletteCount = Palette.Count;

                for (int y = 0; y < DirtyMaxY - DirtyMinY + 1; y++) {
                    int rowWidth = DirtyMaxX - DirtyMinX + 1;
                    IntPtr bitmapOutput = bitmapData.Scan0 + bitmapData.Stride * y;
                    int input = (y + DirtyMinY) * Stride + DirtyMinX;

                    for (int output = 0, end = rowWidth * 4; output < end; output += 4, input++) {
                        int index = data[input];
                        Color color = index >= 0 && index < paletteCount ? Palette[index] : Color.Purple;
                        ArgbRow[output + 3] = color.A;
                        ArgbRow[output + 2] = color.R;
                        ArgbRow[output + 1] = color.G;
                        ArgbRow[output + 0] = color.B;
                    }

                    Marshal.Copy(ArgbRow, 0, bitmapOutput, rowWidth * 4);
                }

                Image.UnlockBits(bitmapData);

                //using (Graphics graphics = Graphics.FromImage(Image4x)) {
                Graphics4x.InterpolationMode = InterpolationMode.NearestNeighbor;
                Graphics4x.Clear(Color.Black);
                Graphics4x.DrawImage(Image, new Rectangle(0, 0, Image4x.Width, Image4x.Height));
                //}
            }
            DirtyMinX = DirtyMinY = int.MaxValue;
            DirtyMaxX = DirtyMaxY = 0;
        }