public void Run() { var screenBitmap = new Bitmap(_screen.Screen, 800, 600, 800*4); var desktop = new BitmapRenderer(screenBitmap); var screen = new BitmapRenderer(screenBitmap); var root = new Element(); root.Add(new Box(screenBitmap.Area, 0xff404040)); while (_power.On) { screen.Draw(Cursor, new Point(_mouse.X, _mouse.Y)); //_screen.Screen[_mouse.X + _mouse.Y * 320] = 255; _screen.VRetrace(); root.Render(desktop); foreach (Elements.App app in _apps) { foreach (Window window in app.Windows) { window.Render(desktop); } } } }
public unsafe void Draw(Bitmap bitmap, Point p) { fixed (byte* source = bitmap.Pixels) fixed (byte* target = _bitmap.Pixels) { for (int y = 0; y < bitmap.Height; y++) { var source_row = (uint*)(source + bitmap.Index(0, y)); var target_row = (uint*)(target + _bitmap.Index((int)p.X, (int)(p.Y + y))); int c = 0; for (int x = 0; x < bitmap.Width; x++) { target_row[c] = source_row[c]; c++; } } } }
public BitmapRenderer(Bitmap target) { _bitmap = target; _target = Source; _clip = Source; }