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)); } } }
internal void UpDateTextImage() { SColor foreground = theme.Foreground; Color systemForeground = Color.FromArgb(foreground.Red, foreground.Green, foreground.Blue); Color systemBackground = Color.FromArgb(0, 0, 0, 0); textImage = DrawText(text, theme.Font, systemForeground, systemBackground); }
public Theme() { SColor background = new SColor(0xff000000); SColor foreground = new SColor(0xffffffff); fontCollection = new PrivateFontCollection(); fontCollection.AddFontFile("resources/fonts/JetBrainsMono-1.0.3/ttf/JetBrainsMono-ExtraBold.ttf"); Build(background, foreground, new Font(fontCollection.Families[0], 16)); }
private void Build(SColor background, SColor foreground, Font font) { this.background = background; this.foreground = foreground; this.font = font; }
public Theme(SColor background, SColor foreground, Font font) { Build(background, foreground, font); }