BodyTetrisWrapper.ImageUtils.BlackOut C# (CSharp) Method

BlackOut() public static method

public static BlackOut ( byte pixels, int shape, int orientation, int w, int h ) : void
pixels byte
shape int
orientation int
w int
h int
return void
        public static void BlackOut(byte[] pixels, int shape, int orientation, int w, int h)
        {
            //Blacks out the pixels that aren't part of the shape.

            for (int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                {
                    if (!Tetronimos.IsIn(shape, orientation, x, y, w, h))
                    {
                        //blacken pixel
                        int index = x + y * w;

                        pixels[3 * index] = 0;
                        pixels[3 * index + 1] = 0;
                        pixels[3 * index + 2] = 0;
                    }
                }
            }
        }