private IIconRenderer GetRenderer(IconFormat format) { IIconRenderer renderer = null; switch (format) { case IconFormat.Gif: case IconFormat.Ico: case IconFormat.Png: renderer = new RasterIconRenderer(); break; //case IconFormat.Svg: // renderer = new VectorIconRenderer(); // break; } renderer.Size = _options.DefaultSize; renderer.FontName = _options.FontName; renderer.Background = _options.DefaultBackground; renderer.Foreground = _options.DefaultForeground; renderer.IconFormat = _options.Format; return(renderer); }
private async Task BuildLetterImage(HttpContext context) { IIconRenderer renderer = GetRenderer(_options.Format); renderer.Text = GetText(context); Byte[] bytes = await renderer.Render(); SetHeaders(context, bytes.Length); await context.Response.Body.WriteAsync(bytes, 0, bytes.Length); }