UWP InkCanvas serialization format - svg

I have a UWP app that uses an InkCanvas to capture drawings. These are then saved in the standard serialization format.
I now have a requirement to display these within a ASP.NET MVC web app. (MVC 5 / .NET 4.6)
I have found a way to convert these to SVG - however it uses the UWP InkCanvas control, which I do not believe is accessible from with in an ASP.NET app. I have tried using the WPF version of the control instead - but that appears to use a different serialization format.
Now, is there any way to me to convert the strokes to SVG without using the control?
I can also think of a few other messy solutions to achieve this - converting to SVG directly in the UWP app (then need to store both the source InkCanvas data and SVG data, and keep these in sync) - so looking for a cleaner approach.

Related

Is there an API to do screen capture in WinUI 3?

I have been searching for an API to capture screen images in a WinUI 3 app (without the user selecting from a picker, as from GraphicsCaptureItem). My goal is to capture screen images under programmatic control and display them on a Canvas element. Most of what I've found so far are APIs that work only on Windows forms.
I can think of some possible ways to do this by using interop to Win32 functionality, but hopefully there is a WinUI 3 compatible library that can be used directly (such as System.Windows.Forms.Screen, which is used on Windows forms).
Thanks in advance for any advice that can be offered.
2/6 - checked out the link from Simon Mourier and tried out a ScreenCapture app that uses CreateForMonitor: https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/tree/master/dotnet/WPF/ScreenCapture. At this point, there would be quite some work to port this app to WinUI 3 as it is quite complex and uses interop for Direct3D functionality. However, it is progress and I appreciate the response.
Winui3 applications have access to the IGraphicsCaptureItemInterop interface. Here is a sample, I suggest you could refer to: https://github.com/robmikh/Win32CaptureSample

PWA InkCanvas save strokes as svg in javascript

I need to use InkCanvas in my web application using javascript (angular), is it possible to save InkCanvas as a SVG using javascript (or convert InCanvas to canvas)? i see this, but it seems it works for C#, i need a way to do it in javascript!
I think InkCanvas is only supported in Universal Windows Platform (UWP) for Windows10. This is confirmed in this SO post.
You can use Webassembly to run C# code in web browser using some JS helpers. Here is a post explaining the same.
You can try this with the c# code that you are interested in. Compatibility depended. These are relatively new features and only way to know is to try.

Can I make a universal app using HTML that runs on Hololens?

I believe these statement are true:
1) All Universal Apps Work As Holograms
2) Universal Apps can be built using HTML/JS
Does this mean I can build a holographic universal app using web technologies? For example a holographic visualizations dashboard in D3.js?
It's still too early to say definitively, but here is some info I could find.
UPDATE: There is now a library called HoloJS which allows devs to write apps in html.
First your assumptions 1 and 2 are correct. There are ways to build UWP (Universal Windows Platform) apps in javascript/html. This means you could write a UWP JS app which can run webgl in a 2D window placed somewhere in your environment. You could also run your app on Microsoft Edge.
So if all you want to do is display a 2D dashboard in a 3D room, yes it looks very possible. If you want the application to render 3D objects all around the user, there are some problems you will need to work around.
Quoted from https://forums.hololens.com/discussion/80/is-it-possible-to-use-webgl-with-hololens-repost#latest:
"Holographic apps are powered by the same graphics stack as the rest of the Windows 10 ecosystem. That means that just like the Xbox and Win32 games, apps for HoloLens are built on top of DirectX."
So you're kind of stuck with either Unity or DirectX if you want 3D visualizations that surround the user. BUT there could be a way...
A user at the bottom of this page http://forums.hololens.com/discussion/80/is-it-possible-to-use-webgl-with-hololens-repost said:
"That is interesting idea. If I understand correctly, you are trying to hook your Edge browser with your HoloLens and project 3D graphics with WebGL on your Edge browser based on the REST APIs available from HoloLens"
So, you could perhaps fullscreen your app or find some way to ensure it is in front of your user's face and then use a server to direct API calls from the hololens to your web-app in order to transform your geometry around the user.
It might be worth it to look into integrating D3 visualizations inside a threejs app if you want the holographic visualizations. https://www.youtube.com/watch?v=bWjn1N4SJsk
If you just want a 2D screen in the environment then develop as normal and use Edge inside the hololens.

Is it possible to migrate a MonoCross application incrementally to MvvmCross?

The team I'm on created a cross-platform application that runs on iOS, Android, and Windows Mobile that was created using Xamarin's tools and MonoCross. We're looking at MvvmCross as a possible MonoCross replacement but don't want to write the application from scratch.
Does anyone have experience with or thoughts on migrating a Xamarin/MonoCross cross-platform application to Xamarin/MvvmCross? Is it possible for the two frameworks to coexist in the same app (the ideal solution would have us migrate the app one screen at a time).
Thanks in advance.
Following Stuart's advice below I confirmed that it is possible to integrate MvvmCross into an existing MonoCross application.
In the original code a selection on View 1 initiates a call to Controller 2 using MonoCross URI navigation. Controller 2 displays View 2, passing it the data from Model 2.
Following the example in this video I created an MvvmCross View and ViewModel. A selection on View 1 still navigates to Controller 2 but Controller 2 now displays the new MvvmCross View 2. View 2 is data bound to ViewModel 2 which takes over Controller 2's functions of getting the Model data.
I don't know of anyone who's done this recently, but I originally ported several of the MonoCross samples over when I first created MvvmCross. The overall idea of one page to one "ViewModel" stays the same, although the mvvm binding offers more continuous view-viewmodel interactions than the more discrete Controller-Action model.
At a practical level:
MvvmCross itself is very modular and can be used in "CrossLight" mode where it simply provides data-binding and plugins - see CrossLight in http://mvvmcross.wordpress.com/. You might be able to use this for migrating pages one-by-one
MonoCross isn't really very interface/IoC based - so you may find that your resulting MvvmCross migration would also not be interface based either
MonoCross apps tend to use file-linking and #defines rather than PCLs - so you may find it easier to not use PCLs in MvvmCross
I suspect the best option for this migration is to let your team experiment - they already have lots of knowledge about your app and about what they do and don't need and what benefits they do and don't get from a framework.

How to send native texture ptr from Unity web player to a browser plug-in?

I have written an NPAPI browser plug-in (using Firebreath) that Unity uses
to access a Kinect camera. I can retrieve skeleton data from Unity through JavaScript easily since it isn't too big, but the problem is in retrieving color image data.
Is it possible to send a native texture pointer (GetNativeTexturePtr)
from Unity through JavaScript into the C++ plug-in so that it can write the texture data directly? (tested in standalone version and it works)
Any other suggestions on how to transfer image data from browser plug-ins to Unity web player are very welcome.
Unfortunately NPAPI plugins do not contain any mechanisms for exchanging binary data with the page. Probably the most performant way of doing that that I know of would be to base64 encode it and send it as part of a string.
Note that strings in NPAPI are UTF8.
The only way to get anything from Unity in your plugin would be to use the javascript interface, so you can use whatever methods you can find and then pass the data into your plugin; however, note that Unity is most likely running in another process, so you probably can't use any direct memory pointers that you might get from it.

Resources