internal override void Draw(PixelDrawer pixelDrawer) { base.Draw(pixelDrawer); if (shouldUpDateTextImage) { UpDateTextImage(); } int x0 = Position.X + Size.Width / 2 - textImage.Width / 2; int y0 = Position.Y + Size.Height / 2 - textImage.Height / 2; System.Drawing.Color systemColor; Color color; for (int y = 0; y < textImage.Height; y++) { for (int x = 0; x < textImage.Width; x++) { //byte grey = systemColor = textImage.GetPixel(x, y); if (systemColor.A > 0) { color = new Color(systemColor.R, systemColor.G, systemColor.B); pixelDrawer.DrawPixel(x0 + x, y0 + y, color); } //Console.WriteLine("pixel {0}, {1} = {2}", x, y, textImage.GetPixel(x,y)); } } }
internal override void Draw(PixelDrawer pixelDrawer) { base.Draw(pixelDrawer); foreach (Visual visual in visuals) { visual.Draw(pixelDrawer); } }
private void Build(string title, int width, int height, Orientation orientation) { theme = new Theme(); this.title = title; this.size = new Size(width, height); window = new RenderWindow(new VideoMode((uint)width, (uint)height), title, Styles.Close); window.Closed += new EventHandler(OnClosed); VideoMode desktop = VideoMode.DesktopMode; window.Position = new Vector2i((int)desktop.Width / 2 - (int)window.Size.X / 2, (int)desktop.Height / 2 - (int)window.Size.Y / 2); container = new Container(0, 0, width, height, orientation); container.Window = this; texture = new Texture((uint)width, (uint)height); pixels = new byte[width * height * 4]; pixelDrawer = new PixelDrawer(pixels, width, height); sprite = new Sprite(texture); }