//// 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.Numerics;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{ // Gradients public class Gradients2 { 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(Color.RoyalBlue)) { var m = Matrix3x2.CreateSkew((float)Math.PI / 7, 0, new Vector2(175, 90)); g.Transform = m * Matrix3x2.CreateScale(2f) * Matrix3x2.CreateTranslation(100, 100); var pen = new GCDRAW.Pen(Color.Yellow, 0.5f);
var rgBrush = new RadialGradientBrush(Color.White, Color.Navy) { GradientOrigin = new PointF(0.8f, 0.3f), AllowEllipticGradients = true }; g.FillEllipse(new RectangleF(30, 30, 240, 140), rgBrush);
pen.Color = Color.Red; pen.Width = 2; g.DrawRectangle(new RectangleF(30, 30, 240, 140), pen);
pen.Color = Color.LightGreen; pen.Width = 3.5f; pen.DashStyle = DashStyle.DashDotDot; pen.DashOffset = -3; pen.LineCap = PenLineCap.Round; g.DrawEllipse(new RectangleF(30, 30, 240, 140), pen);
g.DrawString("DsImaging", new TextFormat() { Font = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "FreeSans.ttf")), ForeColor = Color.White, FontSize = 20f }, new PointF(100, 110)); } return bmp; } }}