Image display, code optimization

  • Thread starter Thread starter wqaxs36
  • Start date Start date
W

wqaxs36

Guest
Hello,

Have an idea how to optimize this code, I got 0.1 FPS with it


void SceneBuilder()
{
while (true)
{
Thread.Sleep(1);

Bitmap Viewport = new Bitmap((int)Resolution.X, (int)Resolution.Y, (int)Resolution.X * 4, PixelFormat.Format32bppRgb, IntPtr.Zero);

for (int y = 0; y < (int)Resolution.Y; y++)
{
for (int x = 0; x < (int)Resolution.X; x++)
{
Viewport.SetPixel(x, y, Color.FromArgb((byte)x, (byte)x, (byte)x));
}
}

pictureBox1.Image = Viewport;
}
}

Continue reading...
 
Back
Top