private void WritePixel(Pixel pixel, Byte[] buffer = null) { // determines pixel offset at [x, y] Int32 offset = fastByteX[pixel.X] + fastY[pixel.Y]; // writes the pixel to a bitmap if (buffer == null) { pixel.WriteRawData(bitmapData.Scan0 + offset); } else // writes the pixel to a buffer { pixel.WriteData(buffer, offset); } }