/// <summary> /// Sets the default shape processing options against the configuration. /// </summary> /// <param name="configuration">The configuration to store default against.</param> /// <param name="options">The default options to use.</param> public static void SetTextOptions(this Configuration configuration, TextOptions options) { configuration.Properties[typeof(TextOptions)] = options; }
/// <summary> /// Sets the default shape processing options against the image processing context. /// </summary> /// <param name="context">The image processing context to store default against.</param> /// <param name="options">The default options to use.</param> /// <returns>The passed in <paramref name="context"/> to allow chaining.</returns> public static IImageProcessingContext SetTextOptions(this IImageProcessingContext context, TextOptions options) { context.Properties[typeof(TextOptions)] = options; return(context); }
/// <summary> /// Draws the text using the supplied text options onto the image filled via the brush. /// </summary> /// <param name="source">The image processing context.</param> /// <param name="textOptions">The text rendering options.</param> /// <param name="text">The text to draw.</param> /// <param name="color">The color.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext DrawText( this IImageProcessingContext source, TextOptions textOptions, string text, Color color) => source.DrawText(textOptions, text, Brushes.Solid(color), null);
/// <summary> /// Draws the text using the given options onto the image outlined via the pen. /// </summary> /// <param name="source">The image processing context.</param> /// <param name="textOptions">The text rendering options.</param> /// <param name="text">The text to draw.</param> /// <param name="pen">The pen used to outline the text.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext DrawText( this IImageProcessingContext source, TextOptions textOptions, string text, IPen pen) => source.DrawText(source.GetDrawingOptions(), textOptions, text, null, pen);
/// <summary> /// Draws the text using the given options onto the image filled via the brush. /// </summary> /// <param name="source">The image processing context.</param> /// <param name="textOptions">The text rendering options.</param> /// <param name="text">The text to draw.</param> /// <param name="brush">The brush used to fill the text.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext DrawText( this IImageProcessingContext source, TextOptions textOptions, string text, IBrush brush) => source.DrawText(source.GetDrawingOptions(), textOptions, text, brush, null);
/// <summary> /// Initializes a new instance of the <see cref="TextGraphicsOptions"/> class. /// </summary> public TextGraphicsOptions() { this.graphicsOptions = new GraphicsOptions(); this.textOptions = new TextOptions(); }