Utilities.Media.SwiftBitmap.SetPixels C# (CSharp) Méthode

SetPixels() public méthode

Sets the pixels starting at the x and y coordinate specified.
public SetPixels ( int x, int y, Color pixels ) : SwiftBitmap
x int The beginning x coordinate
y int The beginning y coordinate
pixels Color The pixels to set
Résultat SwiftBitmap
        public unsafe SwiftBitmap SetPixels(int x, int y, Color[] pixels)
        {
            Contract.Requires<NullReferenceException>(Data != null, "Data");
            if (pixels == null)
                return this;
            byte* TempPointer = DataPointer + (y * Data.Stride) + (x * PixelSize);
            for (int z = 0; z < pixels.Length; ++z)
            {
                if (PixelSize == 3)
                {
                    TempPointer[2] = pixels[z].R;
                    TempPointer[1] = pixels[z].G;
                    TempPointer[0] = pixels[z].B;
                }
                else
                {
                    TempPointer[3] = pixels[z].A;
                    TempPointer[2] = pixels[z].R;
                    TempPointer[1] = pixels[z].G;
                    TempPointer[0] = pixels[z].B;
                }
                TempPointer += PixelSize;
            }
            return this;
        }