Comments (9)
I hope your team considers adding a method to draw these type of vector XAML objects. Its a perfect candidate for your API since it is the only retained graphics library akin to the WPF version.
from windowscompositionsamples.
@themoretheless
That method you mentioned is not equal to WPF DrawingImage, by use WPF DrawingImage, you can set it as Image control's source, and then change the Image control's pixel size to scale your vector image to any pixel size you want. This is awesome for vector image scaling scenarios. But UWP can't do this.
from windowscompositionsamples.
Currently, there is no support for the XAML vector object (I think this is what you are referring to: https://msdn.microsoft.com/en-us/library/cc294508.aspx) using the Windows.UI.Composition API set.
from windowscompositionsamples.
I have a large WPF desktop app that I want to convert to UWP. All the artwork (which there is a lot of) was built in Expression Design and exported as XAML vector drawings which are imported as resources. So how do you work with vector drawings in UWP?
from windowscompositionsamples.
So what is the SpriteVisual's CompositionDrawingImage? Isn't that for XAML vector drawings?
from windowscompositionsamples.
SpriteVisual
exposes a CompositionBrush
via the Brush
property. Examples of some brushes available are:
CompositionColorBrush
which is used for solid colorsCompositionEffectBrush
which is used for effectsCompositionSurfaceBrush
which is used for surfaces
Currently, Windows.UI.Composition
does not have a CompositionDrawingImage type.
The CompositionDrawingSurface
type is leveraged for rendering content like bitmaps, not XAML vector objects.
For truly custom rendered content you can leverage Win2D and CompositionDrawingSurface. Link to Win2D sample: here
However, I don't believe that this addresses the question you asking, which is whether or not you can leverage vector objects exported from Expression Design in a UWP application?
I'm not that familiar with the types and format that Expression Design uses during export to answer your specific question; however, if those types are something like Windows.UI.Xaml.Shapes
it might be possible to use them together with a Windows.UI.Xaml.Controls.Canvas
in a UWP.
from windowscompositionsamples.
Win2D is not a retained mode model and Windows.UI.XAML.Controls.Canvas in UWP is not low level enough to be performant with thousands of drawings like the visual system in WPF is. What Expression Design outputs is not specific to it but just standard XAML vector drawings. Here is an example:
<DrawingGroup x:Key="TrackCurved1_1"> <DrawingGroup.Children> <GeometryDrawing Brush="#0036A3C0" Geometry="F1 M 549,51L 549,-1L 601,-1L 601,51L 549,51 Z "/> <GeometryDrawing Brush="#FFAAAAAA" Geometry="F1 M 593.5,48.5L 595,50C 595.833,50 596.667,50 597.5,49.5833C 598.333,49.1667 599.167,48.3333 599.583,47.5C 600,46.6667 600,45.8333 600,45L 598.531,43.5313C 581.5,26.5 578.5,19.0125 578.5,5.5L 578.5,3.5C 578,3 577.5,2.5 576.583,2.25C 575.667,2 574.333,2 573.417,2.25C 572.5,2.5 572,3 571.5,3.5L 571.5,5.5C 571.5,21 575.5,30.5 593.5,48.5 Z "> <GeometryDrawing.Pen> <Pen LineJoin="Round" Brush="#FF000000"/> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingGroup.Children> </DrawingGroup>
WPF consumes stuff like this very nicely. The great advantage is that you can modify these drawings at run time through a DOM once loaded from the resource files, they are hardware accelerated, they can be placed anywhere (XAML control contents, overlays, deep trees), they can be transformed and animated with 0 visual loss, and all of that in a retained mode. Expression Design, Photoshop, and other vector tool plugins can generate this XAML easy and be inserted in your WPF app with a simple cut and paste. So you're telling me there is no UWP equivalent? Are there plans to create a presentation layer as good and productive as WPF for UWP?
from windowscompositionsamples.
Thanks for the DrawingGroup example. Unfortunately, I'm unaware of any replacement/equivalent for DrawingGroup from WPF.
from windowscompositionsamples.
Draw vector in UWP canvas
http://stackoverflow.com/a/36439591
from windowscompositionsamples.
Related Issues (20)
- GraphicsCaptureItem.CreateFromVisual has blur
- A little doubt about about code in ThumbnailLighting.xaml.cs HOT 3
- Build error in VS2019 and VS2019 preview HOT 3
- Does Windows.UI.Composition support Direct3D 12?
- how to apply effects to any shape of area of an xaml element or visual element? HOT 2
- AnimationController.Progress always return zero HOT 2
- Add sample for Snap points / Inertia modifiers
- Use Windows Community Toolkit library instead of custom code HOT 1
- Navigation Flow example crashing HOT 1
- Grammatical error HOT 1
- WindowsComposition Animation End Event missing. HOT 1
- Is Windows Composition API dead? HOT 4
- Channel 9 links on Resources page re-direct to the same Microsoft Docs page HOT 1
- Taking a screenshot of windows with AllowsTransparency="True" HOT 1
- Can we have C++ samples?
- Official DirectComposition Interop
- Looks like a bug in ImageLoader.cs
- Docs on IAnimationObject and CompositionAnimation.SetExpressionReferenceParameter HOT 2
- Crash when quickly minimize/restore window HOT 1
- Update to .NET 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from windowscompositionsamples.