private void RefreshScreen() { var pixels = new Image <Rgba32>(DisplayWidth, DisplayHeight); var x = 0; var y = 0; foreach (var pixel in _rgb) { if (x == DisplayWidth) { x = 0; y++; } var hex = "#" + pixel.ToString("X6"); pixels[x, y] = Rgba32.FromHex(hex); x++; } byte[] bytes; using (var memoryStream = new MemoryStream()) { pixels.SaveAsBmp(memoryStream); pixels.Dispose(); bytes = memoryStream.ToArray(); } OnFrameProduced?.Invoke(this, bytes); _i = 0; }
private void RefreshScreen() { var pixels = new Image <Rgba32>(DisplayWidth, DisplayHeight); var x = 0; var y = 0; foreach (var pixel in _rgb) { if (x == DisplayWidth) { x = 0; y++; } var b = pixel & 255; var g = (pixel >> 8) & 255; var r = (pixel >> 16) & 255; pixels[x, y] = new Rgba32((byte)r, (byte)g, (byte)b, 255); x++; } byte[] bytes; using (var memoryStream = new MemoryStream()) { pixels.SaveAsBmp(memoryStream); pixels.Dispose(); bytes = memoryStream.ToArray(); } OnFrameProduced?.Invoke(this, bytes); _i = 0; }
private void RefreshScreen() { var frame = new GameboyDisplayFrame(_rgb); var bytes = frame.ToBitmap(); OnFrameProduced?.Invoke(this, bytes); _i = 0; }