Beispiel #1
0
 public Texture MakeTexture(string text)
 {
     var size = helpGfx.MeasureString(text, Font).ToSize();
     var bitmap = new Bitmap(size.Width, size.Height);
     var gfx = Graphics.FromImage(bitmap);
     gfx.Clear(System.Drawing.Color.FromArgb(0, 0xff, 0xff, 0xff));
     gfx.TextRenderingHint = Smooth ?
         System.Drawing.Text.TextRenderingHint.AntiAlias :
         System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
     gfx.DrawString(text, Font, Brushes.White, 0, 0);
     var tex = new Texture(1, 1, Smooth);
     tex.Set(bitmap);
     return tex;
 }
Beispiel #2
0
 public Texture Copy()
 {
     var tex = new Texture(this.Smooth);
     tex.Set(this.ToBitmap());
     return tex;
 }