Exemplo n.º 1
0
        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));
                }
            }
        }
Exemplo n.º 2
0
        internal override void Draw(PixelDrawer pixelDrawer)
        {
            base.Draw(pixelDrawer);
            int x0 = position.x;

            if (centerHorizontally)
            {
                x0 += size.width / 2 - textImage.Width / 2;
            }
            int    y0 = position.y + size.height / 2 - textImage.Height / 2;
            Color  systemColor;
            SColor color;

            for (int y = 0; y < textImage.Height; y++)
            {
                for (int x = 0; x < textImage.Width; x++)
                {
                    systemColor = textImage.GetPixel(x, y);
                    if (systemColor.A > 0)
                    {
                        //Console.WriteLine(systemColor);
                        color = new SColor
                                (
                            (byte)(systemColor.R * systemColor.A / 255),
                            (byte)(systemColor.G * systemColor.A / 255),
                            (byte)(systemColor.B * systemColor.A / 255)
                                );
                        //Console.WriteLine(color);
                        pixelDrawer.DrawPixel(x0 + x, y0 + y, color);
                    }
                    //Console.WriteLine("pixel {0}, {1} = {2}", x, y, textImage.GetPixel(x,y));
                }
            }
        }
Exemplo n.º 3
0
 internal override void Draw(PixelDrawer pixelDrawer)
 {
     base.Draw(pixelDrawer);
     foreach (Visual visual in visuals)
     {
         visual.Draw(pixelDrawer);
     }
 }
Exemplo n.º 4
0
 internal override void Draw(PixelDrawer pixelDrawer)
 {
     base.Draw(pixelDrawer);
     foreach (Widget widget in widgets)
     {
         widget.Draw(pixelDrawer);
     }
 }
Exemplo n.º 5
0
 internal override void Draw(PixelDrawer pixelDrawer)
 {
     base.Draw(pixelDrawer);
     horizontalScrollBar.Draw(pixelDrawer);
     verticalScrollBar.Draw(pixelDrawer);
     pixelDrawer.DrawRectangle(new Position(position.x + constrainedSize.width, position.y + constrainedSize.height), new Size(16, 16), theme.Foreground);
     pixelDrawer.constrainedPosition = position;
     pixelDrawer.constrainedSize     = constrainedSize;
     widget.Draw(pixelDrawer);
     pixelDrawer.constrainedPosition = null;
     pixelDrawer.constrainedSize     = null;
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 internal override void Draw(PixelDrawer pixelDrawer)
 {
     base.Draw(pixelDrawer);
     //Console.WriteLine("scrollPosition {0}", scrollPosition);
     pixelDrawer.DrawRectangle(scrollPosition, scrollSize, theme.Foreground);
 }