Plain Text
View as MarkdownDemonstrates how to use plain text.
Code Snippet
using (var bitmap = new Bitmap(400, 250, PixelFormat.Format24bppRgb, new RgbColor(255, 255, 255, 255)))
using (var graphics = bitmap.GetGraphics())
{
var brush = new SolidBrush(new RgbColor(0x41, 0x41, 0x41));
var texts = new PlainText[]
{
new PlainText("Horizontal text\nwith two lines", graphics.CreateFont("Times New Roman", 22f), brush)
{
Position = new System.Drawing.PointF(50f, 38f),
},
new PlainText("Vertical", graphics.CreateFont("Arial", 24f), brush)
{
Vertical = true,
Position = new System.Drawing.PointF(20f, 10f),
Effect = new Glow(new RgbColor(0x66, 0xaf, 0xe9), 5),
},
};
foreach (var text in texts)
{
graphics.DrawEllipse(new Pen(RgbColor.Red, 2), text.Position.X - 1, text.Position.Y - 1, 2, 2);
graphics.DrawText(text);
}
bitmap.Save("PlainText.png");
}
Output
PlainText.png
Used APIs
- Aurigma.GraphicsMill.Bitmap.GetGraphics
- Aurigma.GraphicsMill.Drawing.Effects.Glow
- Aurigma.GraphicsMill.Drawing.Graphics.CreateFont(String,Single)
- Aurigma.GraphicsMill.Drawing.Graphics.DrawEllipse(Pen,Single,Single,Single,Single)
- Aurigma.GraphicsMill.Drawing.Graphics.DrawText(Text)
- Aurigma.GraphicsMill.Drawing.Pen
- Aurigma.GraphicsMill.Drawing.PlainText
- Aurigma.GraphicsMill.Drawing.PlainText.Position
- Aurigma.GraphicsMill.Drawing.PlainText.Vertical
- Aurigma.GraphicsMill.Drawing.SolidBrush
- Aurigma.GraphicsMill.Drawing.Text.Effect