Class Graphics

Class Graphics

名称: Aspose.Imaging 收藏: Aspose.Imaging.dll (25.4.0)

根据当前组装中使用的图形引擎代表图形。

public sealed class Graphics

Inheritance

object Graphics

继承人

object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Constructors

Graphics(Image)

启动了 Aspose.Imaging.Graphics 类的新例子。

public Graphics(Image sourceImage)

Parameters

sourceImage Image

源图像。

Properties

Clip

接收或设置剪辑区域。

public Region Clip { get; set; }

财产价值

Region

CompositingQuality

得到或设置组合质量。

public CompositingQuality CompositingQuality { get; set; }

财产价值

CompositingQuality

DpiX

得到这个 Aspose.Imaging.Graphics 的水平分辨率。

public float DpiX { get; }

财产价值

float

迪士尼

得到这个 Aspose.Imaging.Graphics 的垂直分辨率。

public float DpiY { get; }

财产价值

float

Image

得到图像。

public Image Image { get; }

财产价值

Image

InterpolationMode

接收或设置中断模式。

public InterpolationMode InterpolationMode { get; set; }

财产价值

InterpolationMode

IsInBeginUpdateCall

收到一个值,表明图形是否在 BeginUpdate 呼叫状态。

public bool IsInBeginUpdateCall { get; }

财产价值

bool

PageScale

获取或设置这个 Aspose.Imaging.Graphics 的世界单元和页面单元之间的分数。

public float PageScale { get; set; }

财产价值

float

PageUnit

在此 Aspose.Imaging.Graphics 中获取或设置用于页面坐标的测量单位。

public GraphicsUnit PageUnit { get; set; }

财产价值

GraphicsUnit

PaintableImageOptions

获取或设置图像选项,用于创建绘制可绘制的图像。

public ImageOptionsBase PaintableImageOptions { get; set; }

财产价值

ImageOptionsBase

SmoothingMode

接收或设置滑动模式。

public SmoothingMode SmoothingMode { get; set; }

财产价值

SmoothingMode

TextRenderingHint

接收或设置文本提供提示。

public TextRenderingHint TextRenderingHint { get; set; }

财产价值

TextRenderingHint

Transform

获取或设置这个 Aspose.Imaging.Graphics 的地质世界转型的副本。

public Matrix Transform { get; set; }

财产价值

Matrix

Methods

BeginUpdate()

接下来应用的图形效果不会立即应用,而最终更新会导致所有效果同时应用。

public void BeginUpdate()

Remarks

注意,在开始更新被召唤后的效果将不会被应用,如果结束更新没有被召唤。

Clear(Color)

清理图形表面使用指定的颜色。

public void Clear(Color color)

Parameters

color Color

颜色清除图形表面。

Examples

这些例子使用 GraphicsPath 和 Graphics 类来创建和操纵图像表面上的图像。 例子创建一个新的图像(类型的 Tiff),清理表面,并用 GraphicsPath 类的帮助引导路径。

//Create an instance of FileStream
                                                                                                                                                                                                                                                                                                                                             using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.tiff", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                                                                                                 //Create an instance of TiffOptions and set its various properties
                                                                                                                                                                                                                                                                                                                                                 Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                                                                                                                                                                                                                                                                 //Set the source for the instance of ImageOptions
                                                                                                                                                                                                                                                                                                                                                 tiffOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                                                                                                 //Create an instance of Image 
                                                                                                                                                                                                                                                                                                                                                 using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(tiffOptions, 500, 500))
                                                                                                                                                                                                                                                                                                                                                 {
                                                                                                                                                                                                                                                                                                                                                     //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                                                                                                     //Clear Graphics surface
                                                                                                                                                                                                                                                                                                                                                     graphics.Clear(Color.Wheat);

                                                                                                                                                                                                                                                                                                                                                     //Create an instance of GraphicsPath class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.GraphicsPath graphicspath = new Aspose.Imaging.GraphicsPath();

                                                                                                                                                                                                                                                                                                                                                     //Create an instance of Figure class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.Figure figure = new Aspose.Imaging.Figure();

                                                                                                                                                                                                                                                                                                                                                     //Add Shapes to Figure object
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(10f, 10f, 300f, 300f)));
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.EllipseShape(new Aspose.Imaging.RectangleF(50f, 50f, 300f, 300f)));
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.PieShape(new Aspose.Imaging.RectangleF(new Aspose.Imaging.PointF(250f, 250f), new Aspose.Imaging.SizeF(200f, 200f)), 0f, 45f));

                                                                                                                                                                                                                                                                                                                                                     //Add Figure object to GraphicsPath
                                                                                                                                                                                                                                                                                                                                                     graphicspath.AddFigure(figure);

                                                                                                                                                                                                                                                                                                                                                     //Draw path with Pen object of color Black
                                                                                                                                                                                                                                                                                                                                                     graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), graphicspath);

                                                                                                                                                                                                                                                                                                                                                     // save all changes.
                                                                                                                                                                                                                                                                                                                                                     image.Save();
                                                                                                                                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                                                                                                                             }

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

DrawArc(海洋,海洋,海洋,海洋,海洋,海洋)

拖动一个弓,代表一部分的,由一对坐标,宽度和高度指定。

public void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)

Parameters

pen Pen

Aspose.Imaging.Pen 决定弓的颜色、宽度和风格。

x float

直角的左上角的X坐标,定义直角的直角。

y float

直角的右上角的 y 坐标,定义直角的直角。

width float

直角的宽度,定义直角的宽度。

height float

直角的高度,定义直角的高度。

startAngle float

角度在度测量时钟,从X轴到弓的起点。

sweepAngle float

角度在度测量从 startAngle’ 参数到结束弓点。

Exceptions

ArgumentNullException

pen’ is null.

DrawArc(平板、平板、平板、平板)

拖动一个弓,代表一个由一个 Aspose.Imaging.RectangleF 结构所指定的精片的一部分。

public void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle)

Parameters

pen Pen

Aspose.Imaging.Pen 决定弓的颜色、宽度和风格。

rect RectangleF

Aspose.Imaging.RectangleF 结构,定义了精子的边界。

startAngle float

角度在度测量时钟,从X轴到弓的起点。

sweepAngle float

角度在度测量从 startAngle’ 参数到结束弓点。

Exceptions

ArgumentNullException

pen’ is null

DrawArc(金, int, int, int, int, int, int, int)

拖动一个弓,代表一部分的,由一对坐标,宽度和高度指定。

public void DrawArc(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)

Parameters

pen Pen

Aspose.Imaging.Pen 决定弓的颜色、宽度和风格。

x int

直角的左上角的X坐标,定义直角的直角。

y int

直角的右上角的 y 坐标,定义直角的直角。

width int

直角的宽度,定义直角的宽度。

height int

直角的高度,定义直角的高度。

startAngle int

角度在度测量时钟,从X轴到弓的起点。

sweepAngle int

角度在度测量从 startAngle’ 参数到结束弓点。

Exceptions

ArgumentNullException

pen’ is null.

DrawArc(平板、平板、平板、平板)

拖动一个弓,代表一个由一个 Aspose.Imaging.Rectangle 结构所指定的精片的一部分。

public void DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle)

Parameters

pen Pen

Aspose.Imaging.Pen 决定弓的颜色、宽度和风格。

rect Rectangle

Aspose.Imaging.RectangleF 结构,定义了精子的边界。

startAngle float

角度在度测量时钟,从X轴到弓的起点。

sweepAngle float

角度在度测量从 startAngle’ 参数到结束弓点。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

pen’ is null.

DrawBezier(航海、航海、航海、航海、航海、航海、航海)

图为四个指定的坐标对,代表点的Bézier线。

public void DrawBezier(Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和风格。

x1 float

曲线的起点的 x 协调。

y1 float

曲线的起点的 y 协调。

x2 float

曲线的第一个控制点的X协调。

y2 float

曲线的第一个控制点的 y 协调。

x3 float

曲线的第二个控制点的X协调。

y3 float

曲线的第二个控制点的 y 协调。

x4 float

曲线的终点的X协调。

y4 float

曲线的终点的 y 协调。

Exceptions

ArgumentNullException

pen’ is null.

DrawBezier(点F、点F、点F、点F)

图为四个 Aspose.Imaging.PointF 结构所定义的 Bézier spline。

public void DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和风格。

pt1 PointF

Aspose.Imaging.PointF 结构代表曲线的起点。

pt2 PointF

Aspose.Imaging.PointF 结构代表曲线的第一个控制点。

pt3 PointF

Aspose.Imaging.PointF 结构代表曲线的第二个控制点。

pt4 PointF

Aspose.Imaging.PointF 结构代表曲线的终点。

Exceptions

ArgumentNullException

pen’ is null.

DrawBezier(点、点、点、点、点)

图为四个 Aspose.Imaging.Point 结构所定义的 Bézier spline。

public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)

Parameters

pen Pen

Aspose.Imaging.Pen 结构,决定曲线的颜色、宽度和风格。

pt1 Point

Aspose.Imaging.Point 构成了曲线的起点。

pt2 Point

Aspose.Imaging.Point 构成曲线的第一个控制点。

pt3 Point

Aspose.Imaging.Point 构成曲线的第二个控制点。

pt4 Point

Aspose.Imaging.Point 结构代表曲线的终点。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

pen’ is null.

DrawBeziers(点,点[])

从一系列的 Aspose.Imaging.Point 结构中提取一系列的 Bézier splines。

public void DrawBeziers(Pen pen, Point[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和风格。

points Point ( )

Aspose.Imaging.Point 构成指定曲线的点。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawBeziers(金, PointF[])

从一系列的 Aspose.Imaging.PointF 结构中提取一系列的 Bézier splines。

public void DrawBeziers(Pen pen, PointF[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和风格。

points PointF ( )

包含 Aspose.Imaging.PointF 结构,代表决定曲线的点。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawClosedCurve(金, PointF[])

拖一个关闭的枢机线定义为一系列的 Aspose.Imaging.PointF 结构. 这个方法使用一个默认的压力为 0.5 和 Aspose.Imaging.FillMode.Alternate 填充模式。

public void DrawClosedCurve(Pen pen, PointF[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points PointF ( )

Aspose.Imaging.PointF 定义 spline 的结构。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawClosedCurve(金, PointF( ), 航海)

拖一个关闭的枢机线定义为一系列的 Aspose.Imaging.PointF 结构,使用一个特定的紧张。

public void DrawClosedCurve(Pen pen, PointF[] points, float tension)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points PointF ( )

Aspose.Imaging.PointF 定义 spline 的结构。

tension float

值大于或等于 0.0F 指定曲线的紧张。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawClosedCurve(点,点[])

拖一个关闭的枢机线定义为一系列的 Aspose.Imaging.Point 结构. 这个方法使用一个默认的压力为 0.5 和 Aspose.Imaging.FillMode.Alternate 填充模式。

public void DrawClosedCurve(Pen pen, Point[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points Point ( )

Aspose.Imaging.Point 定义 spline 的结构。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawClosedCurve(点,点( ), 航海)

拖一个关闭的枢机线定义为一系列的 Aspose.Imaging.Point 结构使用一个特定的紧张。

public void DrawClosedCurve(Pen pen, Point[] points, float tension)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points Point ( )

Aspose.Imaging.Point 定义 spline 的结构。

tension float

值大于或等于 0.0F 指定曲线的紧张。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawCurve(金, PointF[])

通过 Aspose.Imaging.PointF 结构的特定序列引导一个枢机线,该方法使用 0.5 的默认压力。

public void DrawCurve(Pen pen, PointF[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points PointF ( )

Aspose.Imaging.PointF 定义 spline 的结构。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawCurve(金, PointF( ), 航海)

通过一个特定的序列的 Aspose.Imaging.PointF 结构,使用一个特定的紧张。

public void DrawCurve(Pen pen, PointF[] points, float tension)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points PointF ( )

包含 Aspose.Imaging.PointF 结构,代表定义曲线的点。

tension float

值大于或等于 0.0F 指定曲线的紧张。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawCurve(金, PointF( ), int , int)

通过 Aspose.Imaging.PointF 结构的指定的序列绘制一个枢机线,从序列的开始开始绘制。此方法使用 0.5 的默认电压。

public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points PointF ( )

Aspose.Imaging.PointF 定义 spline 的结构。

offset int

point’ 参数序列中的第一个元素转到曲线中的起点。

numberOfSegments int

出发点后分区数量将被列入曲线中。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawCurve(金, PointF( ), int , int , float)

通过一个特定的序列的Aspose.Imaging.PointF结构,使用一个特定的紧张。

public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments, float tension)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points PointF ( )

Aspose.Imaging.PointF 定义 spline 的结构。

offset int

point’ 参数序列中的第一个元素转到曲线中的起点。

numberOfSegments int

出发点后分区数量将被列入曲线中。

tension float

值大于或等于 0.0F 指定曲线的紧张。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawCurve(点,点[])

通过一个特定的序列的 Aspose.Imaging.Point 结构引导一个枢机线。

public void DrawCurve(Pen pen, Point[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points Point ( )

Aspose.Imaging.Point 定义 spline 的结构。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawCurve(点,点( ), 航海)

通过一个特定的序列的 Aspose.Imaging.Point 结构,使用一个特定的紧张。

public void DrawCurve(Pen pen, Point[] points, float tension)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points Point ( )

Aspose.Imaging.Point 定义 spline 的结构。

tension float

值大于或等于 0.0F 指定曲线的紧张。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawCurve(点,点( ), int , int , float)

通过一个特定的序列的 Aspose.Imaging.Point 结构,使用一个特定的紧张。

public void DrawCurve(Pen pen, Point[] points, int offset, int numberOfSegments, float tension)

Parameters

pen Pen

Aspose.Imaging.Pen 决定曲线的颜色、宽度和高度。

points Point ( )

Aspose.Imaging.Point 定义 spline 的结构。

offset int

point’ 参数序列中的第一个元素转到曲线中的起点。

numberOfSegments int

出发点后分区数量将被列入曲线中。

tension float

值大于或等于 0.0F 指定曲线的紧张。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawEllipse(金子,RectangleF)

描绘一个由一个边缘 Aspose.Imaging.RectangleF 定义的幻灯片。

public void DrawEllipse(Pen pen, RectangleF rect)

Parameters

pen Pen

Aspose.Imaging.Pen 是指精子的颜色、宽度和风格。

rect RectangleF

Aspose.Imaging.RectangleF 结构,定义了精子的边界。

Exceptions

ArgumentNullException

pen’ is null.

DrawEllipse(海洋,海洋,海洋,海洋,海洋)

拖着由一对坐标、高度和宽度指定的边缘直角定义的直径。

public void DrawEllipse(Pen pen, float x, float y, float width, float height)

Parameters

pen Pen

Aspose.Imaging.Pen 是指精子的颜色、宽度和风格。

x float

边缘直角的左上角的X坐标,定义了直角。

y float

边缘直角的左上角的 y 坐标,定义了直角。

width float

边缘直角的宽度,定义了直角的宽度。

height float

边缘直角的高度,定义了直角。

Exceptions

ArgumentNullException

pen’ is null.

DrawEllipse(五角,直角)

引导一个由一个边缘 Aspose.Imaging.Rectangle 结构所指定的直径。

public void DrawEllipse(Pen pen, Rectangle rect)

Parameters

pen Pen

Aspose.Imaging.Pen 是指精子的颜色、宽度和风格。

rect Rectangle

Aspose.Imaging.Rectangle 结构,定义直角的边界。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

pen’ is null.

DrawEllipse(金, int, int, int, int, int)

拖着由一对坐标、高度和宽度指定的边缘直角定义的直径。

public void DrawEllipse(Pen pen, int x, int y, int width, int height)

Parameters

pen Pen

Aspose.Imaging.Pen 是指精子的颜色、宽度和风格。

x int

边缘直角的左上角的X坐标,定义了直角。

y int

边缘直角的左上角的 y 坐标,定义了直角。

width int

边缘直角的宽度,定义了直角的宽度。

height int

边缘直角的高度,定义了直角。

Exceptions

ArgumentNullException

pen’ is null.

DrawImage(圖片, PointF)

绘制指定的 Aspose.Imaging.Graphics.Image,使用其原始物理尺寸,在指定的位置。

public void DrawImage(Image sourceImage, PointF point)

Parameters

sourceImage Image

要拍的图像。

point PointF

Aspose.Imaging.PointF 构成图像的左上角。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图片,浮动,浮动)

绘制指定的 Aspose.Imaging.Graphics.Image,使用其原始物理尺寸,在指定的位置。

public void DrawImage(Image sourceImage, float x, float y)

Parameters

sourceImage Image

要拍的图像。

x float

图像的左上角的X协调。

y float

图像的左上角的 y 协调。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图片,RectangleF)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, RectangleF rect)

Parameters

sourceImage Image

要拍的图像。

rect RectangleF

Aspose.Imaging.RectangleF 结构,指定图像的位置和大小。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像, 直角, 图形)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, Rectangle rectDestination, GraphicsUnit graphicsUnit)

Parameters

sourceImage Image

要拍的图像。

rectDestination Rectangle

目的地直角。

graphicsUnit GraphicsUnit

图形单位。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像,RectangleF,GraphicsUnit)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, RectangleF rectDestination, GraphicsUnit graphicsUnit)

Parameters

sourceImage Image

要拍的图像。

rectDestination RectangleF

目的地直角。

graphicsUnit GraphicsUnit

图形单位。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像, 直角, GraphicsUnit, ImageAttributes)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, Rectangle rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)

Parameters

sourceImage Image

要拍的图像。

rectDestination Rectangle

目的地直角。

graphicsUnit GraphicsUnit

图形单位。

imageAttributes ImageAttributes

图像特征。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像, RectangleF, GraphicsUnit, ImageAttributes)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, RectangleF rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)

Parameters

sourceImage Image

要拍的图像。

rectDestination RectangleF

目的地直角引入。

graphicsUnit GraphicsUnit

图形单位。

imageAttributes ImageAttributes

图像特征。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像, 直角, 直角, 图形)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, Rectangle rectSource, Rectangle rectDestination, GraphicsUnit graphicsUnit)

Parameters

sourceImage Image

要拍的图像。

rectSource Rectangle

直线源。

rectDestination Rectangle

正确的目的地。

graphicsUnit GraphicsUnit

图形单位。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像,RectangleF,RectangleF,GraphicsUnit)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, RectangleF rectSource, RectangleF rectDestination, GraphicsUnit graphicsUnit)

Parameters

sourceImage Image

要拍的图像。

rectSource RectangleF

直线源。

rectDestination RectangleF

正确的目的地。

graphicsUnit GraphicsUnit

图形单位。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像, 直角, 直角, GraphicsUnit, ImageAttributes)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, Rectangle rectSource, Rectangle rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)

Parameters

sourceImage Image

要拍的图像。

rectSource Rectangle

直线源。

rectDestination Rectangle

正确的目的地。

graphicsUnit GraphicsUnit

图形单位。

imageAttributes ImageAttributes

图像特征。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像, RectangleF, RectangleF, GraphicsUnit, ImageAttributes)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, RectangleF rectSource, RectangleF rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)

Parameters

sourceImage Image

要拍的图像。

rectSource RectangleF

源直角。

rectDestination RectangleF

目的地直角。

graphicsUnit GraphicsUnit

使用的图形单位。

imageAttributes ImageAttributes

图像是用来使用的。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图片,点[])

将指定的 image’ 的指定部分拖在指定的位置和指定的尺寸上。

public void DrawImage(Image image, Point[] destPoints)

Parameters

image Image

图像要绘制。

destPoints Point ( )

由三个 PointF 结构组成,定义一个平行图。

DrawImage(图片,点( ), 直角)

将指定的 image’ 的指定部分拖在指定的位置和指定的尺寸上。

public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect)

Parameters

image Image

图像要绘制。

destPoints Point ( )

由三个 PointF 结构组成,定义一个平行图。

srcRect Rectangle

源直角。

DrawImage(图片,点( ), 直角, 图形)

将指定的 image’ 的指定部分拖在指定的位置和指定的尺寸上。

public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)

Parameters

image Image

图像要绘制。

destPoints Point ( )

由三个 PointF 结构组成,定义一个平行图。

srcRect Rectangle

源直角。

srcUnit GraphicsUnit

测量单位。

DrawImage(图片,点( ), 直角, GraphicsUnit, ImageAttributes)

将指定的 image’ 的指定部分拖在指定的位置和指定的尺寸上。

public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttributes)

Parameters

image Image

图像要绘制。

destPoints Point ( )

由三个 PointF 结构组成,定义一个平行图。

srcRect Rectangle

源直角。

srcUnit GraphicsUnit

测量单位。

imageAttributes ImageAttributes

图像特征。

DrawImage(圖片, PointF[])

将指定的 image’ 的指定部分拖在指定的位置和指定的尺寸上。

public void DrawImage(Image image, PointF[] destPoints)

Parameters

image Image

图像要绘制。

destPoints PointF ( )

由三个 PointF 结构组成,定义一个平行图。

Exceptions

ArgumentNullException

图像

DrawImage(圖片, PointF( ), 直角)

将指定的 image’ 的指定部分拖在指定的位置和指定的尺寸上。

public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect)

Parameters

image Image

图像要绘制。

destPoints PointF ( )

由三个 PointF 结构组成,定义一个平行图。

srcRect RectangleF

源直角。

DrawImage(圖片, PointF( ), RectangleF , GraphicsUnit)

将指定的 image’ 的指定部分拖在指定的位置和指定的尺寸上。

public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)

Parameters

image Image

图像要绘制。

destPoints PointF ( )

由三个 PointF 结构组成,定义一个平行图。

srcRect RectangleF

源直角。

srcUnit GraphicsUnit

测量单位。

DrawImage(圖片, PointF( ), RectangleF, GraphicsUnit, ImageAttributes)

将指定的 image’ 的指定部分拖在指定的位置和指定的尺寸上。

public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttributes)

Parameters

image Image

图像要绘制。

destPoints PointF ( )

由三个 PointF 结构组成,定义一个平行图。

srcRect RectangleF

源直角。

srcUnit GraphicsUnit

测量单位。

imageAttributes ImageAttributes

图像特征。

DrawImage(图片,海洋,海洋,海洋,海洋)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, float x, float y, float width, float height)

Parameters

sourceImage Image

要拍的图像。

x float

图像的左上角的X协调。

y float

图像的左上角的 y 协调。

width float

拍摄的图像的宽度。

height float

拍摄图像的高度。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图片,点)

绘制指定的 Aspose.Imaging.Graphics.Image,使用其原始物理尺寸,在指定的位置。

public void DrawImage(Image sourceImage, Point point)

Parameters

sourceImage Image

要拍的图像。

point Point

Aspose.Imaging.Point 结构代表图像的左上角的位置。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像, int, int)

绘制所指定的图像,使用其原始物理尺寸,在由一对坐标指定的位置。

public void DrawImage(Image sourceImage, int x, int y)

Parameters

sourceImage Image

要拍的图像。

x int

图像的左上角的X协调。

y int

图像的左上角的 y 协调。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像,直角)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, Rectangle rect)

Parameters

sourceImage Image

要拍的图像。

rect Rectangle

Aspose.Imaging.Rectangle 结构,指定图像的位置和大小。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImage(图像, int, int, int, int)

将指定的 Aspose.Imaging.Graphics.Image 在指定的位置和指定的尺寸绘制。

public void DrawImage(Image sourceImage, int x, int y, int width, int height)

Parameters

sourceImage Image

要拍的图像。

x int

图像的左上角的X协调。

y int

图像的左上角的 y 协调。

width int

拍摄的图像的宽度。

height int

拍摄图像的高度。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImageUnscaled(图片,点)

使用其原始物理尺寸在特定位置拍摄一个特定的图像。

public void DrawImageUnscaled(Image sourceImage, Point point)

Parameters

sourceImage Image

要拍的图像。

point Point

Aspose.Imaging.Point 结构,指定图像的左上角。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImageUnscaled(图像, int, int)

使用其原始物理尺寸在由一对坐标指定的位置绘制所指定的图像。

public void DrawImageUnscaled(Image sourceImage, int x, int y)

Parameters

sourceImage Image

要拍的图像。

x int

图像的左上角的X协调。

y int

图像的左上角的 y 协调。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImageUnscaled(图像,直角)

使用其原始物理尺寸在特定位置拍摄一个特定的图像。

public void DrawImageUnscaled(Image sourceImage, Rectangle rect)

Parameters

sourceImage Image

要拍的图像。

rect Rectangle

Aspose.Imaging.Rectangle 指定图像的左上角. 直角的 X 和 Y 属性指定左上角. 宽度和高度属性被忽略。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImageUnscaled(图像, int, int, int, int)

使用其原始物理尺寸在特定位置拍摄一个特定的图像。

public void DrawImageUnscaled(Image sourceImage, int x, int y, int width, int height)

Parameters

sourceImage Image

要拍的图像。

x int

图像的左上角的X协调。

y int

图像的左上角的 y 协调。

width int

参数不使用。

height int

参数不使用。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawImageUnscaledAndClipped(图像,直角)

拖动所指定的图像,而无需扩展,并在必要时将其剪辑,以适应所指定的直角。

public void DrawImageUnscaledAndClipped(Image sourceImage, Rectangle rect)

Parameters

sourceImage Image

要拍的图像。

rect Rectangle

Aspose.Imaging.Rectangle 在哪里的图像。

Exceptions

ArgumentNullException

sourceImage’ is null.

DrawLine(点、点、点)

创建一行连接两个 Aspose.Imaging.Point 结构。

public void DrawLine(Pen pen, Point point1, Point point2)

Parameters

pen Pen

Aspose.Imaging.Pen 决定线的颜色、宽度和风格。

point1 Point

Aspose.Imaging.Point 构成了连接的第一点。

point2 Point

Aspose.Imaging.Point 构成了连接的第二点。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

pen’ is null.

DrawLine(金, PointF, PointF)

创建一行连接两个 Aspose.Imaging.PointF 结构。

public void DrawLine(Pen pen, PointF point1, PointF point2)

Parameters

pen Pen

Aspose.Imaging.Pen 决定线的颜色、宽度和风格。

point1 PointF

Aspose.Imaging.PointF 结构代表连接的第一点。

point2 PointF

Aspose.Imaging.PointF 结构代表连接的第二点。

Exceptions

ArgumentNullException

pen’ is null.

DrawLine(金, int, int, int, int, int)

拖着连接由协调对称所指定的两个点的线条。

public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)

Parameters

pen Pen

Aspose.Imaging.Pen 决定线的颜色、宽度和风格。

x1 int

第一点的X协调。

y1 int

第一点的 Y 协调。

x2 int

第二点的X协调。

y2 int

第二点的Y协调。

Exceptions

ArgumentNullException

pen’ is null.

DrawLine(海洋,海洋,海洋,海洋,海洋)

拖着连接由协调对称所指定的两个点的线条。

public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)

Parameters

pen Pen

Aspose.Imaging.Pen 决定线的颜色、宽度和风格。

x1 float

第一点的X协调。

y1 float

第一点的 Y 协调。

x2 float

第二点的X协调。

y2 float

第二点的Y协调。

Exceptions

ArgumentNullException

pen’ is null.

DrawLines(点,点[])

图为一系列连接一系列 Aspose.Imaging.Point 结构的线条部分。

public void DrawLines(Pen pen, Point[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定线部分的颜色、宽度和风格。

points Point ( )

Array of Aspose.Imaging.Point 构成要连接的点。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

ArgumentException

point’ 序列包含不到 2 个点。

DrawLines(金, PointF[])

图为一系列连接一系列 Aspose.Imaging.PointF 结构的线条部分。

public void DrawLines(Pen pen, PointF[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定线部分的颜色、宽度和风格。

points PointF ( )

包含 Aspose.Imaging.PointF 结构,代表要连接的点。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

ArgumentException

point’ 序列包含不到 2 个点。

DrawPath(字体, 图形)

创建一个 Aspose.Imaging.GraphicsPath。

public void DrawPath(Pen pen, GraphicsPath path)

Parameters

pen Pen

Aspose.Imaging.Pen 决定路径的颜色、宽度和风格。

path GraphicsPath

圖片 圖片 圖片 圖片 圖片 圖片

Examples

这些例子使用 GraphicsPath 和 Graphics 类来创建和操纵图像表面上的图像。 例子创建一个新的图像(类型的 Tiff),清理表面,并用 GraphicsPath 类的帮助引导路径。

//Create an instance of FileStream
                                                                                                                                                                                                                                                                                                                                             using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.tiff", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                                                                                                 //Create an instance of TiffOptions and set its various properties
                                                                                                                                                                                                                                                                                                                                                 Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                                                                                                                                                                                                                                                                 //Set the source for the instance of ImageOptions
                                                                                                                                                                                                                                                                                                                                                 tiffOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                                                                                                 //Create an instance of Image 
                                                                                                                                                                                                                                                                                                                                                 using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(tiffOptions, 500, 500))
                                                                                                                                                                                                                                                                                                                                                 {
                                                                                                                                                                                                                                                                                                                                                     //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                                                                                                     //Clear Graphics surface
                                                                                                                                                                                                                                                                                                                                                     graphics.Clear(Color.Wheat);

                                                                                                                                                                                                                                                                                                                                                     //Create an instance of GraphicsPath class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.GraphicsPath graphicspath = new Aspose.Imaging.GraphicsPath();

                                                                                                                                                                                                                                                                                                                                                     //Create an instance of Figure class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.Figure figure = new Aspose.Imaging.Figure();

                                                                                                                                                                                                                                                                                                                                                     //Add Shapes to Figure object
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(10f, 10f, 300f, 300f)));
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.EllipseShape(new Aspose.Imaging.RectangleF(50f, 50f, 300f, 300f)));
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.PieShape(new Aspose.Imaging.RectangleF(new Aspose.Imaging.PointF(250f, 250f), new Aspose.Imaging.SizeF(200f, 200f)), 0f, 45f));

                                                                                                                                                                                                                                                                                                                                                     //Add Figure object to GraphicsPath
                                                                                                                                                                                                                                                                                                                                                     graphicspath.AddFigure(figure);

                                                                                                                                                                                                                                                                                                                                                     //Draw path with Pen object of color Black
                                                                                                                                                                                                                                                                                                                                                     graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), graphicspath);

                                                                                                                                                                                                                                                                                                                                                     // save all changes.
                                                                                                                                                                                                                                                                                                                                                     image.Save();
                                                                                                                                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                                                                                                                             }

Exceptions

ArgumentNullException

pen’ is null.-or-path’ is null.

DrawPie(平板、平板、平板、平板)

描绘一个由一个 Aspose.Imaging.RectangleF 结构和两个辐射线规定的皮形状。

public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle)

Parameters

pen Pen

Aspose.Imaging.Pen 决定皮形的颜色、宽度和风格。

rect RectangleF

Aspose.Imaging.RectangleF 构成了定义皮形源的直角。

startAngle float

角度从X轴到皮形的第一侧测量。

sweepAngle float

角度从 startAngle’ 参数到皮形的另一侧测量。

Exceptions

ArgumentNullException

pen’ is null.

DrawPie(海洋,海洋,海洋,海洋,海洋,海洋)

描绘一个由一对坐标,一个宽度,一个高度和两个辐射线所定义的形状。

public void DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)

Parameters

pen Pen

Aspose.Imaging.Pen 决定皮形的颜色、宽度和风格。

x float

边缘直角的左上角的X坐标,定义了皮形状来源的直角。

y float

边缘直角的左上角的 y 坐标,定义了皮形状来源的精液。

width float

边缘直角的宽度,定义了皮形状来源的直角。

height float

边缘直角的高度,定义了皮形状来源的直角。

startAngle float

角度从X轴到皮形的第一侧测量。

sweepAngle float

角度从 startAngle’ 参数到皮形的另一侧测量。

Exceptions

ArgumentNullException

pen’ is null.

DrawPie(平板、平板、平板、平板)

描绘一个由一个 Aspose.Imaging.Rectangle 结构和两个辐射线所定义的皮形状。

public void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle)

Parameters

pen Pen

Aspose.Imaging.Pen 决定皮形的颜色、宽度和风格。

rect Rectangle

Aspose.Imaging.Rectangle 构成边缘直角,定义了皮形状来源的直角。

startAngle float

角度从X轴到皮形的第一侧测量。

sweepAngle float

角度从 startAngle’ 参数到皮形的另一侧测量。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

pen’ is null.

DrawPie(金, int, int, int, int, int, int, int)

描绘一个由一对坐标,一个宽度,一个高度和两个辐射线所定义的形状。

public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)

Parameters

pen Pen

Aspose.Imaging.Pen 决定皮形的颜色、宽度和风格。

x int

边缘直角的左上角的X坐标,定义了皮形状来源的直角。

y int

边缘直角的左上角的 y 坐标,定义了皮形状来源的精液。

width int

边缘直角的宽度,定义了皮形状来源的直角。

height int

边缘直角的高度,定义了皮形状来源的直角。

startAngle int

角度从X轴到皮形的第一侧测量。

sweepAngle int

角度从 startAngle’ 参数到皮形的另一侧测量。

Exceptions

ArgumentNullException

pen’ is null.

DrawPolygon(金, PointF[])

引导一个由一系列 Aspose.Imaging.PointF 结构所定义的聚合物。

public void DrawPolygon(Pen pen, PointF[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定聚合物的颜色、宽度和风格。

points PointF ( )

由 Aspose.Imaging.PointF 构成,代表聚合物的垂直。

Exceptions

ArgumentNullException

pen’ is null.-or-points’ is null.

DrawPolygon(点,点[])

引导一个由一系列 Aspose.Imaging.Point 结构所定义的聚合物。

public void DrawPolygon(Pen pen, Point[] points)

Parameters

pen Pen

Aspose.Imaging.Pen 决定聚合物的颜色、宽度和风格。

points Point ( )

Aspose.Imaging.Point 构成聚合物的垂直。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

pen’ is null.

DrawRectangle(金子,RectangleF)

拖着由 Aspose.Imaging.RectangleF 结构所指定的直角。

public void DrawRectangle(Pen pen, RectangleF rect)

Parameters

pen Pen

Aspose.Imaging.Pen 定义直角的颜色、宽度和风格。

rect RectangleF

一个 Aspose.Imaging.RectangleF 结构,代表要绘制的直角。

Exceptions

ArgumentNullException

pen’ is null.

DrawRectangle(五角,直角)

引导一个由 Aspose.Imaging.Rectangle 结构所指定的直角。

public void DrawRectangle(Pen pen, Rectangle rect)

Parameters

pen Pen

Aspose.Imaging.Pen 定义直角的颜色、宽度和风格。

rect Rectangle

一个 Aspose.Imaging.Rectangle 结构,代表要绘制的直角。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

pen’ is null.

DrawRectangle(海洋,海洋,海洋,海洋,海洋)

拖着由一对坐标,宽度和高度指定的直角。

public void DrawRectangle(Pen pen, float x, float y, float width, float height)

Parameters

pen Pen

Aspose.Imaging.Pen 定义直角的颜色、宽度和风格。

x float

直角的左上角的 x 协调图。

y float

直角的右上角的 y 协调图。

width float

直角的宽度要绘制。

height float

直角的高度要绘制。

Exceptions

ArgumentNullException

pen’ is null.

DrawRectangle(金, int, int, int, int, int)

拖着由一对坐标,宽度和高度指定的直角。

public void DrawRectangle(Pen pen, int x, int y, int width, int height)

Parameters

pen Pen

Aspose.Imaging.Pen 决定直角的颜色、宽度和风格。

x int

直角的左上角的 x 协调图。

y int

直角的右上角的 y 协调图。

width int

直角的宽度要绘制。

height int

直角的高度要绘制。

Exceptions

ArgumentNullException

pen’ is null.

DrawRectangles(金子,RectangleF[])

描绘一系列由 Aspose.Imaging.RectangleF 结构所规定的直角。

public void DrawRectangles(Pen pen, RectangleF[] rects)

Parameters

pen Pen

Aspose.Imaging.Pen 定义直角字符的颜色、宽度和风格。

rects RectangleF ( )

由 Aspose.Imaging.RectangleF 构成,代表要绘制的直角。

Exceptions

ArgumentNullException

pen’ is null.-or-rects’ is null.

DrawRectangles(五角,直角[])

描绘一系列由 Aspose.Imaging.Rectangle 规定的直角结构。

public void DrawRectangles(Pen pen, Rectangle[] rects)

Parameters

pen Pen

Aspose.Imaging.Pen 定义直角字符的颜色、宽度和风格。

rects Rectangle ( )

序列 Aspose.Imaging.Rectangle 构成图为直角的结构。

Examples

此示例显示创建和使用笔对象 示例创建一个新的图像,并在图像表面绘制直角。

//Create an instance of BmpOptions and set its various properties
                                                                                                                                       Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                       bmpOptions.BitsPerPixel = 24;

                                                                                                                                       //Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
                                                                                                                                       //Second Boolean parameter determines if the file to be created IsTemporal or not
                                                                                                                                       bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                       //Create an instance of Image at specified Path
                                                                                                                                       using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                       {
                                                                                                                                           //Create an instance of Graphics and initialize it with Image object
                                                                                                                                           Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                           //Clear the Graphics sutface with White Color
                                                                                                                                           graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                           //Create an instance of Pen with color Red and width 5
                                                                                                                                           Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                           //Create an instance of HatchBrush and set its properties
                                                                                                                                           Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                           brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                           brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                           //Create an instance of Pen
                                                                                                                                           //initialize it with HatchBrush object and width
                                                                                                                                           Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                           //Draw Rectangles by specifying Pen object
                                                                                                                                           graphics.DrawRectangles(pen, new[]
                                                                                                                                           {
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(210, 210), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                           });

                                                                                                                                           //Draw Rectangles by specifying Pen object
                                                                                                                                           graphics.DrawRectangles(brusedpen, new[]
                                                                                                                                           {
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                               new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                           });

                                                                                                                                           // save all changes.
                                                                                                                                           image.Save();
                                                                                                                                       }

Exceptions

ArgumentNullException

pen’ is null.-or-rects’ is null.

DrawString(字符, 字符, Brush, Float, Float)

将指定的文本行在指定的位置与指定的 Aspose.Imaging.Brush 和 Aspose.Imaging.Font 对象拖动。

public void DrawString(string s, Font font, Brush brush, float x, float y)

Parameters

s string

拖拉的线条。

font Font

Aspose.Imaging.Font 定义字符串的文本格式。

brush Brush

Aspose.Imaging.Brush 指定绘制文本的颜色和结构。

x float

绘制文本的左上角的 x 协调。

y float

图为图为图为图为图为图为图为图为图。

Exceptions

ArgumentNullException

brush’ is null.-or-s’ is null.

DrawString(字体,字体, Brush, PointF)

将指定的文本行在指定的位置与指定的 Aspose.Imaging.Brush 和 Aspose.Imaging.Font 对象拖动。

public void DrawString(string s, Font font, Brush brush, PointF point)

Parameters

s string

拖拉的线条。

font Font

Aspose.Imaging.Font 定义字符串的文本格式。

brush Brush

Aspose.Imaging.Brush 指定绘制文本的颜色和结构。

point PointF

Aspose.Imaging.PointF 结构,指定绘制文本的左上角。

Examples

此示例使用图形类在图形表面上创建原始形状。 为了展示操作,该示例在 PNG 格式创建一个新的图形,并使用图形表面绘制原始形状,使用图形类曝光的绘图方法。

//Creates an instance of FileStream
                                                                                                                                                                                                                                                                using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Create an instance of PngOptions and set its various properties
                                                                                                                                                                                                                                                                    Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                    //Set the Source for PngOptions
                                                                                                                                                                                                                                                                    pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                    //Create an instance of Image 
                                                                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                        //Clear Graphics surface
                                                                                                                                                                                                                                                                        graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                        //Draw an Arc by specifying the Pen object having Black color, 
                                                                                                                                                                                                                                                                        //a Rectangle surrounding the Arc, Start Angle and Sweep Angle
                                                                                                                                                                                                                                                                        graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                        //Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
                                                                                                                                                                                                                                                                        graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                        //Draw a Curve by specifying the Pen object having Green color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                        //Draw an Ellipse using the Pen object and a surrounding Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                        //Draw a Line 
                                                                                                                                                                                                                                                                        graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                        //Draw a Pie segment
                                                                                                                                                                                                                                                                        graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                        //Draw a Polygon by specifying the Pen object having Red color and an array of Points
                                                                                                                                                                                                                                                                        graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                        //Draw a Rectangle
                                                                                                                                                                                                                                                                        graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                        //Create a SolidBrush object and set its various properties
                                                                                                                                                                                                                                                                        Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                        brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                        brush.Opacity = 100;

                                                                                                                                                                                                                                                                        //Draw a String using the SolidBrush object and Font, at specific Point
                                                                                                                                                                                                                                                                        graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                        // save all changes.
                                                                                                                                                                                                                                                                        image.Save();
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

Exceptions

ArgumentNullException

brush’ is null.-or-s’ is null.

DrawString(字符, 字符, Brush, Float, Float, StringFormat)

将指定的文本条在指定的位置与指定的 Aspose.Imaging.Brush 和 Aspose.Imaging.Font 对象,使用指定的 Aspose.Imaging.StringFormat 的格式化属性。

public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format)

Parameters

s string

拖拉的线条。

font Font

Aspose.Imaging.Font 定义字符串的文本格式。

brush Brush

Aspose.Imaging.Brush 指定绘制文本的颜色和结构。

x float

绘制文本的左上角的 x 协调。

y float

图为图为图为图为图为图为图为图为图。

format StringFormat

Aspose.Imaging.StringFormat 指定格式化属性,如线段和匹配,这些属性适用于绘制文本。

Exceptions

ArgumentNullException

brush’ is null.-or-s’ is null.

DrawString(字体,字体, Brush, PointF, StringFormat)

将指定的文本条在指定的位置与指定的 Aspose.Imaging.Brush 和 Aspose.Imaging.Font 对象,使用指定的 Aspose.Imaging.StringFormat 的格式化属性。

public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format)

Parameters

s string

拖拉的线条。

font Font

Aspose.Imaging.Font 定义字符串的文本格式。

brush Brush

Aspose.Imaging.Brush 指定绘制文本的颜色和结构。

point PointF

Aspose.Imaging.PointF 结构,指定绘制文本的左上角。

format StringFormat

Aspose.Imaging.StringFormat 指定格式化属性,如线段和匹配,这些属性适用于绘制文本。

Exceptions

ArgumentNullException

brush’ is null.-or-s’ is null.

DrawString(字体, 字体, Brush, RectangleF)

在指定的直角中,用指定的 Aspose.Imaging.Brush 和 Aspose.Imaging.Font 对象绘制指定的文本行。

public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle)

Parameters

s string

拖拉的线条。

font Font

Aspose.Imaging.Font 定义字符串的文本格式。

brush Brush

Aspose.Imaging.Brush 指定绘制文本的颜色和结构。

layoutRectangle RectangleF

Aspose.Imaging.RectangleF 结构,指定绘制文本的位置。

Exceptions

ArgumentNullException

brush’ is null.-or-s’ is null.

DrawString(字体, 字体, Brush, RectangleF, StringFormat)

在指定的直角中用指定的 Aspose.Imaging.Brush 和 Aspose.Imaging.Font 对象绘制指定的 Aspose.Imaging.StringFormat 的格式化属性。

public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)

Parameters

s string

拖拉的线条。

font Font

Aspose.Imaging.Font 定义字符串的文本格式。

brush Brush

Aspose.Imaging.Brush 指定绘制文本的颜色和结构。

layoutRectangle RectangleF

Aspose.Imaging.RectangleF 结构,指定绘制文本的位置。

format StringFormat

Aspose.Imaging.StringFormat 指定格式化属性,如线段和匹配,这些属性适用于绘制文本。

Exceptions

ArgumentNullException

brush’ is null.-or-s’ is null.-or-brush’ is null.

EndUpdate()

接下来的图形操作将立即应用,当呼叫这个方法时。

public void EndUpdate()

FillClosedCurve(布什, PointF[])

填补了由一系列 Aspose.Imaging.PointF 结构所定义的关闭枢机线曲线的内部,该方法使用 0.5 和 Aspose.Imaging.FillMode.Alternate 填充模式的默认电压。

public void FillClosedCurve(Brush brush, PointF[] points)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points PointF ( )

Aspose.Imaging.PointF 定义 spline 的结构。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillClosedCurve(布什, PointF( ), FillMode)

填补由一系列 Aspose.Imaging.PointF 结构使用指定的填充模式定义的关闭枢机线曲线的内部。

public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillMode)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points PointF ( )

Aspose.Imaging.PointF 定义 spline 的结构。

fillMode FillMode

Aspose.Imaging.FillMode列表的成员,确定曲线是如何填写的。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillClosedCurve(布什, PointF( ), FillMode , 浮动)

填补了由一系列 Aspose.Imaging.PointF 结构所定义的关闭枢机线曲线的内部,使用指定的填充模式和紧张。

public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode, float tension)

Parameters

brush Brush

一个 Aspose.Imaging.Brush 决定填充的特性。

points PointF ( )

Aspose.Imaging.PointF 定义 spline 的结构。

fillmode FillMode

Aspose.Imaging.FillMode列表的成员,确定曲线是如何填写的。

tension float

值大于或等于 0.0F 指定曲线的紧张。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillClosedCurve(布什,点[])

填补了由一系列 Aspose.Imaging.Point 结构所定义的关闭的枢机线曲线的内部,这种方法使用了 0.5 和 Aspose.Imaging.FillMode.Alternate 填充模式的默认压力。

public void FillClosedCurve(Brush brush, Point[] points)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points Point ( )

Aspose.Imaging.Point 定义 spline 的结构。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillClosedCurve(布什,点( ), FillMode)

填补了由一系列 Aspose.Imaging.Point 结构所定义的关闭的枢机线曲线的内部,使用指定的填充模式。

public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points Point ( )

Aspose.Imaging.Point 定义 spline 的结构。

fillmode FillMode

Aspose.Imaging.FillMode列表的成员,确定曲线是如何填写的。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillClosedCurve(布什,点( ), FillMode , 浮动)

填补了由一系列 Aspose.Imaging.Point 结构所定义的关闭枢机线曲线的内部,使用指定的填充模式和紧张。

public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode, float tension)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points Point ( )

Aspose.Imaging.Point 定义 spline 的结构。

fillmode FillMode

Aspose.Imaging.FillMode列表的成员,确定曲线是如何填写的。

tension float

值大于或等于 0.0F 指定曲线的紧张。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillEllipse(布什,RectangleF)

填补由一个 Aspose.Imaging.RectangleF 结构所指定的边缘直角所定义的直角的内部。

public void FillEllipse(Brush brush, RectangleF rect)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

rect RectangleF

Aspose.Imaging.RectangleF 结构,代表定义直角的边缘直角。

Exceptions

ArgumentNullException

brush’ is null.

FillEllipse(海洋,海洋,海洋,海洋)

它填补了由一对坐标、宽度和高度指定的边缘直角所定义的直角。

public void FillEllipse(Brush brush, float x, float y, float width, float height)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

x float

边缘直角的左上角的X坐标,定义了直角。

y float

边缘直角的左上角的 y 坐标,定义了直角。

width float

边缘直角的宽度,定义了直角的宽度。

height float

边缘直角的高度,定义了直角。

Exceptions

ArgumentNullException

brush’ is null.

FillEllipse(直角,直角)

填补由一个 Aspose.Imaging.Rectangle 结构所指定的边缘直角定义的直角的内部。

public void FillEllipse(Brush brush, Rectangle rect)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

rect Rectangle

Aspose.Imaging.Rectangle 构成定义直角的边缘直角。

Exceptions

ArgumentNullException

brush’ is null.

FillEllipse(布, int, int, int, int)

它填补了由一对坐标、宽度和高度指定的边缘直角所定义的直角。

public void FillEllipse(Brush brush, int x, int y, int width, int height)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

x int

边缘直角的左上角的X坐标,定义了直角。

y int

边缘直角的左上角的 y 坐标,定义了直角。

width int

边缘直角的宽度,定义了直角的宽度。

height int

边缘直角的高度,定义了直角。

Exceptions

ArgumentNullException

brush’ is null.

FillPath(布什,GraphicsPath)

填补一个 Aspose.Imaging.GraphicsPath的内部。

public void FillPath(Brush brush, GraphicsPath path)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

path GraphicsPath

Aspose.Imaging.GraphicsPath 代表填写的路径。

Exceptions

ArgumentNullException

brush’ is null.-or-path’ is null.

FillPie(布,直角,浮动,浮动)

它填补了一个由一个 Aspose.Imaging.RectangleF 结构所指定的精液定义的皮部分的内部和两个辐射线。

public void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

rect Rectangle

Aspose.Imaging.Rectangle 是代表边缘直角的结构,它定义了皮部分来自的直角。

startAngle float

角度在度测量时钟,从X轴到皮部分的第一侧。

sweepAngle float

角度在度测量从 startAngle’ 参数到 pie 部分的另一侧。

Examples

下面的例子显示如何从个别的GIF区块组成动画GIF图像。

string dir = "c:\\temp\\";

                                                                                                       // Create a GIF image 100 x 100 px.
                                                                                                       // The first block is fully black by default.
                                                                                                       using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
                                                                                                       using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
                                                                                                       {
                                                                                                           // The first circle is red
                                                                                                           Aspose.Imaging.Brushes.SolidBrush brush1 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);

                                                                                                           // The second circle is black
                                                                                                           Aspose.Imaging.Brushes.SolidBrush brush2 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Black);

                                                                                                           // Gradually inscrease the angle of the red arc shape.
                                                                                                           for (int angle = 10; angle <= 360; angle += 10)
                                                                                                           {
                                                                                                               Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);

                                                                                                               Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
                                                                                                               gr.FillPie(brush1, block.Bounds, 0, angle);

                                                                                                               gifImage.AddBlock(block);
                                                                                                           }

                                                                                                           // Gradually inscrease the angle of the black arc and wipe out the red arc.
                                                                                                           for (int angle = 10; angle <= 360; angle += 10)
                                                                                                           {
                                                                                                               Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);

                                                                                                               Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
                                                                                                               gr.FillPie(brush2, block.Bounds, 0, angle);
                                                                                                               gr.FillPie(brush1, block.Bounds, angle, 360 - angle);

                                                                                                               gifImage.AddBlock(block);
                                                                                                           }

                                                                                                           gifImage.Save(dir + "animated_radar.gif");
                                                                                                       }

Exceptions

ArgumentNullException

brush’ is null.

FillPie(布什,RectangleF,浮动,浮动)

它填补了一个由一个 Aspose.Imaging.RectangleF 结构所指定的精液定义的皮部分的内部和两个辐射线。

public void FillPie(Brush brush, RectangleF rect, float startAngle, float sweepAngle)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

rect RectangleF

Aspose.Imaging.RectangleF 构成了定义皮部分来源的直角。

startAngle float

角度在度测量时钟,从X轴到皮部分的第一侧。

sweepAngle float

角度在度测量从 startAngle’ 参数到 pie 部分的另一侧。

Exceptions

ArgumentNullException

brush’ is null.

FillPie(航海、航海、航海、航海、航海、航海、航海)

它填补了由一对坐标、宽度、高度和两条辐射线所指定的形定义的形部分的内部。

public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

x float

边缘直角的左上角的X坐标,定义了皮部分来自的直角。

y float

边缘直角的左上角的 y 坐标,定义了皮部分来自的精液。

width float

边缘直角的宽度,定义了皮部分来自的直角。

height float

边缘直角的高度,定义了皮部分来自的精度。

startAngle float

角度在度测量时钟,从X轴到皮部分的第一侧。

sweepAngle float

角度在度测量从 startAngle’ 参数到 pie 部分的另一侧。

Exceptions

ArgumentNullException

brush’ is null.

FillPie(布, int, int, int, int, int, int, int)

它填补了由一对坐标、宽度、高度和两条辐射线所指定的形定义的形部分的内部。

public void FillPie(Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

x int

边缘直角的左上角的X坐标,定义了皮部分来自的直角。

y int

边缘直角的左上角的 y 坐标,定义了皮部分来自的精液。

width int

边缘直角的宽度,定义了皮部分来自的直角。

height int

边缘直角的高度,定义了皮部分来自的精度。

startAngle int

角度在度测量时钟,从X轴到皮部分的第一侧。

sweepAngle int

角度在度测量从 startAngle’ 参数到 pie 部分的另一侧。

Exceptions

ArgumentNullException

brush’ is null.

FillPolygon(布什, PointF[])

它填补了由 Aspose.Imaging.PointF 结构和 Aspose.Imaging.FillMode.Alternate 所指定的多个点所定义的聚合物的内部。

public void FillPolygon(Brush brush, PointF[] points)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points PointF ( )

系列的 Aspose.Imaging.PointF 结构,代表聚合物的垂直填充。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillPolygon(布什, PointF( ), FillMode)

填补由 Aspose.Imaging.PointF 规定的点序列所定义的聚合物的内部,使用规定的填充模式。

public void FillPolygon(Brush brush, PointF[] points, FillMode fillMode)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points PointF ( )

系列的 Aspose.Imaging.PointF 结构,代表聚合物的垂直填充。

fillMode FillMode

是 Aspose.Imaging.FillMode 列表的成员,决定了填充的风格。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillPolygon(布什,点[])

它填补了由 Aspose.Imaging.Point 和 Aspose.Imaging.FillMode.Alternate 所指定的多个点所定义的聚合物的内部。

public void FillPolygon(Brush brush, Point[] points)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points Point ( )

序列 Aspose.Imaging.Point 结构,代表聚合物的垂直填充。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillPolygon(布什,点( ), FillMode)

填补由 Aspose.Imaging.Point 所指定的点序列所定义的聚合物的内部,使用指定的填充模式。

public void FillPolygon(Brush brush, Point[] points, FillMode fillMode)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

points Point ( )

序列 Aspose.Imaging.Point 结构,代表聚合物的垂直填充。

fillMode FillMode

是 Aspose.Imaging.FillMode 列表的成员,决定了填充的风格。

Exceptions

ArgumentNullException

brush’ is null.-or-points’ is null.

FillRectangle(直角,直角)

填补由 Aspose.Imaging.Rectangle 结构所指定的直角的内部。

public void FillRectangle(Brush brush, Rectangle rect)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

rect Rectangle

Aspose.Imaging.Rectangle 代表要填满的直角的结构。

Exceptions

ArgumentNullException

brush’ is null.

FillRectangle(布什,RectangleF)

填补由 Aspose.Imaging.RectangleF 结构所指定的直角的内部。

public void FillRectangle(Brush brush, RectangleF rect)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

rect RectangleF

Aspose.Imaging.RectangleF 构成要填满的直角。

Exceptions

ArgumentNullException

brush’ is null.

FillRectangle(海洋,海洋,海洋,海洋)

填补一个直角的内部,由一对坐标,宽度和高度指定。

public void FillRectangle(Brush brush, float x, float y, float width, float height)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

x float

要填补直角的左上角的 x 协调。

y float

要填补直角的左上角的 y 协调。

width float

直角的宽度要填满。

height float

直角的高度要填满。

Exceptions

ArgumentNullException

brush’ is null.

FillRectangle(布, int, int, int, int)

填补一个直角的内部,由一对坐标,宽度和高度指定。

public void FillRectangle(Brush brush, int x, int y, int width, int height)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

x int

要填补直角的左上角的 x 协调。

y int

要填补直角的左上角的 y 协调。

width int

直角的宽度要填满。

height int

直角的高度要填满。

Exceptions

ArgumentNullException

brush’ is null.

FillRectangles(直角,直角[])

填补一系列由 Aspose.Imaging.Rectangle 规定的直角结构的内部。

public void FillRectangles(Brush brush, Rectangle[] rects)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

rects Rectangle ( )

序列 Aspose.Imaging.Rectangle 结构,代表要填补的直角。

Exceptions

ArgumentNullException

brush’ is null or rects’ is null.

FillRectangles(布什,RectangleF[])

它填补了由 Aspose.Imaging.RectangleF 结构所规定的一系列直角的内部。

public void FillRectangles(Brush brush, RectangleF[] rects)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

rects RectangleF ( )

序列 Aspose.Imaging.Rectangle 结构,代表要填补的直角。

Exceptions

ArgumentNullException

brush’ is null or rects’ is null.

FillRegion(布鲁塞尔, 地区)

填补一个 Aspose.Imaging.Region 的内部。

public void FillRegion(Brush brush, Region region)

Parameters

brush Brush

Aspose.Imaging.Brush 定义填充的特性。

region Region

Aspose.Imaging. 代表要填写的区域。

Exceptions

ArgumentNullException

brush’ is null.-or-region’ is null.

~Graphics()

protected ~Graphics()

MeasureString(字体、字体、SizeF、StringFormat)

测量指定的文本行与指定的参数

public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat)

Parameters

text string

文本要测量。

font Font

字体要测量。

layoutArea SizeF

Layout 區域

stringFormat StringFormat

序列格式。

Returns

SizeF

测量文本字符串的像素大小

MultiplyTransform(Matrix)

多元化 Aspose.Imaging.Matrix 代表本 Aspose.Imaging.Graphics 所指定的 Aspose.Imaging.Matrix 所指定的 Aspose.Imaging.Matrix 所指定的地质转型。

public void MultiplyTransform(Matrix matrix)

Parameters

matrix Matrix

Aspose.Imaging.Matrix 用它来多元化地质转型。

MultiplyTransform(马特里克,马特里克)

多元化 Aspose.Imaging.Matrix 代表本 Aspose.Imaging.Graphics 所指定的 Aspose.Imaging.Matrix 在指定的顺序中的本地地地质转型。

public void MultiplyTransform(Matrix matrix, MatrixOrder order)

Parameters

matrix Matrix

Aspose.Imaging.Matrix 用它来多元化地质转型。

order MatrixOrder

一个 Aspose.Imaging.MatrixOrder 指定在哪个目的增加两个矩阵。

ResetTransform()

重新设置 Aspose.Imaging.Graphics. 将属性转化为身份。

public void ResetTransform()

RotateTransform(航海)

旋转本地地数学转换为指定的数量,这种方法将旋转转向转换。

public void RotateTransform(float angle)

Parameters

angle float

旋转的角度。

RotateTransform(航海,MatrixOrder)

旋转本地地数学转换为指定的数量在指定的顺序。

public void RotateTransform(float angle, MatrixOrder order)

Parameters

angle float

旋转的角度。

order MatrixOrder

一个 Aspose.Imaging.MatrixOrder 指定是否附加或附加旋转矩阵。

ScaleTransform(航海,航海)

按所指定的数量进行地质转换,这种方法将扩展矩阵转换为转换。

public void ScaleTransform(float sx, float sy)

Parameters

sx float

以哪个尺寸在X轴方向进行转换。

sy float

以何量在 y-axis 方向进行转换。

ScaleTransform(航海,航海,MatrixOrder)

按指定顺序的指定数量进行地理转换。

public void ScaleTransform(float sx, float sy, MatrixOrder order)

Parameters

sx float

以哪个尺寸在X轴方向进行转换。

sy float

以何量在 y-axis 方向进行转换。

order MatrixOrder

一个 Aspose.Imaging.MatrixOrder 指定是否要扩展或扩展扩展矩阵。

TranslateTransform(航海,航海)

翻译本地地数学转换为指定的尺寸,这种方法将翻译与转换有关。

public void TranslateTransform(float dx, float dy)

Parameters

dx float

翻译的值为x。

dy float

翻译的价值在Y。

TranslateTransform(航海,航海,MatrixOrder)

翻译本地地数学转型,根据指定的尺寸在指定的顺序。

public void TranslateTransform(float dx, float dy, MatrixOrder order)

Parameters

dx float

翻译的值为x。

dy float

翻译的价值在Y。

order MatrixOrder

命令(提交或附加)适用翻译。

 中文