Class Graphics
Tên không gian: Aspose.Imaging Tổng hợp: Aspose.Imaging.dll (25.4.0)
Nó đại diện cho đồ họa theo động cơ đồ họa được sử dụng trong bộ sưu tập hiện tại.
public sealed class Graphics
Inheritance
Thành viên thừa kế
object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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)
Bắt đầu một ví dụ mới của lớp Aspose.Imaging.Graphics.
public Graphics(Image sourceImage)
Parameters
sourceImage
Image
Nguồn hình ảnh
Properties
Clip
Nhận hoặc đặt khu vực clip.
public Region Clip { get; set; }
Giá trị bất động sản
CompositingQuality
Nhận hoặc đặt chất lượng compositing.
public CompositingQuality CompositingQuality { get; set; }
Giá trị bất động sản
Dpix
Nhận độ phân giải ngang của Aspose.Imaging.Graphics.
public float DpiX { get; }
Giá trị bất động sản
Dpiy
Nhận độ phân giải dọc của Aspose.Imaging.Graphics này.
public float DpiY { get; }
Giá trị bất động sản
Image
nhận được hình ảnh
public Image Image { get; }
Giá trị bất động sản
InterpolationMode
Nhận hoặc đặt chế độ interpolation.
public InterpolationMode InterpolationMode { get; set; }
Giá trị bất động sản
IsInBeginUpdateCall
Nhận một giá trị cho thấy liệu đồ họa có trong trạng thái gọi BeginUpdate hay không.
public bool IsInBeginUpdateCall { get; }
Giá trị bất động sản
PageScale
Nhận hoặc đặt quy mô giữa các đơn vị thế giới và các trang cho Aspose.Imaging.Graphics.
public float PageScale { get; set; }
Giá trị bất động sản
PageUnit
Nhận hoặc đặt đơn vị đo được sử dụng cho tọa độ trang trong Aspose.Imaging.Graphics này.
public GraphicsUnit PageUnit { get; set; }
Giá trị bất động sản
PaintableImageOptions
Nhận hoặc đặt các tùy chọn hình ảnh, được sử dụng để tạo hình ảnh vactor màu để vẽ.
public ImageOptionsBase PaintableImageOptions { get; set; }
Giá trị bất động sản
SmoothingMode
Nhận hoặc đặt chế độ sơn.
public SmoothingMode SmoothingMode { get; set; }
Giá trị bất động sản
TextRenderingHint
Nhận hoặc đặt văn bản rendering hint.
public TextRenderingHint TextRenderingHint { get; set; }
Giá trị bất động sản
Transform
Nhận hoặc đặt một bản sao của biến đổi thế giới địa phương cho Aspose.Imaging.Graphics này.
public Matrix Transform { get; set; }
Giá trị bất động sản
Methods
BeginUpdate()
Các hiệu ứng đồ họa được áp dụng sau đó sẽ không được áp dụng ngay lập tức thay vì EndUpdate sẽ gây ra việc áp dụng tất cả các hiệu ứng cùng một lúc.
public void BeginUpdate()
Remarks
Lưu ý các hiệu ứng sau khi BeginUpdate được gọi sẽ không được áp dụng trong trường hợp EndUpdate không được gọi.
Clear(Color)
Làm sạch bề mặt đồ họa bằng cách sử dụng màu cụ thể.
public void Clear(Color color)
Parameters
color
Color
Màu sắc để làm sạch bề mặt đồ họa.
Examples
Các ví dụ này sử dụng các lớp GraphicsPath và đồ họa để tạo và thao túng các hình ảnh trên một bề mặt Hình ảnh. Ví dụ tạo ra một bức ảnh mới (một loại Tiff), làm sạch bãi biển và kéo các con đường với sự giúp đỡ của lớp 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();
}
}
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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(Cây, biển, biển, biển, biển, biển, biển)
Vẽ một hố đại diện cho một phần của một ellipse được chỉ định bởi một cặp tọa độ, một chiều rộng, và một chiều cao.
public void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của hố.
x
float
X-coordinate của góc trên bên trái của góc thẳng định nghĩa ellipse.
y
float
Y-koordinate của góc trên bên trái của góc thẳng định nghĩa ellipse.
width
float
Chiều rộng của góc thẳng định nghĩa ellipse.
height
float
Độ cao của góc thẳng định nghĩa ellipse.
startAngle
float
góc trong độ đo theo cách đồng hồ từ x-axis đến điểm khởi đầu của hố.
sweepAngle
float
góc trong độ đo theo cách đồng hồ từ parameter startAngle’ để kết thúc điểm của arc.
Exceptions
pen’ is null.
DrawArc(Pen, RectangleF, float, float)
Vẽ một hố đại diện cho một phần của một ellipse được chỉ định bởi một cấu trúc Aspose.Imaging.RectangleF.
public void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của hố.
rect
RectangleF
WL17_.RectangleF cấu trúc xác định ranh giới của ellipse.
startAngle
float
góc trong độ đo theo cách đồng hồ từ x-axis đến điểm khởi đầu của hố.
sweepAngle
float
góc trong độ đo theo cách đồng hồ từ parameter startAngle’ để kết thúc điểm của arc.
Exceptions
pen’ is null
DrawArc(Nhãn hiệu: int, int, int, int, int, int)
Vẽ một hố đại diện cho một phần của một ellipse được chỉ định bởi một cặp tọa độ, một chiều rộng, và một chiều cao.
public void DrawArc(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của hố.
x
int
X-coordinate của góc trên bên trái của góc thẳng định nghĩa ellipse.
y
int
Y-koordinate của góc trên bên trái của góc thẳng định nghĩa ellipse.
width
int
Chiều rộng của góc thẳng định nghĩa ellipse.
height
int
Độ cao của góc thẳng định nghĩa ellipse.
startAngle
int
góc trong độ đo theo cách đồng hồ từ x-axis đến điểm khởi đầu của hố.
sweepAngle
int
góc trong độ đo theo cách đồng hồ từ parameter startAngle’ để kết thúc điểm của arc.
Exceptions
pen’ is null.
DrawArc(Pen, Rectangle, float, float)
Vẽ một hố đại diện cho một phần của một ellipse được chỉ định bởi một cấu trúc Aspose.Imaging.Rectangle.
public void DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của hố.
rect
Rectangle
WL17_.RectangleF cấu trúc xác định ranh giới của ellipse.
startAngle
float
góc trong độ đo theo cách đồng hồ từ x-axis đến điểm khởi đầu của hố.
sweepAngle
float
góc trong độ đo theo cách đồng hồ từ parameter startAngle’ để kết thúc điểm của arc.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
pen’ is null.
DrawBezier(Nhãn hiệu: Float, Float, Float, Float, Float, Float)
Nó vẽ một dòng Bézier được định nghĩa bởi bốn cặp phối hợp được đặt hàng đại diện cho các điểm.
public void DrawBezier(Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của curve.
x1
float
X-coordinate của điểm khởi đầu của curve.
y1
float
Y-coordinate của điểm khởi đầu của curve.
x2
float
X-coordinate của điểm kiểm soát đầu tiên của curve.
y2
float
Y-koordinate của điểm kiểm soát đầu tiên của curve.
x3
float
X-coordinate của điểm kiểm soát thứ hai của curve.
y3
float
Y-koordinate của điểm kiểm soát thứ hai của curve.
x4
float
X-coordinate của điểm kết thúc của curve.
y4
float
Y-koordinate của điểm kết thúc của curve.
Exceptions
pen’ is null.
DrawBezier(Tính năng: PointF, PointF, PointF)
Nó vẽ một dòng Bézier được xác định bởi bốn cấu trúc Aspose.Imaging.PointF.
public void DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của curve.
pt1
PointF
WL17_.PointF cấu trúc đại diện cho điểm khởi đầu của curve.
pt2
PointF
WL17_.PointF cấu trúc đại diện cho điểm kiểm soát đầu tiên cho curve.
pt3
PointF
WL17_.PointF cấu trúc đại diện cho điểm kiểm soát thứ hai cho curve.
pt4
PointF
WL17_.PointF cấu trúc đại diện cho điểm kết thúc của curve.
Exceptions
pen’ is null.
DrawBezier(Điểm, điểm, điểm, điểm)
Nó vẽ một spline Bézier được xác định bởi bốn cấu trúc Aspose.Imaging.Point.
public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
Parameters
pen
Pen
WL17_.Pen cấu trúc mà xác định màu sắc, chiều rộng, và phong cách của curve.
pt1
Point
WL17_.Thông điểm cấu trúc đại diện cho điểm khởi đầu của curve.
pt2
Point
WL17_.Thông điểm cấu trúc đại diện cho điểm kiểm soát đầu tiên cho curve.
pt3
Point
WL17_.Thông điểm cấu trúc đại diện cho điểm kiểm soát thứ hai cho curve.
pt4
Point
WL17_.Thông điểm cấu trúc đại diện cho điểm kết thúc của curve.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
pen’ is null.
DrawBeziers(Vị trí, điểm[])
Tắt một loạt các splines của Bézier từ một chuỗi các cấu trúc Aspose.Imaging.Point.
public void DrawBeziers(Pen pen, Point[] points)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của curve.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point đại diện cho các điểm xác định curve.
Exceptions
pen’ is null.-or-
points’ is null.
DrawBeziers(Đánh giá PointF[])
Nó kéo một loạt các splines của Bézier từ một chuỗi các cấu trúc Aspose.Imaging.PointF.
public void DrawBeziers(Pen pen, PointF[] points)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của curve.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF đại diện cho các điểm xác định curve.
Exceptions
pen’ is null.-or-
points’ is null.
DrawClosedCurve(Đánh giá PointF[])
Nó rút ra một dòng cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.PointF. phương pháp này sử dụng một căng thẳng mặc định của 0.5 và W L17.FillMode.Alternate chế độ điền.
public void DrawClosedCurve(Pen pen, PointF[] points)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF định nghĩa spline.
Exceptions
pen’ is null.-or-
points’ is null.
DrawClosedCurve(Đánh giá PointF[ ], float)
Tắt một dòng cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.PointF bằng cách sử dụng một căng thẳng cụ thể. phương pháp này dùng chế độ lấp đầy mặc định Wl17.FillMode.Alternate.
public void DrawClosedCurve(Pen pen, PointF[] points, float tension)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF định nghĩa spline.
tension
float
Giá trị lớn hơn hoặc tương đương với 0.0F mà chỉ định căng thẳng của curve.
Exceptions
pen’ is null.-or-
points’ is null.
DrawClosedCurve(Vị trí, điểm[])
Nó rút ra một dòng cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.Point. phương pháp này sử dụng một căng thẳng mặc định của 0.5 và W L17.FillMode.Alternate chế độ điền.
public void DrawClosedCurve(Pen pen, Point[] points)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point định nghĩa spline.
Exceptions
pen’ is null.-or-
points’ is null.
DrawClosedCurve(Vị trí, điểm[ ], float)
Tắt một dòng cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.Point bằng cách sử dụng một căng thẳng cụ thể. phương pháp này dùng chế độ lấp đầy mặc định Wl17.FillMode.Alternate.
public void DrawClosedCurve(Pen pen, Point[] points, float tension)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point định nghĩa spline.
tension
float
Giá trị lớn hơn hoặc tương đương với 0.0F mà chỉ định căng thẳng của curve.
Exceptions
pen’ is null.-or-
points’ is null.
DrawCurve(Đánh giá PointF[])
Nó kéo một spline cardinal thông qua một chuỗi cụ thể của Aspose.Imaging.PointF cấu trúc. phương pháp này sử dụng một căng thẳng mặc định của 0.5.
public void DrawCurve(Pen pen, PointF[] points)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF định nghĩa spline.
Exceptions
pen’ is null.-or-
points’ is null.
DrawCurve(Đánh giá PointF[ ], float)
Vẽ một dòng cardinal thông qua một chuỗi cụ thể của các cấu trúc Aspose.Imaging.PointF bằng cách sử dụng một căng thẳng nhất định.
public void DrawCurve(Pen pen, PointF[] points, float tension)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF đại diện cho các điểm định nghĩa của curve.
tension
float
Giá trị lớn hơn hoặc tương đương với 0.0F mà chỉ định căng thẳng của curve.
Exceptions
pen’ is null.-or-
points’ is null.
DrawCurve(Đánh giá PointF[ ], int , int)
Nó vẽ một dòng cardinal thông qua một chuỗi cụ thể của các cấu trúc Aspose.Imaging.PointF. Vẽ bắt đầu miễn phí ngay từ đầu của dòng.Phương pháp này sử dụng một căng thẳng mặc định của 0.5.
public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF định nghĩa spline.
offset
int
Tùy chọn từ yếu tố đầu tiên trong chuỗi của point’ parameter đến điểm khởi đầu trong curve.
numberOfSegments
int
Số lượng phân đoạn sau khi điểm khởi đầu phải được bao gồm trong vòng tròn.
Exceptions
pen’ is null.-or-
points’ is null.
DrawCurve(Đánh giá PointF[ ], int , int , float)
Vẽ một dòng cardinal thông qua một chuỗi cụ thể của các cấu trúc Aspose.Imaging.PointF bằng cách sử dụng một căng thẳng nhất định.
public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments, float tension)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF định nghĩa spline.
offset
int
Tùy chọn từ yếu tố đầu tiên trong chuỗi của point’ parameter đến điểm khởi đầu trong curve.
numberOfSegments
int
Số lượng phân đoạn sau khi điểm khởi đầu phải được bao gồm trong vòng tròn.
tension
float
Giá trị lớn hơn hoặc tương đương với 0.0F mà chỉ định căng thẳng của curve.
Exceptions
pen’ is null.-or-
points’ is null.
DrawCurve(Vị trí, điểm[])
Vẽ một spline cardinal thông qua một chuỗi cụ thể của Aspose.Imaging.Point cấu trúc.
public void DrawCurve(Pen pen, Point[] points)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point định nghĩa spline.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
pen’ is null.-or-
points’ is null.
DrawCurve(Vị trí, điểm[ ], float)
Vẽ một dòng cardinal thông qua một chuỗi cụ thể của các cấu trúc Aspose.Imaging.Point bằng cách sử dụng một căng thẳng nhất định.
public void DrawCurve(Pen pen, Point[] points, float tension)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point định nghĩa spline.
tension
float
Giá trị lớn hơn hoặc tương đương với 0.0F mà chỉ định căng thẳng của curve.
Exceptions
pen’ is null.-or-
points’ is null.
DrawCurve(Vị trí, điểm[ ], int , int , float)
Vẽ một dòng cardinal thông qua một chuỗi cụ thể của các cấu trúc Aspose.Imaging.Point bằng cách sử dụng một căng thẳng nhất định.
public void DrawCurve(Pen pen, Point[] points, int offset, int numberOfSegments, float tension)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng và chiều cao của curve.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point định nghĩa spline.
offset
int
Tùy chọn từ yếu tố đầu tiên trong chuỗi của point’ parameter đến điểm khởi đầu trong curve.
numberOfSegments
int
Số lượng phân đoạn sau khi điểm khởi đầu phải được bao gồm trong vòng tròn.
tension
float
Giá trị lớn hơn hoặc tương đương với 0.0F mà chỉ định căng thẳng của curve.
Exceptions
pen’ is null.-or-
points’ is null.
DrawEllipse(Đồ họa: RectangleF)
Tắt một ellipse được xác định bởi một giới hạn Aspose.Imaging.RectangleF.
public void DrawEllipse(Pen pen, RectangleF rect)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của ellipse.
rect
RectangleF
WL17_.RectangleF cấu trúc xác định ranh giới của ellipse.
Exceptions
pen’ is null.
DrawEllipse(Cây, float, float, float, float)
Nó vẽ một ellipse được định nghĩa bởi một góc thẳng kết nối được chỉ định bởi một cặp tọa độ, một chiều cao, và một chiều rộng.
public void DrawEllipse(Pen pen, float x, float y, float width, float height)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của ellipse.
x
float
X-coordinate của góc trên bên trái của góc thẳng kết nối xác định ellipse.
y
float
Y-koordinate của góc trên bên trái của góc thẳng kết nối xác định ellipse.
width
float
Chiều rộng của góc thẳng kết nối xác định ellipse.
height
float
Độ cao của góc thẳng kết nối xác định ellipse.
Exceptions
pen’ is null.
DrawEllipse(Đồ họa, Rectangle)
Mở một ellipse được chỉ định bởi một cấu trúc giới hạn Aspose.Imaging.Rectangle.
public void DrawEllipse(Pen pen, Rectangle rect)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của ellipse.
rect
Rectangle
WL17_.Cấu trúc trực giác xác định ranh giới của ellipse.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
pen’ is null.
DrawEllipse(Nhãn hiệu: int, int, int, int)
Nó vẽ một ellipse được định nghĩa bởi một góc thẳng kết nối được chỉ định bởi một cặp tọa độ, một chiều cao, và một chiều rộng.
public void DrawEllipse(Pen pen, int x, int y, int width, int height)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của ellipse.
x
int
X-coordinate của góc trên bên trái của góc thẳng kết nối xác định ellipse.
y
int
Y-koordinate của góc trên bên trái của góc thẳng kết nối xác định ellipse.
width
int
Chiều rộng của góc thẳng kết nối xác định ellipse.
height
int
Độ cao của góc thẳng kết nối xác định ellipse.
Exceptions
pen’ is null.
DrawImage(Ảnh: PointF)
Hiển thị Aspose.Imaging.Graphics.Image, sử dụng kích thước vật lý ban đầu của nó, tại vị trí được chỉ định.
public void DrawImage(Image sourceImage, PointF point)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
point
PointF
WL17_.PointF cấu trúc đại diện cho góc trên bên trái của hình ảnh vẽ.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, float, float)
Hiển thị Aspose.Imaging.Graphics.Image, sử dụng kích thước vật lý ban đầu của nó, tại vị trí được chỉ định.
public void DrawImage(Image sourceImage, float x, float y)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
x
float
X-coordinate của góc trên bên trái của hình ảnh vẽ.
y
float
Sự phối hợp y của góc trên bên trái của hình ảnh vẽ.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, RectangleF)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, RectangleF rect)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rect
RectangleF
WL17_.RectangleF cấu trúc chỉ định vị trí và kích thước của hình ảnh được vẽ.
Exceptions
sourceImage’ is null.
DrawImage(Ảnh, Rectangle, GraphicsUnit)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, Rectangle rectDestination, GraphicsUnit graphicsUnit)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rectDestination
Rectangle
Mục đích trực tiếp.
graphicsUnit
GraphicsUnit
Đơn vị đồ họa
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, RectangleF, GraphicsUnit)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, RectangleF rectDestination, GraphicsUnit graphicsUnit)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rectDestination
RectangleF
Mục đích trực tiếp.
graphicsUnit
GraphicsUnit
Đơn vị đồ họa
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, Rectangle, GraphicsUnit, ImageAttributes)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, Rectangle rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rectDestination
Rectangle
Mục đích trực tiếp.
graphicsUnit
GraphicsUnit
Đơn vị đồ họa
imageAttributes
ImageAttributes
Hình ảnh thuộc tính.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, RectangleF, GraphicsUnit, ImageAttributes)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, RectangleF rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rectDestination
RectangleF
Destination rectangle để kéo vào.
graphicsUnit
GraphicsUnit
Đơn vị đồ họa
imageAttributes
ImageAttributes
Hình ảnh thuộc tính.
Exceptions
sourceImage’ is null.
DrawImage(Ảnh, Rectangle, Rectangle, GraphicsUnit)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, Rectangle rectSource, Rectangle rectDestination, GraphicsUnit graphicsUnit)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rectSource
Rectangle
Nguồn trực tiếp
rectDestination
Rectangle
Mục đích đường thẳng
graphicsUnit
GraphicsUnit
Đơn vị đồ họa
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, RectangleF, RectangleF, GraphicsUnit)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, RectangleF rectSource, RectangleF rectDestination, GraphicsUnit graphicsUnit)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rectSource
RectangleF
Nguồn trực tiếp
rectDestination
RectangleF
Mục đích đường thẳng
graphicsUnit
GraphicsUnit
Đơn vị đồ họa
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, Rectangle, Rectangle, GraphicsUnit, ImageAttributes)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, Rectangle rectSource, Rectangle rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rectSource
Rectangle
Nguồn trực tiếp
rectDestination
Rectangle
Mục đích đường thẳng
graphicsUnit
GraphicsUnit
Đơn vị đồ họa
imageAttributes
ImageAttributes
Hình ảnh thuộc tính.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, RectangleF, RectangleF, GraphicsUnit, ImageAttributes)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, RectangleF rectSource, RectangleF rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rectSource
RectangleF
Nguồn gốc trực tiếp.
rectDestination
RectangleF
Mục đích trực tiếp.
graphicsUnit
GraphicsUnit
Đơn vị đồ họa để sử dụng.
imageAttributes
ImageAttributes
Hình ảnh thuộc tính để sử dụng.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, điểm[])
Vẽ phần cụ thể của hình ảnh " ở vị trí cụ thể và với kích thước cụ thể.
public void DrawImage(Image image, Point[] destPoints)
Parameters
image
Image
Hình ảnh để vẽ.
destPoints
Point
[ ]
Ba cấu trúc PointF định nghĩa một parallelogram.
DrawImage(Hình ảnh, điểm[ ], Vòng thẳng)
Vẽ phần cụ thể của hình ảnh " ở vị trí cụ thể và với kích thước cụ thể.
public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect)
Parameters
image
Image
Hình ảnh để vẽ.
destPoints
Point
[ ]
Ba cấu trúc PointF định nghĩa một parallelogram.
srcRect
Rectangle
Nguồn gốc trực tiếp.
DrawImage(Hình ảnh, điểm[ ], Rectangle , GraphicsUnit)
Vẽ phần cụ thể của hình ảnh " ở vị trí cụ thể và với kích thước cụ thể.
public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
Parameters
image
Image
Hình ảnh để vẽ.
destPoints
Point
[ ]
Ba cấu trúc PointF định nghĩa một parallelogram.
srcRect
Rectangle
Nguồn gốc trực tiếp.
srcUnit
GraphicsUnit
Các đơn vị đo
DrawImage(Hình ảnh, điểm[ ], Rectangle, GraphicsUnit, ImageAttributes)
Vẽ phần cụ thể của hình ảnh " ở vị trí cụ thể và với kích thước cụ thể.
public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttributes)
Parameters
image
Image
Hình ảnh để vẽ.
destPoints
Point
[ ]
Ba cấu trúc PointF định nghĩa một parallelogram.
srcRect
Rectangle
Nguồn gốc trực tiếp.
srcUnit
GraphicsUnit
Các đơn vị đo
imageAttributes
ImageAttributes
Hình ảnh thuộc tính.
DrawImage(Ảnh: PointF[])
Vẽ phần cụ thể của hình ảnh " ở vị trí cụ thể và với kích thước cụ thể.
public void DrawImage(Image image, PointF[] destPoints)
Parameters
image
Image
Hình ảnh để vẽ.
destPoints
PointF
[ ]
Ba cấu trúc PointF định nghĩa một parallelogram.
Exceptions
Hình ảnh
DrawImage(Ảnh: PointF[ ], RectangleF)
Vẽ phần cụ thể của hình ảnh " ở vị trí cụ thể và với kích thước cụ thể.
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect)
Parameters
image
Image
Hình ảnh để vẽ.
destPoints
PointF
[ ]
Ba cấu trúc PointF định nghĩa một parallelogram.
srcRect
RectangleF
Nguồn gốc trực tiếp.
DrawImage(Ảnh: PointF[ ], RectangleF, GraphicsUnit)
Vẽ phần cụ thể của hình ảnh " ở vị trí cụ thể và với kích thước cụ thể.
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
Parameters
image
Image
Hình ảnh để vẽ.
destPoints
PointF
[ ]
Ba cấu trúc PointF định nghĩa một parallelogram.
srcRect
RectangleF
Nguồn gốc trực tiếp.
srcUnit
GraphicsUnit
Các đơn vị đo
DrawImage(Ảnh: PointF[ ], RectangleF, GraphicsUnit, ImageAttributes)
Vẽ phần cụ thể của hình ảnh " ở vị trí cụ thể và với kích thước cụ thể.
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttributes)
Parameters
image
Image
Hình ảnh để vẽ.
destPoints
PointF
[ ]
Ba cấu trúc PointF định nghĩa một parallelogram.
srcRect
RectangleF
Nguồn gốc trực tiếp.
srcUnit
GraphicsUnit
Các đơn vị đo
imageAttributes
ImageAttributes
Hình ảnh thuộc tính.
DrawImage(Hình ảnh, float, float, float)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, float x, float y, float width, float height)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
x
float
X-coordinate của góc trên bên trái của hình ảnh vẽ.
y
float
Sự phối hợp y của góc trên bên trái của hình ảnh vẽ.
width
float
Chiều rộng của hình ảnh rút ra.
height
float
Độ cao của hình ảnh rút ra.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, điểm)
Hiển thị Aspose.Imaging.Graphics.Image, sử dụng kích thước vật lý ban đầu của nó, tại vị trí được chỉ định.
public void DrawImage(Image sourceImage, Point point)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
point
Point
WL17_.Thông điểm cấu trúc đại diện cho vị trí của góc trên bên trái của hình ảnh kéo.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, int, int)
Hình ảnh được chỉ định, sử dụng kích thước vật lý ban đầu của nó, tại vị trí được chỉ định bởi một cặp tọa độ.
public void DrawImage(Image sourceImage, int x, int y)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
x
int
X-coordinate của góc trên bên trái của hình ảnh vẽ.
y
int
Sự phối hợp y của góc trên bên trái của hình ảnh vẽ.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, rectangle)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, Rectangle rect)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rect
Rectangle
WL17_.Thể cấu trúc trực giác chỉ định vị trí và kích thước của hình ảnh được vẽ.
Exceptions
sourceImage’ is null.
DrawImage(Hình ảnh, int, int, int)
Hiển thị Aspose.Imaging.Graphics.Image ở vị trí và với kích thước được chỉ định.
public void DrawImage(Image sourceImage, int x, int y, int width, int height)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
x
int
X-coordinate của góc trên bên trái của hình ảnh vẽ.
y
int
Sự phối hợp y của góc trên bên trái của hình ảnh vẽ.
width
int
Chiều rộng của hình ảnh rút ra.
height
int
Độ cao của hình ảnh rút ra.
Exceptions
sourceImage’ is null.
DrawImageUnscaled(Hình ảnh, điểm)
Hiển thị một hình ảnh cụ thể bằng cách sử dụng kích thước vật lý ban đầu của nó tại một vị trí cụ thể.
public void DrawImageUnscaled(Image sourceImage, Point point)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
point
Point
WL17_.Thông điểm cấu trúc chỉ định góc trên bên trái của hình ảnh được vẽ.
Exceptions
sourceImage’ is null.
DrawImageUnscaled(Hình ảnh, int, int)
Hiển thị hình ảnh cụ thể bằng cách sử dụng kích thước vật lý ban đầu của nó tại vị trí được chỉ định bởi một cặp tọa độ.
public void DrawImageUnscaled(Image sourceImage, int x, int y)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
x
int
X-coordinate của góc trên bên trái của hình ảnh vẽ.
y
int
Sự phối hợp y của góc trên bên trái của hình ảnh vẽ.
Exceptions
sourceImage’ is null.
DrawImageUnscaled(Hình ảnh, rectangle)
Hiển thị một hình ảnh cụ thể bằng cách sử dụng kích thước vật lý ban đầu của nó tại một vị trí cụ thể.
public void DrawImageUnscaled(Image sourceImage, Rectangle rect)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rect
Rectangle
Aspose.Imaging.Rectangle mà chỉ định góc trên bên trái của hình ảnh được vẽ. Các thuộc tính X và Y của góc thẳng đặc biệt là góc bên phải trên.
Exceptions
sourceImage’ is null.
DrawImageUnscaled(Hình ảnh, int, int, int)
Hiển thị một hình ảnh cụ thể bằng cách sử dụng kích thước vật lý ban đầu của nó tại một vị trí cụ thể.
public void DrawImageUnscaled(Image sourceImage, int x, int y, int width, int height)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
x
int
X-coordinate của góc trên bên trái của hình ảnh vẽ.
y
int
Sự phối hợp y của góc trên bên trái của hình ảnh vẽ.
width
int
Parameters không được sử dụng.
height
int
Parameters không được sử dụng.
Exceptions
sourceImage’ is null.
DrawImageUnscaledAndClipped(Hình ảnh, rectangle)
Vẽ hình ảnh cụ thể mà không cần quy mô và vẽ nó, nếu cần thiết, để phù hợp với góc thẳng cụ thể.
public void DrawImageUnscaledAndClipped(Image sourceImage, Rectangle rect)
Parameters
sourceImage
Image
Hình ảnh để vẽ.
rect
Rectangle
Aspose.Imaging.Rectangle trong đó để vẽ hình ảnh.
Exceptions
sourceImage’ is null.
DrawLine(điểm, điểm, điểm)
Tắt một dòng kết nối hai cấu trúc Aspose.Imaging.Point.
public void DrawLine(Pen pen, Point point1, Point point2)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của dòng.
point1
Point
WL17_.Thông điểm cấu trúc đại diện cho điểm đầu tiên để kết nối.
point2
Point
WL17_.Thông điểm cấu trúc đại diện cho điểm thứ hai để kết nối.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
pen’ is null.
DrawLine(Tính năng: PointF, PointF)
Nhấn một dòng kết nối hai cấu trúc Aspose.Imaging.PointF.
public void DrawLine(Pen pen, PointF point1, PointF point2)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của dòng.
point1
PointF
WL17_.PointF cấu trúc đại diện cho điểm đầu tiên để kết nối.
point2
PointF
WL17_.PointF cấu trúc đại diện cho điểm thứ hai để kết nối.
Exceptions
pen’ is null.
DrawLine(Nhãn hiệu: int, int, int, int)
Đặt một dòng kết nối hai điểm được chỉ định bởi các cặp phối hợp.
public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của dòng.
x1
int
X-coordinate của điểm đầu tiên.
y1
int
Y-tương thích của điểm đầu tiên.
x2
int
X-coordinate của điểm thứ hai.
y2
int
Y-tương thích của điểm thứ hai
Exceptions
pen’ is null.
DrawLine(Cây, float, float, float, float)
Đặt một dòng kết nối hai điểm được chỉ định bởi các cặp phối hợp.
public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của dòng.
x1
float
X-coordinate của điểm đầu tiên.
y1
float
Y-tương thích của điểm đầu tiên.
x2
float
X-coordinate của điểm thứ hai.
y2
float
Y-tương thích của điểm thứ hai
Exceptions
pen’ is null.
DrawLines(Vị trí, điểm[])
Nó kéo một loạt các phân đoạn đường kết nối một chuỗi các cấu trúc Aspose.Imaging.Point.
public void DrawLines(Pen pen, Point[] points)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của các phân đoạn đường.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point đại diện cho các điểm để kết nối.
Exceptions
pen’ is null.-or-
points’ is null.
Dòng points" chứa ít hơn 2 điểm.
DrawLines(Đánh giá PointF[])
Nó kéo một loạt các phân đoạn đường kết nối một chuỗi các cấu trúc Aspose.Imaging.PointF.
public void DrawLines(Pen pen, PointF[] points)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của các phân đoạn đường.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF đại diện cho các điểm để kết nối.
Exceptions
pen’ is null.-or-
points’ is null.
Dòng points" chứa ít hơn 2 điểm.
DrawPath(Hình ảnh, GraphicsPath)
Nhập một Aspose.Imaging.GraphicsPath.
public void DrawPath(Pen pen, GraphicsPath path)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của con đường.
path
GraphicsPath
WL17_.GraphicsPath để vẽ.
Examples
Các ví dụ này sử dụng các lớp GraphicsPath và đồ họa để tạo và thao túng các hình ảnh trên một bề mặt Hình ảnh. Ví dụ tạo ra một bức ảnh mới (một loại Tiff), làm sạch bãi biển và kéo các con đường với sự giúp đỡ của lớp 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
pen’ is null.-or-
path’ is null.
DrawPie(Pen, RectangleF, float, float)
Nó vẽ một hình dạng chân được định nghĩa bởi một ellipse được chỉ định bởi cấu trúc Aspose.Imaging.RectangleF và hai đường ray.
public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng, và phong cách của hình dạng pie.
rect
RectangleF
WL17_.RectangleF cấu trúc đại diện cho đường thẳng kết nối mà xác định ellipse từ đó hình dạng chân đến.
startAngle
float
Ngôi góc được đo bằng độ theo chiều đồng hồ từ x-axis đến phía đầu tiên của hình dạng pie.
sweepAngle
float
Các góc được đo bằng độ theo cách đồng hồ từ startParameterAngle’ đến phía bên thứ hai của hình dạng pie.
Exceptions
pen’ is null.
DrawPie(Cây, biển, biển, biển, biển, biển, biển)
Nó vẽ một hình dạng chân được định nghĩa bởi một ellipse được chỉ định bởi một cặp tọa độ, một chiều rộng, một chiều cao, và hai đường ray.
public void DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng, và phong cách của hình dạng pie.
x
float
X-coordinate của góc phía trên bên trái của góc thẳng kết nối mà xác định ellipse từ đó hình dạng chân đến.
y
float
Y-koordinate của góc phía trên bên trái của góc thẳng kết nối mà xác định ellipse từ đó hình dạng chân đến.
width
float
Chiều rộng của góc thẳng kết nối mà xác định ellipse từ đó hình dạng pie đến.
height
float
Độ cao của góc thẳng kết nối mà xác định sự lấp lánh từ đó hình dạng chân đến.
startAngle
float
Ngôi góc được đo bằng độ theo chiều đồng hồ từ x-axis đến phía đầu tiên của hình dạng pie.
sweepAngle
float
Các góc được đo bằng độ theo cách đồng hồ từ startParameterAngle’ đến phía bên thứ hai của hình dạng pie.
Exceptions
pen’ is null.
DrawPie(Pen, Rectangle, float, float)
Nó vẽ một hình dạng chân được định nghĩa bởi một ellipse được chỉ định bởi cấu trúc Aspose.Imaging.Rectangle và hai đường ray.
public void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng, và phong cách của hình dạng pie.
rect
Rectangle
WL17_.Thể cấu trúc thẳng thắn đại diện cho đường thẳng kết nối mà xác định ellipse từ đó hình dạng chân đến.
startAngle
float
Ngôi góc được đo bằng độ theo chiều đồng hồ từ x-axis đến phía đầu tiên của hình dạng pie.
sweepAngle
float
Các góc được đo bằng độ theo cách đồng hồ từ startParameterAngle’ đến phía bên thứ hai của hình dạng pie.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
pen’ is null.
DrawPie(Nhãn hiệu: int, int, int, int, int, int)
Nó vẽ một hình dạng chân được định nghĩa bởi một ellipse được chỉ định bởi một cặp tọa độ, một chiều rộng, một chiều cao, và hai đường ray.
public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng, và phong cách của hình dạng pie.
x
int
X-coordinate của góc phía trên bên trái của góc thẳng kết nối mà xác định ellipse từ đó hình dạng chân đến.
y
int
Y-koordinate của góc phía trên bên trái của góc thẳng kết nối mà xác định ellipse từ đó hình dạng chân đến.
width
int
Chiều rộng của góc thẳng kết nối mà xác định ellipse từ đó hình dạng pie đến.
height
int
Độ cao của góc thẳng kết nối mà xác định sự lấp lánh từ đó hình dạng chân đến.
startAngle
int
Ngôi góc được đo bằng độ theo chiều đồng hồ từ x-axis đến phía đầu tiên của hình dạng pie.
sweepAngle
int
Các góc được đo bằng độ theo cách đồng hồ từ startParameterAngle’ đến phía bên thứ hai của hình dạng pie.
Exceptions
pen’ is null.
DrawPolygon(Đánh giá PointF[])
Nó vẽ một polygon được định nghĩa bởi một loạt các cấu trúc Aspose.Imaging.PointF.
public void DrawPolygon(Pen pen, PointF[] points)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của polygon.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF đại diện cho các dọc của polygon.
Exceptions
pen’ is null.-or-
points’ is null.
DrawPolygon(Vị trí, điểm[])
Nó vẽ một polygon được định nghĩa bởi một loạt các cấu trúc Aspose.Imaging.Point.
public void DrawPolygon(Pen pen, Point[] points)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của polygon.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Thông điểm đại diện cho các dọc của polygon.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
pen’ is null.
DrawRectangle(Đồ họa: RectangleF)
Nó kéo một góc thẳng được chỉ định bởi một cấu trúc Aspose.Imaging.RectangleF.
public void DrawRectangle(Pen pen, RectangleF rect)
Parameters
pen
Pen
Một Aspose.Imaging.Pen mà xác định màu sắc, chiều rộng và phong cách của góc thẳng.
rect
RectangleF
Một cấu trúc Aspose.Imaging.RectangleF đại diện cho góc thẳng để vẽ.
Exceptions
pen’ is null.
DrawRectangle(Đồ họa, Rectangle)
Nó kéo một góc thẳng được chỉ định bởi một cấu trúc Aspose.Imaging.Rectangle.
public void DrawRectangle(Pen pen, Rectangle rect)
Parameters
pen
Pen
Một Aspose.Imaging.Pen mà xác định màu sắc, chiều rộng và phong cách của góc thẳng.
rect
Rectangle
A Aspose.Imaging.Rectangle cấu trúc đại diện cho các đường thẳng để vẽ.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
pen’ is null.
DrawRectangle(Cây, float, float, float, float)
Vẽ một góc thẳng được chỉ định bởi một cặp phối hợp, một chiều rộng, và một chiều cao.
public void DrawRectangle(Pen pen, float x, float y, float width, float height)
Parameters
pen
Pen
Một Aspose.Imaging.Pen mà xác định màu sắc, chiều rộng và phong cách của góc thẳng.
x
float
X-coordinate của góc trên bên trái của góc thẳng để vẽ.
y
float
Sự phối hợp y của góc trên bên trái của góc thẳng để vẽ.
width
float
Chiều rộng của đường thẳng để vẽ.
height
float
Độ cao của góc thẳng để vẽ.
Exceptions
pen’ is null.
DrawRectangle(Nhãn hiệu: int, int, int, int)
Vẽ một góc thẳng được chỉ định bởi một cặp phối hợp, một chiều rộng, và một chiều cao.
public void DrawRectangle(Pen pen, int x, int y, int width, int height)
Parameters
pen
Pen
WL17_.Pen xác định màu sắc, chiều rộng và phong cách của góc thẳng.
x
int
X-coordinate của góc trên bên trái của góc thẳng để vẽ.
y
int
Sự phối hợp y của góc trên bên trái của góc thẳng để vẽ.
width
int
Chiều rộng của đường thẳng để vẽ.
height
int
Độ cao của đường thẳng để vẽ.
Exceptions
pen’ is null.
DrawRectangles(Đồ họa: RectangleF[])
Nó vẽ một loạt các góc thẳng được chỉ định bởi Aspose.Imaging.RectangleF cấu trúc.
public void DrawRectangles(Pen pen, RectangleF[] rects)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng, và phong cách của các đường thẳng.
rects
RectangleF
[ ]
Một loạt các cấu trúc Aspose.Imaging.RectangleF đại diện cho các góc thẳng để vẽ.
Exceptions
pen’ is null.-or-
rects’ is null.
DrawRectangles(Đồ họa, Rectangle[])
Nó vẽ một loạt các góc thẳng được chỉ định bởi Aspose.Imaging.Rectangle cấu trúc.
public void DrawRectangles(Pen pen, Rectangle[] rects)
Parameters
pen
Pen
WL17_.Pen mà xác định màu sắc, chiều rộng, và phong cách của các đường thẳng.
rects
Rectangle
[ ]
Màn hình của Aspose.Imaging.Rectangle cấu trúc đại diện cho các khung thẳng để vẽ.
Examples
Ví dụ này cho thấy việc tạo và sử dụng các đối tượng Pen. ví dụ tạo ra một hình ảnh mới và vẽ Rectangles trên bề mặt Hình ảnh.
//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
pen’ is null.-or-
rects’ is null.
DrawString(string, Font, Brush, float, float)
Vẽ dòng văn bản cụ thể ở vị trí cụm với các đối tượng Aspose.Imaging.Brush và __ WL16__ .Font cụt.
public void DrawString(string s, Font font, Brush brush, float x, float y)
Parameters
s
string
Cắt để vẽ.
font
Font
Aspose.Imaging.Thông tin định nghĩa định dạng văn bản của dòng.
brush
Brush
WL17_.Brush xác định màu sắc và cấu trúc của văn bản vẽ.
x
float
X-coordinate của góc trên bên trái của văn bản vẽ.
y
float
Y-coordinate của góc trên bên trái của văn bản vẽ.
Exceptions
brush’ is null.-or-
s’ is null.
DrawString(Nhung, Font, Brush, PointF)
Vẽ dòng văn bản cụ thể ở vị trí cụm với các đối tượng Aspose.Imaging.Brush và __ WL16__ .Font cụt.
public void DrawString(string s, Font font, Brush brush, PointF point)
Parameters
s
string
Cắt để vẽ.
font
Font
Aspose.Imaging.Thông tin định nghĩa định dạng văn bản của dòng.
brush
Brush
WL17_.Brush xác định màu sắc và cấu trúc của văn bản vẽ.
point
PointF
WL17_.PointF cấu trúc chỉ định góc trên bên trái của văn bản kéo.
Examples
Ví dụ này sử dụng lớp Graphics để tạo ra các hình dạng nguyên thủy trên bề mặt Hình ảnh. Để chứng minh hoạt động, ví dụ tạo một hình ảnh mới trong định dạng PNG và vẽ những hình thức nguyên tử trên diện tích Ảnh bằng các phương pháp Vẽ được trình bày bởi lớp Grafics.
//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
brush’ is null.-or-
s’ is null.
DrawString(string, Font, Brush, float, float, StringFormat)
Vẽ dòng văn bản cụ thể ở vị trí cụm với các đối tượng Aspose.Imaging.Brush và Wl17.Font được chỉ định bằng cách sử dụng các thuộc tính định dạng của __ WL16__ .StringFormat.
public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format)
Parameters
s
string
Cắt để vẽ.
font
Font
Aspose.Imaging.Thông tin định nghĩa định dạng văn bản của dòng.
brush
Brush
WL17_.Brush xác định màu sắc và cấu trúc của văn bản vẽ.
x
float
X-coordinate của góc trên bên trái của văn bản vẽ.
y
float
Y-coordinate của góc trên bên trái của văn bản vẽ.
format
StringFormat
WL17_.StringFormat mà chỉ định các thuộc tính định dạng, chẳng hạn như đường dẫn và phù hợp, được áp dụng cho văn bản vẽ.
Exceptions
brush’ is null.-or-
s’ is null.
DrawString(string, Font, Brush, PointF, StringFormat)
Vẽ dòng văn bản cụ thể ở vị trí cụm với các đối tượng Aspose.Imaging.Brush và Wl17.Font được chỉ định bằng cách sử dụng các thuộc tính định dạng của __ WL16__ .StringFormat.
public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format)
Parameters
s
string
Cắt để vẽ.
font
Font
Aspose.Imaging.Thông tin định nghĩa định dạng văn bản của dòng.
brush
Brush
WL17_.Brush xác định màu sắc và cấu trúc của văn bản vẽ.
point
PointF
WL17_.PointF cấu trúc chỉ định góc trên bên trái của văn bản kéo.
format
StringFormat
WL17_.StringFormat mà chỉ định các thuộc tính định dạng, chẳng hạn như đường dẫn và phù hợp, được áp dụng cho văn bản vẽ.
Exceptions
brush’ is null.-or-
s’ is null.
DrawString(Vòng chữ, Font, Brush, RectangleF)
Vẽ dòng văn bản cụ thể trong khung chính xác được chỉ định với các đối tượng Aspose.Imaging.Brush và WR17.Font.
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle)
Parameters
s
string
Cắt để vẽ.
font
Font
Aspose.Imaging.Thông tin định nghĩa định dạng văn bản của dòng.
brush
Brush
WL17_.Brush xác định màu sắc và cấu trúc của văn bản vẽ.
layoutRectangle
RectangleF
WL17_.RectangleF cấu trúc chỉ định vị trí của văn bản kéo.
Exceptions
brush’ is null.-or-
s’ is null.
DrawString(string, Font, Brush, RectangleF, StringFormat)
Vẽ dòng văn bản cụ thể trong khung chính xác được chỉ định với các đối tượng Aspose.Imaging.Brush và W L17.Font bằng cách sử dụng các thuộc tính định dạng của các đặc điểm __ WL 17__ .StringFormat.
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
Parameters
s
string
Cắt để vẽ.
font
Font
Aspose.Imaging.Thông tin định nghĩa định dạng văn bản của dòng.
brush
Brush
WL17_.Brush xác định màu sắc và cấu trúc của văn bản vẽ.
layoutRectangle
RectangleF
WL17_.RectangleF cấu trúc chỉ định vị trí của văn bản kéo.
format
StringFormat
WL17_.StringFormat mà chỉ định các thuộc tính định dạng, chẳng hạn như đường dẫn và phù hợp, được áp dụng cho văn bản vẽ.
Exceptions
brush’ is null.-or-
s’ is null.-or-
brush’ is null.
EndUpdate()
Kết thúc caching các hoạt động đồ họa bắt đầu sau khi BeginUpdate được gọi. các hoạt động đồ họa trước đó sẽ được áp dụng ngay lập tức khi gọi phương pháp này.
public void EndUpdate()
FillClosedCurve(Đánh giá, PointF[])
Nó điền vào nội thất của một đường cong cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.PointF. phương pháp này sử dụng một căng thẳng mặc định của 0.5 và Wl17.FillMode.Alternate hoàn thành chế độ.
public void FillClosedCurve(Brush brush, PointF[] points)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF định nghĩa spline.
Exceptions
brush’ is null.-or-
points’ is null.
FillClosedCurve(Đánh giá, PointF[ ], Đồ chơi FillMode)
Chấp đầy nội thất của một vòng tròn cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.PointF bằng cách sử dụng chế độ điền cụ thể.
public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillMode)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF định nghĩa spline.
fillMode
FillMode
Thành viên của Aspose.Imaging.FillMode danh sách mà xác định cách curve được lấp đầy.
Exceptions
brush’ is null.-or-
points’ is null.
FillClosedCurve(Đánh giá, PointF[ ], FillMode , Float)
Chấp đầy nội thất của một vòng tròn cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.PointF bằng cách sử dụng chế độ đầy và căng thẳng cụ thể.
public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode, float tension)
Parameters
brush
Brush
A Aspose.Imaging.Brush mà xác định các đặc điểm của lấp đầy.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF định nghĩa spline.
fillmode
FillMode
Thành viên của Aspose.Imaging.FillMode danh sách mà xác định cách curve được lấp đầy.
tension
float
Giá trị lớn hơn hoặc tương đương với 0.0F mà chỉ định căng thẳng của curve.
Exceptions
brush’ is null.-or-
points’ is null.
FillClosedCurve(Bạch Dương, Point[])
Nó điền vào nội thất của một đường cong cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.Point. phương pháp này sử dụng một căng thẳng mặc định của 0.5 và W L17.FillMode.Alternate chế độ.
public void FillClosedCurve(Brush brush, Point[] points)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point định nghĩa spline.
Exceptions
brush’ is null.-or-
points’ is null.
FillClosedCurve(Bạch Dương, Point[ ], Đồ chơi FillMode)
Chấp đầy nội thất của một vòng tròn cardinal đóng được xác định bởi một loạt các cấu trúc Aspose.Imaging.Point bằng cách sử dụng chế độ điền cụ thể.
public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point định nghĩa spline.
fillmode
FillMode
Thành viên của Aspose.Imaging.FillMode danh sách mà xác định cách curve được lấp đầy.
Exceptions
brush’ is null.-or-
points’ is null.
FillClosedCurve(Bạch Dương, Point[ ], FillMode , Float)
Chấp đầy nội thất của một vòng tròn cardinal đóng kín được xác định bởi một loạt các cấu trúc Aspose.Imaging.Point bằng cách sử dụng chế độ điền và căng thẳng cụ thể.
public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode, float tension)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Point định nghĩa spline.
fillmode
FillMode
Thành viên của Aspose.Imaging.FillMode danh sách mà xác định cách curve được lấp đầy.
tension
float
Giá trị lớn hơn hoặc tương đương với 0.0F mà chỉ định căng thẳng của curve.
Exceptions
brush’ is null.-or-
points’ is null.
FillEllipse(Bơm, RectangleF)
Chấp đầy nội thất của một ellipse được định nghĩa bởi một góc thẳng kết nối được chỉ định bởi cấu trúc Aspose.Imaging.RectangleF.
public void FillEllipse(Brush brush, RectangleF rect)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
rect
RectangleF
WL17_.RectangleF cấu trúc đại diện cho đường thẳng kết nối xác định ellipse.
Exceptions
brush’ is null.
FillEllipse(Nước hoa, float, float, float)
Nó điền vào bên trong của một ellipse được xác định bởi một góc thẳng kết nối được chỉ định bởi một cặp tọa độ, một chiều rộng, và một chiều cao.
public void FillEllipse(Brush brush, float x, float y, float width, float height)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
x
float
X-coordinate của góc trên bên trái của góc thẳng kết nối xác định ellipse.
y
float
Y-koordinate của góc trên bên trái của góc thẳng kết nối xác định ellipse.
width
float
Chiều rộng của góc thẳng kết nối xác định ellipse.
height
float
Độ cao của góc thẳng kết nối xác định ellipse.
Exceptions
brush’ is null.
FillEllipse(Bơm, Rectangle)
Chấp đầy nội thất của một ellipse được xác định bởi một góc thẳng kết nối được chỉ định bằng một cấu trúc Aspose.Imaging.Rectangle.
public void FillEllipse(Brush brush, Rectangle rect)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
rect
Rectangle
WL17_.Cấu trúc trực tràng đại diện cho đường thẳng kết nối xác định ellipse.
Exceptions
brush’ is null.
FillEllipse(Nhãn hiệu: int, int, int, int)
Nó điền vào bên trong của một ellipse được xác định bởi một góc thẳng kết nối được chỉ định bởi một cặp tọa độ, một chiều rộng, và một chiều cao.
public void FillEllipse(Brush brush, int x, int y, int width, int height)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
x
int
X-coordinate của góc trên bên trái của góc thẳng kết nối xác định ellipse.
y
int
Y-koordinate của góc trên bên trái của góc thẳng kết nối xác định ellipse.
width
int
Chiều rộng của góc thẳng kết nối xác định ellipse.
height
int
Độ cao của góc thẳng kết nối xác định ellipse.
Exceptions
brush’ is null.
FillPath(Đồ họa, GraphicsPath)
Chấp đầy nội thất của một Aspose.Imaging.GraphicsPath.
public void FillPath(Brush brush, GraphicsPath path)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
path
GraphicsPath
WL17_.GraphicsPath đại diện cho con đường để điền.
Exceptions
brush’ is null.-or-
path’ is null.
FillPie(Bút chì, rectangle, float, float)
Nó điền vào nội thất của một phần chân được định nghĩa bởi một ellipse được chỉ định bởi cấu trúc Aspose.Imaging.RectangleF và hai đường ray.
public void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
rect
Rectangle
WL17_.Thể cấu trúc thẳng thắn đại diện cho đường thẳng kết nối mà xác định ellipse từ đó phần pie đến.
startAngle
float
góc trong độ đo theo cách đồng hồ từ x-axis đến phía đầu tiên của phần pie.
sweepAngle
float
góc trong độ đo theo cách đồng hồ từ parameter startAngle’ đến phía bên thứ hai của phần pie.
Examples
Ví dụ sau đây cho thấy làm thế nào để tạo ra một hình ảnh GIF hoạt hình từ các khối Gif cá nhân.
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
brush’ is null.
FillPie(Bút chì, RectangleF, float, float)
Nó điền vào nội thất của một phần chân được định nghĩa bởi một ellipse được chỉ định bởi cấu trúc Aspose.Imaging.RectangleF và hai đường ray.
public void FillPie(Brush brush, RectangleF rect, float startAngle, float sweepAngle)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
rect
RectangleF
WL17_.RectangleF cấu trúc đại diện cho đường thẳng kết nối mà xác định ellipse từ đó phần pie đến.
startAngle
float
góc trong độ đo theo cách đồng hồ từ x-axis đến phía đầu tiên của phần pie.
sweepAngle
float
góc trong độ đo theo cách đồng hồ từ parameter startAngle’ đến phía bên thứ hai của phần pie.
Exceptions
brush’ is null.
FillPie(Cây, float, float, float, float, float)
Nó điền vào nội thất của một phần chân được xác định bởi một ellipse được chỉ định bởi một cặp các tọa độ, một chiều rộng, một chiều cao, và hai đường ray.
public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
x
float
X-coordinate của góc phía trên bên trái của góc thẳng kết nối mà xác định ellipse từ đó phần pie đến.
y
float
Y-koordinate của góc phía trên bên trái của góc thẳng kết nối mà xác định ellipse từ đó phần pie đến.
width
float
Chiều rộng của góc thẳng kết nối mà xác định sự lấp lánh từ đó phần pie đến.
height
float
Độ cao của góc thẳng kết nối mà xác định sự lấp lánh từ đó phần pie đến.
startAngle
float
góc trong độ đo theo cách đồng hồ từ x-axis đến phía đầu tiên của phần pie.
sweepAngle
float
góc trong độ đo theo cách đồng hồ từ parameter startAngle’ đến phía bên thứ hai của phần pie.
Exceptions
brush’ is null.
FillPie(Dây, int, int, int, int, int, int)
Nó điền vào nội thất của một phần chân được xác định bởi một ellipse được chỉ định bởi một cặp các tọa độ, một chiều rộng, một chiều cao, và hai đường ray.
public void FillPie(Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
x
int
X-coordinate của góc phía trên bên trái của góc thẳng kết nối mà xác định ellipse từ đó phần pie đến.
y
int
Y-koordinate của góc phía trên bên trái của góc thẳng kết nối mà xác định ellipse từ đó phần pie đến.
width
int
Chiều rộng của góc thẳng kết nối mà xác định sự lấp lánh từ đó phần pie đến.
height
int
Độ cao của góc thẳng kết nối mà xác định sự lấp lánh từ đó phần pie đến.
startAngle
int
góc trong độ đo theo cách đồng hồ từ x-axis đến phía đầu tiên của phần pie.
sweepAngle
int
góc trong độ đo theo cách đồng hồ từ parameter startAngle’ đến phía bên thứ hai của phần pie.
Exceptions
brush’ is null.
FillPolygon(Đánh giá, PointF[])
Nó điền vào nội thất của một polygon được định nghĩa bởi một loạt các điểm được chỉ định bởi các cấu trúc Aspose.Imaging.PointF và W L17.FillMode.Alternate.
public void FillPolygon(Brush brush, PointF[] points)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF đại diện cho các dọc của polygon để lấp đầy.
Exceptions
brush’ is null.-or-
points’ is null.
FillPolygon(Đánh giá, PointF[ ], Đồ chơi FillMode)
Chấp đầy nội thất của một polygon được định nghĩa bởi một loạt các điểm được chỉ định bởi các cấu trúc Aspose.Imaging.PointF bằng cách sử dụng chế độ điền cụ thể.
public void FillPolygon(Brush brush, PointF[] points, FillMode fillMode)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
PointF
[ ]
Một loạt các cấu trúc Aspose.Imaging.PointF đại diện cho các dọc của polygon để lấp đầy.
fillMode
FillMode
Thành viên của Aspose.Imaging.FillMode danh sách mà xác định phong cách của lấp đầy.
Exceptions
brush’ is null.-or-
points’ is null.
FillPolygon(Bạch Dương, Point[])
Nó điền vào nội thất của một polygon được định nghĩa bởi một loạt các điểm được chỉ định bởi WL17_.Thông điểm cấu trúc và _www.fillmode.Alternate.
public void FillPolygon(Brush brush, Point[] points)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Thông điểm đại diện cho các dọc của polygon để lấp đầy.
Exceptions
brush’ is null.-or-
points’ is null.
FillPolygon(Bạch Dương, Point[ ], Đồ chơi FillMode)
Chấp đầy nội thất của một polygon được định nghĩa bởi một loạt các điểm được chỉ định bởi Aspose.Imaging.Thông điểm cấu trúc bằng cách sử dụng chế độ điền cụ thể.
public void FillPolygon(Brush brush, Point[] points, FillMode fillMode)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
points
Point
[ ]
Một loạt các cấu trúc Aspose.Imaging.Thông điểm đại diện cho các dọc của polygon để lấp đầy.
fillMode
FillMode
Thành viên của Aspose.Imaging.FillMode danh sách mà xác định phong cách của lấp đầy.
Exceptions
brush’ is null.-or-
points’ is null.
FillRectangle(Bơm, Rectangle)
Chấp đầy nội thất của một góc thẳng được chỉ định bởi một cấu trúc Aspose.Imaging.Rectangle.
public void FillRectangle(Brush brush, Rectangle rect)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
rect
Rectangle
WL17_.Thể cấu trúc trực quan đại diện cho trực tiếp để điền.
Exceptions
brush’ is null.
FillRectangle(Bơm, RectangleF)
Chấp đầy nội thất của một góc thẳng được chỉ định bởi một cấu trúc Aspose.Imaging.RectangleF.
public void FillRectangle(Brush brush, RectangleF rect)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
rect
RectangleF
WL17_.RectangleF cấu trúc đại diện cho đường thẳng để điền.
Exceptions
brush’ is null.
FillRectangle(Nước hoa, float, float, float)
Chấp đầy nội thất của một góc thẳng được chỉ định bởi một cặp tọa độ, một chiều rộng và một chiều cao.
public void FillRectangle(Brush brush, float x, float y, float width, float height)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
x
float
X-coordinate của góc trên bên trái của góc thẳng để điền.
y
float
Sự phối hợp y của góc trên bên trái của góc thẳng để lấp đầy.
width
float
Độ rộng của đường thẳng để lấp đầy.
height
float
Độ cao của đường thẳng để điền.
Exceptions
brush’ is null.
FillRectangle(Nhãn hiệu: int, int, int, int)
Chấp đầy nội thất của một góc thẳng được chỉ định bởi một cặp tọa độ, một chiều rộng và một chiều cao.
public void FillRectangle(Brush brush, int x, int y, int width, int height)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
x
int
X-coordinate của góc trên bên trái của góc thẳng để điền.
y
int
Sự phối hợp y của góc trên bên trái của góc thẳng để lấp đầy.
width
int
Độ rộng của đường thẳng để lấp đầy.
height
int
Độ cao của đường thẳng để điền.
Exceptions
brush’ is null.
FillRectangles(Bơm, Rectangle[])
Chấp đầy nội thất của một loạt các đường thẳng được chỉ định bởi Aspose.Imaging.Rectangle cấu trúc.
public void FillRectangles(Brush brush, Rectangle[] rects)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
rects
Rectangle
[ ]
Một loạt các cấu trúc Aspose.Imaging.Rectangle đại diện cho các đường thẳng để lấp đầy.
Exceptions
brush’ is null or
rects’ is null.
FillRectangles(Bơm, RectangleF[])
Chấp đầy nội thất của một loạt các đường thẳng được chỉ định bởi Aspose.Imaging.RectangleF cấu trúc.
public void FillRectangles(Brush brush, RectangleF[] rects)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
rects
RectangleF
[ ]
Một loạt các cấu trúc Aspose.Imaging.Rectangle đại diện cho các đường thẳng để lấp đầy.
Exceptions
brush’ is null or
rects’ is null.
FillRegion(Brush, Khu vực)
Chấp đầy nội thất của một Aspose.Imaging.Vùng.
public void FillRegion(Brush brush, Region region)
Parameters
brush
Brush
WL17_.Brush xác định các đặc điểm của lấp đầy.
region
Region
WL17_.Vùng đại diện cho khu vực để điền.
Exceptions
brush’ is null.-or-
region’ is null.
~Graphics()
protected ~Graphics()
MeasureString(string, Font, SizeF, StringFormat)
đo lường dòng văn bản cụ thể với các thông số nhất định
public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat)
Parameters
text
string
văn bản để đo.
font
Font
font để đo.
layoutArea
SizeF
Khu vực layout
stringFormat
StringFormat
định dạng string.
Returns
Kích thước trong pixel của dòng văn bản đo
MultiplyTransform(Matrix)
Tùy chỉnh Aspose.Imaging.Matrix mà đại diện cho sự biến đổi địa phương của W L 17.Graphics này bằng __ W L 18_ .Matrix cụ thể bằng cách đánh dấu w L 19 _ Matrix.
public void MultiplyTransform(Matrix matrix)
Parameters
matrix
Matrix
WL17_.Matrix bằng cách đó để tăng cường chuyển đổi địa phương.
MultiplyTransform(Matrix và MatrixOrder)
Tỷ phú Aspose.Imaging.Matrix đại diện cho sự biến đổi địa phương của Wl17.Graphics này bởi _ WL16__ trong thứ tự cụ thể.
public void MultiplyTransform(Matrix matrix, MatrixOrder order)
Parameters
matrix
Matrix
WL17_.Matrix bằng cách đó để tăng cường chuyển đổi địa phương.
order
MatrixOrder
A Aspose.Imaging.MatrixOrder mà chỉ định trong mục đích nào để gia tăng hai matrices.
ResetTransform()
Khôi phục lại Aspose.Imaging.Graphics.Transform property to identity.
public void ResetTransform()
RotateTransform(Sông)
xoay chuyển đổi địa phương theo số lượng được chỉ định. phương pháp này phụ thuộc vào chuyển đổi.
public void RotateTransform(float angle)
Parameters
angle
float
góc của xoay.
RotateTransform(Đánh giá MatrixOrder)
xoay chuyển đổi địa phương theo số lượng cụ thể trong lệnh cụ thể.
public void RotateTransform(float angle, MatrixOrder order)
Parameters
angle
float
góc của xoay.
order
MatrixOrder
A Aspose.Imaging.MatrixOrder mà chỉ ra liệu để bổ sung hoặc cài đặt matrix xoay.
ScaleTransform(Float , Float)
Tích thước biến đổi địa phương theo số lượng được chỉ định. phương pháp này phụ thuộc vào matrice quy mô để biến đổi.
public void ScaleTransform(float sx, float sy)
Parameters
sx
float
Số lượng mà để quy mô chuyển đổi trong hướng x-axis.
sy
float
Số lượng mà để quy mô chuyển đổi trong hướng y-axis.
ScaleTransform(Float, Float và MatrixOrder)
Tích thước biến đổi địa phương theo số lượng cụ thể trong lệnh cụ thể.
public void ScaleTransform(float sx, float sy, MatrixOrder order)
Parameters
sx
float
Số lượng mà để quy mô chuyển đổi trong hướng x-axis.
sy
float
Số lượng mà để quy mô chuyển đổi trong hướng y-axis.
order
MatrixOrder
A Aspose.Imaging.MatrixOrder cho biết liệu bạn có nên bổ sung hoặc cài đặt matrix.
TranslateTransform(Float , Float)
Chuyển đổi địa phương bằng các kích thước cụ thể. phương pháp này phụ thuộc vào dịch sang chuyển đổi.
public void TranslateTransform(float dx, float dy)
Parameters
dx
float
Giá trị của phiên dịch trong x.
dy
float
Giá trị của phiên dịch trong y.
TranslateTransform(Float, Float và MatrixOrder)
Bản dịch biến đổi địa phương theo kích thước cụ thể trong thứ tự cụ thể.
public void TranslateTransform(float dx, float dy, MatrixOrder order)
Parameters
dx
float
Giá trị của phiên dịch trong x.
dy
float
Giá trị của phiên dịch trong y.
order
MatrixOrder
Lệnh (prepend hoặc append) để áp dụng phiên dịch.