Example #1
0
 /// <summary>
 /// Draw the specified text to a fixed-sized Bitmap
 /// (text/font will be sized to fit the specified dimensions)
 /// </summary>
 /// <param name="text">The text to draw.</param>
 /// <param name="options">The <see cref="TextToBmpOptions"/> options value containing the parameters for the output.</param>
 /// <returns>A Bitmap</returns>
 /// <remarks>Can be used as an extension method.</remarks>
 public static Bitmap DrawTextToFixedBitmap(this string text, TextToBmpOptions options)
 {
     if (options == default)
     {
         options = new TextToBmpOptions();
     }
     return(DrawTextToFixedBitmap(text, options.FontName, options.Width, options.Height, options.FontStyle, options.Background, options.Foreground));
 }
Example #2
0
 /// <summary>
 /// Draw the specified text to a fixed-sized Bitmap
 /// (text/font will be sized to fit the specified dimensions)
 /// </summary>
 /// <param name="value">The <see cref="Mdl2Chars"/> value representing teh glyph to draw.</param>
 /// <param name="options">The <see cref="TextToBmpOptions"/> options value containing the parameters for the output.</param>
 /// <returns>A Bitmap</returns>
 /// <remarks>Can be used as an extension method.</remarks>
 public static Bitmap DrawMdl2ToBitmap(this Mdl2Chars value, TextToBmpOptions options)
 {
     // Make sure the MDL2 Assets font is used.
     if (!options.FontName.Equals(TextToBmpOptions.MDL2_FONT_NAME))
     {
         options.FontName = TextToBmpOptions.MDL2_FONT_NAME;
     }
     return(((char)value).ToString().DrawTextToFixedBitmap(options));
 }