// This code is part of Document Solutions for Imaging demos.
// Copyright (c) MESCIUS inc. All rights reserved.
using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using GrapeCity.Documents.Drawing;
using GrapeCity.Documents.Text;
using GrapeCity.Documents.Imaging;
using GCTEXT = GrapeCity.Documents.Text;
using GCDRAW = GrapeCity.Documents.Drawing;

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", "timesbd.ttf")),
                    FontSize = 64,
                    ForeColor = Color.OrangeRed,
                g.DrawString("Hello, World!", tf, rc, TextAlignment.Center, ParagraphAlignment.Center, false);
            return bmp;