Questions tagged [win2d]

Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics.

Win2D is designed as an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C# and C++ developers writing Windows Store apps for Windows 10, Windows 8.1 and Windows Phone 8.1. It utilizes the Direct2D, and integrates with XAML and CoreWindow.

193 questions
24
votes
1 answer

UWP: Calculate Transformation based on ScrollViewer

I have a windows universal app where I am rendering a scene with DirectX. I want to make use of the Scrollviewer and therefore I render my scene behind the Scrollviewer and want to calculate the scene transformation based on the Scrollviewer. It…
SebastianStehle
  • 2,409
  • 1
  • 22
  • 32
13
votes
2 answers

how to apply mask to CompositionBrush

How do I apply alpha mask, or clipping mask, so everything except the rectangle will be…
Liero
  • 25,216
  • 29
  • 151
  • 297
11
votes
1 answer

How to calculate the height of a FontFamily with Win2D (Line Spacing)?

I would like to know how to calculate the height of a given a font (with its properties, like size, weight, style...) in a Window Universal Application using Win2D. I previously used a CanvasTextLayout, but it requires a text to work, like in this…
SuperJMN
  • 13,110
  • 16
  • 86
  • 185
11
votes
2 answers

How to calculate the size of a piece of text in Win2D

I am writing an application for Windows 10 using Win2D and I'm trying to draw a shape which scales dynamically to fit whatever text happens to be in it. What I'd like to do is work out how big a particular string would be with a given…
DomAyre
  • 828
  • 1
  • 11
  • 23
7
votes
3 answers

UWP Composition - Apply opacity mask to top 30px of a ListView

How can I apply an effect to a ListView where the top 30px graduate from fully transparent to fully opaque? The idea is that as you scroll down, the top items gradually fade away. I am building a UWP application where the design calls for the top…
DarenMay
  • 319
  • 4
  • 14
5
votes
1 answer

UWP 10 RenderTargetBitmap a cropped area of UIElement in UWP 10

How does one crop a RenderTargetBitmap? The equivalent of: RenderTargetBitmap bmp = new RenderTargetBitmap(); await bmp.RenderAsync(element , cropRect ); This question seems simple enough, yet there seems to be no real way of doing it. The…
MB.
  • 1,303
  • 12
  • 19
4
votes
1 answer

Drawing editable and selectable shapes with Win2D?

I've used System.Windows.Shapes before to add Shapes to Canvas-controls. They can be used like objects and the visuals change as I edit the fields. I can also add event handlers for clicks etc. I'd need this kind of functionality by using Win2D. Is…
W0lfw00ds
  • 2,018
  • 14
  • 23
4
votes
2 answers

How can I simulate a DeviceLost event with Win2D?

I have a CanvasControl in a UWP app and I've noticed when I leave my Surface alone for a while and it goes to sleep automatically, the CanvasControl no longer works after resuming. The previously drawn bitmap is now blank. I tried to simulate…
Laith
  • 6,071
  • 1
  • 33
  • 60
4
votes
2 answers

Win2D CanvasBitmap vs Microsoft.UI.Composition CompositionImage

EDIT: They removed the CompositionImage in the last build ... I would like to know the difference between Win2D CanvasBitmap and Microsoft.UI.Composition CompositionImage. In both case I was able to display images but I don't really know/understand…
pellea
  • 359
  • 3
  • 21
3
votes
0 answers

Can we use Win2D in a .NET Core (3.1) project?

I searched for NuGet package for Win2d and only found something for UWP. Can we use Win2D in a WPF Core(3.1) project?
Eric Ouellet
  • 10,996
  • 11
  • 84
  • 119
3
votes
1 answer

Is there a way to change how Parallel.Foreach interlaces an array that its operating on?

I'm using Parallel.Foreach to operate over a large array where each array element corresponds to a line in a bitmap image. However, Parallel.Foreach appears to allocate a fix number of threads, say 6 threads, and gives 1/6 of the array to the first…
Bimo
  • 5,987
  • 2
  • 39
  • 61
3
votes
2 answers

Is Win2D yet available in C++/WinRT?

I need to use win2D in my cppwinrt project. Using the Win2D sample file as a model I’ve tried to mimic its setup, putting in the package file for win2d from that project, duplicating the custom build step, but I can’t get it to compile. I remember…
user3743210
  • 201
  • 2
  • 13
3
votes
1 answer

Win2D Get semantic tag value

I'm using Win2D.UWP to get the System font set. I need to filter the queried fonts and group them in categories like "Serif", "Sans-Serif", "Decorative", etc. (Like Adobe apps or Corel Font Manager). As far as I've researched that information can be…
Leisvan
  • 105
  • 1
  • 7
3
votes
0 answers

System.MissingMethodException: Method not found

On Windows 10 I'm developing a universal app. I have a project targeting from build 10240 to the Anniversary Edition(14393). I'm using the nuget Win2d.uwp and whilst developing the app in debug and release everything works fine. I can generate a…
Fritjof Berggren
  • 3,178
  • 5
  • 35
  • 57
3
votes
3 answers

win2D uwp won't save a highlight stroke in an inkcanvas

I'm desperately trying to save a highlight stroke as a png. I'm using win2d for UWP to make this work. It works well for strokes with 100% opacity, but when I set DrawAsHighlighter = true;, the saved png is empty, fully transparent. Here's my code…
Kinemu
  • 31
  • 4
1
2 3
12 13