Win2D | use Windows Runtime API for immediate mode 2D graphics | Runtime Evironment library

 by   microsoft C++ Version: Current License: Non-SPDX

kandi X-RAY | Win2D Summary

kandi X-RAY | Win2D Summary

Win2D is a C++ library typically used in Server, Runtime Evironment applications. Win2D has no bugs, it has no vulnerabilities and it has medium support. However Win2D has a Non-SPDX License. You can download it from GitHub.

Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing apps for the Windows Universal Platform (UWP). It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow. Visit the DirectX Landing Page for more resources for DirectX developers.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Win2D has a medium active ecosystem.
              It has 1627 star(s) with 281 fork(s). There are 193 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 132 open issues and 709 have been closed. On average issues are closed in 54 days. There are 8 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Win2D is current.

            kandi-Quality Quality

              Win2D has 0 bugs and 0 code smells.

            kandi-Security Security

              Win2D has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Win2D code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Win2D has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              Win2D releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              It has 24145 lines of code, 0 functions and 330 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Win2D
            Get all kandi verified functions for this library.

            Win2D Key Features

            No Key Features are available at this moment for Win2D.

            Win2D Examples and Code Snippets

            No Code Snippets are available at this moment for Win2D.

            Community Discussions

            QUESTION

            .Net MAUI Windows Publishing
            Asked 2022-Feb-19 at 19:40

            I am trying to create a installable artifact of my MAUI Blazor application for windows. From all of my research I am to run the below command using MSBuild.

            Github issue

            ...

            ANSWER

            Answered 2022-Feb-19 at 19:40

            This is a two part answer. First my MAUI template was old, so I created a new project and copied over the files. Second, I needed to use a MAUI library as my common library.

            Source https://stackoverflow.com/questions/71159445

            QUESTION

            Fastest way to copy data from ReadOnlySpan to output with pixel conversion
            Asked 2022-Jan-04 at 19:41

            I'm having performance issue when I copy the data from input (ReadOnlySpan) to output (Span) using (Loops like 'for')

            there is Span.CopyTo, it's perfect and very fast but for now it's useless without converting the pixels.

            below is the code, I have feeling that there is some short way to do that instead of the current process:

            ...

            ANSWER

            Answered 2021-Dec-27 at 12:25

            I'm having performance issue when I copy the data from input (ReadOnlySpan) to output (Span) using (Loops like 'for')

            The the code you provided is already pretty safe and has the best complexity you're going get for pixel-by-pixel operations. The presence of nested for loops does not necessarily correspond to performance issues or increased complexity.

            I need help because I don't understand how the process is working, still very confused.. specially in the Slice part.

            This code looks like it's meant to convert one bitmap format to another. Bitmaps come in varying sizes and formats. Because of this they include an additional piece of information along with width and height, pitch.

            Pitch is the distance in bytes between two lines of pixel information, this is used to account for formats that don't include full 32/64bit color information.

            Knowing this I commented the method in question as to help explain what it's doing.

            Source https://stackoverflow.com/questions/70491483

            QUESTION

            MSTest v2 won't run with net5.0-windows
            Asked 2021-Oct-05 at 14:40

            I am trying to create a MSTest project for unit testing of our WinUI 3 development. I am able to run tests through the test explorer when targeting .NET 5.0.

            Project Reunion requires net5.0-windows10.0.19041 as the target framework. When I try to run tests targeting net5.0-windows10.0.19041 the project builds but the tests do not run. The output of the Test log below says the WinUI3-UnitTests.dll file is not found but WinUI3-UnitTests.dll does exist in the specified location.

            ...

            ANSWER

            Answered 2021-Oct-05 at 14:40

            Resolved by reverting MSTest.TestAdapter and MSTest.TestFramework back to version 2.2.3.

            Source https://stackoverflow.com/questions/69450999

            QUESTION

            error X3503: 'main_Impl': function return value missing semantics with "d2d1effecthelpers.hlsli"
            Asked 2021-Aug-04 at 15:13

            I am new to HLSL and is trying to compile a simple test with HLSL Helpers However, it doesn't compile. I want to compile shader for my Win2D UWP app.

            The code:

            ...

            ANSWER

            Answered 2021-Aug-04 at 15:12

            Should be fxc /T ps_4_0 /D D2D_ENTRY=main /Fo testShader.ps testShader.hlsl.

            You could/should use Visual Studio, it will do the ground work for you. Or just open "d2d1effecthelpers.hlsli" and it will say this:

            // To use these helpers, the following values must be defined before inclusion:

            // D2D_INPUT_COUNT - The number of texture inputs to the effect.

            // D2D_INPUT[N]_SIMPLE or D2D_INPUT[N]_COMPLEX - How the effect will sample each input. (If unspecificed, defaults to _COMPLEX.)

            // D2D_ENTRY - The name of the entry point being compiled. This will usually be defined on the command line at compilation time.

            Source https://stackoverflow.com/questions/68653091

            QUESTION

            Export UWP canvas to SVG
            Asked 2021-Mar-22 at 19:25

            I'm trying to create an SVG file from some shape objects(path geometries, ellipses etc.) drawn on XAML canvas controls (the canvases are rendered on top of each other inside grid controls). It looks like Win2D can provide the classes to generate the SVG file, but I'm struggling to figure out how to populate the CanvasSvgDocument class with the shapes.

            This is the only partial example I've found, but the answer seems to include a conversion to XML strings to load into the CanvasSvgDocument which seems like doing the same task twice (as SVG files are XML). Is anybody able to provide an example of how I might do this?

            My current best guess of what the resulting code might look like is:

            ...

            ANSWER

            Answered 2021-Mar-15 at 09:50

            You could use CanvasGeometry.CreateInk convert the ink strokes into geometry and use the relevant methods under the CanvasGeometry namespace to get the path, then write a custom class to read the parse path. Finally, the generated CanvasSvgDocument object is used to save the stream containing the svg content.

            Please refer to the following sample to do these steps. (Note: download Win2D.uwp package)

            XAML code:

            Source https://stackoverflow.com/questions/66626304

            QUESTION

            How to Get lists of all installed font families in uwp
            Asked 2021-Jan-04 at 14:21

            Can anyone tell me how I can get lists of all installed fonts in c# uwp? I just want to put those fonts in combo box. So, I just need a list that has all the installed fonts of the PC.

            I also tried to use Win2D but it gave me null output. My code:

            ...

            ANSWER

            Answered 2021-Jan-04 at 14:18

            You will need to install the Win2D Nuget package.

            Then you can call the CanvasTextFormat.GetSystemFontFamilies method to return a list of the installed fonts.

            Source https://stackoverflow.com/questions/65563574

            QUESTION

            Load an Image to a Canvas Control from a File Picker
            Asked 2020-Dec-18 at 17:31

            What I'm trying to do in a UWP app with Win2D: User pressed a button to add an image and picks their file. That file gets loaded as a resource for a Canvas Control. The image then gets rendered to the current drawing session

            When the button is clicked:

            ...

            ANSWER

            Answered 2020-Nov-11 at 07:03

            Load an Image to a Canvas Control from a File Picker

            For your scenario, you could get CanvasDrawingSession with CreateDrawingSession method. And then use this drawingsession to draw picked image to current CanvasControl.

            For example.

            Source https://stackoverflow.com/questions/64774610

            QUESTION

            Usage of Win2d CanvasDrawingSession.Blend
            Asked 2020-Nov-27 at 08:53

            In my project i would like to do a special kind of plot in Win2D. For this i need a procedure to overwrite geometries in the bitmap with new geometries, without losing the complete information of the previous geometries. The CanvasBlend.Min function seems to be the way to go.

            I tried the following code, but the min function does not work as expected. It does not compare the geometry of the bitmap with the new geometry.

            ...

            ANSWER

            Answered 2020-Nov-27 at 08:53

            Referring to the Remarks of the document, you need to set the ClearColor property as White and set the Opacity property as “0.5” or “1” in your CanvasControl(if your offscreen is from a CanvasControl) to view the effect of CanvasBlend.Min. The default color is Transparent in CanvasControl.

            Note that Windows.UI.Color.FromArgb(150, 255, 255, 255) and Windows.UI.Color.FromArgb(50, 255, 255, 255) are all white colors, you need to change them to other colors such as Windows.UI.Color.FromArgb(255, 255, 0, 0) and Windows.UI.Color.FromArgb(255, 0, 0, 255). The first parameter of Windows.UI.Color.FromArgb() represent opacity.

            Source https://stackoverflow.com/questions/65027922

            QUESTION

            How to get the remaining text after clipping in CanvasTextLayout in Win2D using C#?
            Asked 2020-Oct-08 at 11:42

            I'm developing a UWP application using Win2D, where I want to place certain text inside a Rect (rectangle) of defined width and height. If the text exceeds the width of the Rect then I want to clip the text with respect to the Rect's width. Here I want to show the text that fits the Rect and also the one that is getting clipped. How to do that in CanvasTextLayout in Win2D using C#?

            ...

            ANSWER

            Answered 2020-Oct-08 at 11:42

            Win2D does not provide a certain API to directly get the truncated text, but I have an idea, which is to judge the position of the current input text being truncated by calculating the width of the text.

            Source https://stackoverflow.com/questions/64259126

            QUESTION

            How to add contents of CanvasControl to a MediaClip
            Asked 2020-Sep-30 at 02:45

            I'm creating a uwp app where text a user types in is converted into a video overlay. The user loads the video, types in their text, gets a preview of the video with the text, then they can save their video with the overlay. Right now it works with an image overlay, but not text. I'm trying to use win2d to format the text. However, I can't figure out how to get the win2d canvas control into a windows.media.editing media clip.

            I thought I could go CanvasControl > Bitmap of some sort > Image > MediaClip, but media clips can only be created through storage files or direct 3d surfaces. Anything would be helpful! This is my first time trying to write something outside of a game engine.

            The part that currently converts the canvas control to a bitmap:

            ...

            ANSWER

            Answered 2020-Sep-17 at 00:45

            I just don't know how to convert outputBitmap to a storage file to make a media clip from it.

            After getting the RenderTargetBitmap, there is no need to convert to SoftwareBitmap. You can store the pixel data as a file in a specified format through BitmapEncoder. This is the method:

            Source https://stackoverflow.com/questions/63928307

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Win2D

            You can download it from GitHub.

            Support

            Win2D 1.21.0 was the last release to support the Windows 8.1 and Windows Phone 8.1 platforms. From Win2D 1.22.0 onward, only the Windows Universal Platform (UWP) is supported. Legacy Win2D support for Windows and Phone 8.1 is available as a NuGet package and from the win81 branch on github. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/microsoft/Win2D.git

          • CLI

            gh repo clone microsoft/Win2D

          • sshUrl

            git@github.com:microsoft/Win2D.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link