Class PathResourceConverter
이름 공간 : Aspose.Imaging.FileFormats.Tiff.PathResources 모임: Aspose.Imaging.dll (25.4.0)
Aspose.Imaging.FileFormats.Tiff.PathResources.PathResource를 Aspose.Imaging.GraphicsPath로 변환하고 그 반대입니다.
public static class PathResourceConverter
Inheritance
object ← PathResourceConverter
상속 회원들
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
TIFF 이미지에서 Path Resources에서 Graphics Path를 만드십시오.
using (var image = (TiffImage)Image.Load("Bottle.tif"))
{
// Create the GraphicsPath using PathResources from TIFF image
var graphicsPath = PathResourceConverter.ToGraphicsPath(image.ActiveFrame.PathResources.ToArray(), image.ActiveFrame.Size);
var graphics = new Graphics(image);
// Draw red line and save the image
graphics.DrawPath(new Pen(Color.Red, 10), graphicsPath);
image.Save("BottleWithRedBorder.tif");
}
그래픽 경로를 사용하여 Path Resources를 만드십시오.
static void Main(string[] args)
{
using (var image = (TiffImage)Image.Load("Bottle.tif"))
{
// Create rectangular Figure for GraphicsPath
var figure = new Figure();
figure.AddShape(CreateBezierShape(100f, 100f, 500f, 100f, 500f, 1000f, 100f, 1000f));
// Create GraphicsPath using our Figure
var graphicsPath = new GraphicsPath();
graphicsPath.AddFigure(figure);
// Set PathResources using GraphicsPath
var pathResouze = PathResourceConverter.FromGraphicsPath(graphicsPath, image.Size);
image.ActiveFrame.PathResources = new List<pathresource>(pathResouze);
// Save the image
image.Save("BottleWithRectanglePath.tif");
}
}
private static BezierShape CreateBezierShape(params float[] coordinates)
{
var bezierPoints = CoordinatesToBezierPoints(coordinates).ToArray();
return new BezierShape(bezierPoints, true);
}
private static IEnumerable<pointf> CoordinatesToBezierPoints(float[] coordinates)
{
for (var coordinateIndex = 0; coordinateIndex < coordinates.Length; coordinateIndex += 2)
for (var index = 0; index < 3; index++)
yield return new PointF(coordinates[coordinateIndex], coordinates[coordinateIndex + 1]);
}</pointf></pathresource>
Methods
FromGraphicsPath(그래픽 패스, 크기)
Aspose.Imaging.GraphicsPath 예를 경로 자원으로 변환합니다.
public static PathResource[] FromGraphicsPath(GraphicsPath graphicsPath, Size imageSize)
Parameters
graphicsPath
GraphicsPath
그래픽의 길을 걷다.
imageSize
Size
이미지의 크기 입니다.
Returns
PathResource [ ] [ [ ]
도로의 자원
Exceptions
graphicsPath’ is null.
ToGraphicsPath(PathResource[ ] [ [ ], 크기 크기)
경로 자원을 Aspose.Imaging.GraphicsPath 예제로 변환합니다.
public static GraphicsPath ToGraphicsPath(PathResource[] pathResources, Size imageSize)
Parameters
pathResources
PathResource
[ ] [ [ ]
도로의 자원
imageSize
Size
이미지의 크기 입니다.
Returns
ASPOSE.Imaging.GraphicsPath 예를 들어
Exceptions
pathResources’ is null.