如何将图形组转换为单个静态图形或图形图像?

时间:2019-05-24 16:49:59

标签: c# wpf

如何将图形组转换为性能等同于单个图形几何图形的单个静态图形,图像或drawingImage。

我尝试使用组的几何图形绘制ImageDrawing,并在清除后再次将其添加到组中。

C#

DrawingGroup artGroup = new DrawingGroup();
//Added some geometry drawing and drawing groups to new group

       ImageDrawing imageDrawing = new ImageDrawing(new DrawingImage(artGroup), artGroup.Bounds);
       artGroup.Children.Clear();
       artGroup.Children.Add(imageDrawing);

我希望具有与以下类似的性能:

C#

 RectangleGeometry rectangle = new RectangleGeometry();
 rectangle.Rect = new Rect(point1, point2);
geometryDrawing = new GeometryDrawing(Brushs.Black(), null, geometryGroup);
artGroup.Children.Add(geometryDrawing);

0 个答案:

没有答案