dotnet / dotnet/wpf

[Question] [XPS] Drawing a Visual is always being rasterized

Open
#4,466 4 comments 1 reaction 0 assignees View on GitHub
Needs minimal repro project
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

XPS: When drawing a Visual on a DrawingContext of a FixedPage, the image is being rasterized and losing the Vector quality.

```
DrawingContextWrapper cntxt;
Visual visualToDraw;
// ...

var drawing = VisualTreeHelper.GetDrawing(visualToDraw); // <-- vector
System.Windows.Media.ImageSource image = new DrawingImage(drawing);
cntxt.Canvas.DrawImage(image, drawingBounds.ToRect()); // <-- raster
```

How to draw a Visual on a DrawingContext as a vector without it being rasterized (XPS)?

(found something related but not really the same: https://stackoverflow.com/questions/6490576/wpf-image-vector-format-export-xps/ )

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.