예제 #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));
                }
            }
        }
예제 #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));
                }
            }
        }