//// This code is part of Document Solutions for Imaging demos.// Copyright (c) MESCIUS inc. All rights reserved.//using System.IO;using System.Drawing;using GrapeCity.Documents.Drawing;using GrapeCity.Documents.Text;using GrapeCity.Documents.Imaging;using GCTEXT = GrapeCity.Documents.Text;
namespace DsImagingWeb.Demos{ // A simple program drawing the "Hello, World!" text // on a background filled with a radial gradient. public class HelloWorld { public GcBitmap GenerateImage(Size pixelSize, float dpi, bool opaque, string[] sampleParams = null) { var blue = Color.FromArgb(unchecked((int)0xFF2e4884)); var bmp = new GcBitmap(pixelSize.Width, pixelSize.Height, true, dpi, dpi); using (var g = bmp.CreateGraphics(blue)) { var rc = new RectangleF(0, 0, pixelSize.Width, pixelSize.Height); var b = new RadialGradientBrush(Color.White, blue, new PointF(0.5f, 0.5f), true); g.FillRectangle(rc, b); var tf = new TextFormat { Font = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "FreeSerifBold.ttf")), FontSize = 64, ForeColor = Color.OrangeRed, }; g.DrawString("Hello, World!", tf, rc, TextAlignment.Center, ParagraphAlignment.Center, false); } return bmp; } }}