GraphicsPath
内容
[
隐藏
]GraphicsPath class
表示一系列相连的直线和曲线。这个类不能被继承。
public sealed class GraphicsPath : ObjectWithBounds
构造函数
| 姓名 | 描述 |
|---|---|
| GraphicsPath() | 初始化GraphicsPath类. |
| GraphicsPath(Figure[]) | 初始化GraphicsPath类. |
| GraphicsPath(FillMode) | 初始化GraphicsPath类. |
| GraphicsPath(Figure[], FillMode) | 初始化GraphicsPath类. |
特性
| 姓名 | 描述 |
|---|---|
| override Bounds { get; } | 获取或设置对象的边界。 |
| Figures { get; } | 获取路径数字。 |
| FillMode { get; set; } | 获取或设置一个FillMode枚举,它决定了这个形状的内部如何GraphicsPath已满。 |
方法
| 姓名 | 描述 |
|---|---|
| AddFigure(Figure) | 添加一个新人物。 |
| AddFigures(Figure[]) | 添加新人物。 |
| AddPath(GraphicsPath) | 附加指定的GraphicsPath到这条路。 |
| AddPath(GraphicsPath, bool) | 附加指定的GraphicsPath到这条路。 |
| DeepClone() | 执行此图形路径的深度克隆。 |
| Flatten() | 将此路径中的每条曲线转换为一系列相连的线段。 |
| Flatten(Matrix) | 应用指定的变换,然后转换此曲线中的每条曲线GraphicsPath成一系列连接的线段。 |
| Flatten(Matrix, float) | 转换此曲线中的每条曲线GraphicsPath成一系列连接的线段。 |
| override GetBounds(Matrix) | 获取对象的边界。 |
| override GetBounds(Matrix, Pen) | 获取对象的边界。 |
| IsOutlineVisible(Point, Pen) | 表示指定点是否包含在(下)此轮廓的范围内GraphicsPath绘制时指定Pen . |
| IsOutlineVisible(PointF, Pen) | 表示指定点是否包含在(下)此轮廓的范围内GraphicsPath绘制时指定Pen . |
| IsOutlineVisible(float, float, Pen) | 表示指定点是否包含在(下)此轮廓的范围内GraphicsPath绘制时指定Pen . |
| IsOutlineVisible(int, int, Pen) | 表示指定点是否包含在(下)此轮廓的范围内GraphicsPath绘制时指定Pen . |
| IsOutlineVisible(Point, Pen, Graphics) | 表示指定点是否包含在(下)此轮廓的范围内GraphicsPath绘制时指定Pen并使用指定的Graphics . |
| IsOutlineVisible(PointF, Pen, Graphics) | 表示指定点是否包含在(下)此轮廓的范围内GraphicsPath绘制时指定Pen并使用指定的Graphics . |
| IsOutlineVisible(float, float, Pen, Graphics) | 表示指定点是否包含在(下)此轮廓的范围内GraphicsPath绘制时指定Pen并使用指定的Graphics . |
| IsOutlineVisible(int, int, Pen, Graphics) | 表示指定点是否包含在(下)此轮廓的范围内GraphicsPath绘制时指定Pen并使用指定的Graphics . |
| IsVisible(Point) | 表示指定的点是否包含在这个范围内GraphicsPath . |
| IsVisible(PointF) | 表示指定的点是否包含在这个范围内GraphicsPath . |
| IsVisible(float, float) | 表示指定的点是否包含在这个范围内GraphicsPath . |
| IsVisible(int, int) | 表示指定的点是否包含在这个范围内GraphicsPath . |
| IsVisible(Point, Graphics) | 表示指定的点是否包含在这个范围内GraphicsPath . |
| IsVisible(PointF, Graphics) | 表示指定的点是否包含在这个范围内GraphicsPath . |
| IsVisible(float, float, Graphics) | 表示指定的点是否包含在这个范围内GraphicsPath在指定的可见剪辑区域中Graphics . |
| IsVisible(int, int, Graphics) | 表示指定的点是否包含在这个范围内GraphicsPath , 使用指定的Graphics . |
| RemoveFigure(Figure) | 删除图形。 |
| RemoveFigures(Figure[]) | 删除人物。 |
| Reset() | 清空图形路径并设置FillMode至Alternate . |
| Reverse() | 颠倒每个形状中的图形、形状和点的顺序GraphicsPath . |
| override Transform(Matrix) | 将指定的变换应用于形状。 |
| Warp(PointF[], RectangleF) | 将由矩形和平行四边形定义的扭曲变换应用于此GraphicsPath . |
| Warp(PointF[], RectangleF, Matrix) | 将由矩形和平行四边形定义的扭曲变换应用于此GraphicsPath . |
| Warp(PointF[], RectangleF, Matrix, WarpMode) | 将由矩形和平行四边形定义的扭曲变换应用于此GraphicsPath . |
| Warp(PointF[], RectangleF, Matrix, WarpMode, float) | 将由矩形和平行四边形定义的扭曲变换应用于此GraphicsPath . |
| Widen(Pen) | 为路径添加额外的轮廓。 |
| Widen(Pen, Matrix) | 为GraphicsPath . |
| Widen(Pen, Matrix, float) | 替换这个GraphicsPath当用指定的笔绘制此路径时,带有包围填充区域的曲线。 |
例子
此示例使用 GraphicsPath 和 Graphics 类在图像表面上创建和操作图形。示例在 GraphicsPath 类的帮助下创建一个新图像(Tiff 类型),清除表面并绘制路径。最后调用 Graphics 类公开的 DrawPath 方法来渲染表面上的路径。
[C#]
//创建一个FileStream实例
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.tiff", System.IO.FileMode.Create))
{
//创建一个TiffOptions实例并设置它的各种属性
Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
//设置ImageOptions实例的来源
tiffOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//创建一个Image实例
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(tiffOptions, 500, 500))
{
//创建并初始化一个Graphics类的实例
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//清除图形表面
graphics.Clear(Color.Wheat);
//创建GraphicsPath类的实例
Aspose.Imaging.GraphicsPath graphicspath = new Aspose.Imaging.GraphicsPath();
//创建一个Figure类的实例
Aspose.Imaging.Figure figure = new Aspose.Imaging.Figure();
//将形状添加到图形对象
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));
//将Figure对象添加到GraphicsPath
graphicspath.AddFigure(figure);
//使用颜色为黑色的 Pen 对象绘制路径
graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), graphicspath);
// 保存所有更改。
image.Save();
}
}
也可以看看
- class ObjectWithBounds
- 命名空间 Aspose.Imaging
- 部件 Aspose.Imaging