Changing display colors in UWP - c#

Is there a way to apply canvas effects listed in following MSDN page to all display?
http://microsoft.github.io/Win2D/html/N_Microsoft_Graphics_Canvas_Effects.htm
So, can the input and output of ,e.g., TemperatureAndTintEffect be the display buffer?

robertos is correct. Win2D is a UWP API, and there is no general purpose way for UWP apps to read or write to the display outside of their specific app window.
On mobile devices you can use ScreenCapture APIs to read the displayed image, but there is no way to modify that or replace it with something else. Or if you want to apply filters only within your own XAML app, you can do that by rendering the XAML visual tree to a bitmap. More about both options in this thread: Universal Windows Library (UWP) Way to take screenshot?

No. UWP apps do not have access to the raw graphics card and buffers outside of their app.

Related

How can I make UWP apps fit in the screen size?

I am developing an UWP application for an 84' Microsoft Surface Hub, and I set the sizes and positions of each element based on the size of the Hub. The problem this brings about is that I cannot view the whole app when I run it on my PC which is smaller in size. What is a good way of fixing this by making the UWP app automatically fit in the screen size, and always display in full screen? Thanks in advance.
The question is obviously too broad to get a specific answer but here are a couple of quick pointers to get you in the right direction
Adaptive layout in UWP - https://msdn.microsoft.com/en-us/windows/uwp/layout/design-and-ui-intro
RelativePanel - https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.relativepanel.aspx
Adaptive Triggers - https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.adaptivetrigger.aspx
You can also check the UWP Sample apps to see how Adaptive Layout works in practice - https://github.com/Microsoft/Windows-universal-samples

UWP and DirectX

I have a task:
'Second component must be written in C++ and must be a UWP assembly/component that will be used by the First part of the task. It must be a DirectX component that draws to SwapChain with transparent background. The content must be a 2D animation that must be bound to current mouse position. The content must be controllable via set of public methods.
DirectX component must be placed on top of your C# GUI so it will act as overlay.
Make it event-transparent overlay, it must not capture any GUI events and otherwise interfere with C# app.
Use C# host to send mouse events and content change to DX layer.'
But I have no idea how to combine UWP and DirectX.
I already have functioning UWP C# app part and what's next?
I'll be grateful for any responces and ideas.
You need to include a SwapChainPanel or SwapChainBackgroundPanel control into your XAML file. This surface will be used to draw your DirectX content. You have a default uwp sample in Visual C++ Template named DirectX 11 and XAML App. It can help you to understand the plumbing but there is only C++ code on this solution.
MonoGame!
It's a game framework, based on XNA4 that works on UWP, among a myriad of other platforms. You can pick apart the samples to learn what you need.
http://www.monogame.net/

How to access camera frames in Universal Windows Platform

I am developing an application for Windows 10 phone on Universal Windows Platform. I need to get a frame from the devices camera and do some processing; this is supposed to happen in the background, the user is not supposed to see the camera feed anywhere in the UI.
There are two classes that handle the most common use cases, namely CameraCaptureUI and MediaCapture. The MediaCapture class allows to grab the so called preview frame but the whole workflow revolves around binding a MediaCapture instance to a UI control (ie CaptureElement) and if I do not do it then I am unable to get the preview frames. This makes the MediaCapture class unsuitable for my case unless there is another way to use it that I am not aware of.
An answer to a related question How to get preview buffer of MediaCapture - Universal app suggests usage of Lumia Imaging SDK but it is targeted at Windows 8 family and the classes and methods used there are now deprecated in the current Lumia Imaging SDK for Windows 10.
Additionaly, the aforementioned answer brings up custom media sinks but I am unsure if that can help me in my scenario and if yes, then where should I start.
To sum up, how do I acquire frames from a camera device that can be used for further processing in a Windows 10 universal app?
There are multiple options available to you for this. CameraCaptureUI is not one of them.
Hide the CaptureElement
Opacity = 0
Visibility.Collapsed
Create it in code and don't add it to your layout
etc.
StartPreviewToCustomSink (https://msdn.microsoft.com/en-us/library/windows/apps/hh700850.aspx) although I've never done this. This link might also help.
Once you've done that, you can take photos or just get preview frames. The CameraStarterKit will teach you the former, CameraGetPreviewFrame will teach you the latter.
How about you put a CaptureElement in UI, but hide it with overlay or set width / height to 1 ? Its kind of a hack but it will provide you the frame.

How can I design responsive UI in universal windows app

I have just started to develop in universal app. I have developed app in Windows 8 store apps and also developing Windows Phone 8 and Windows Phone 8.1 (SilverLight) Apps. Question is related to universal app in Windows and Single UI which is created in App. Share folder.
1 For web there is word like responsive UI. to create there is media query to write css.
I know css is same as we can create resource with for xaml . I can get resolution form c# and I can create different UI for different resolution and I can visible collapsed according to resolution but is there any single way which automatically adjust according to design.? ( this question is related to data binding controls specially...)
There are several techniques to adjust the page's design to the size, shape, and resolution of the window. These are usually used together.
The first is to use dynamic layout controls instead of hard-coding positions. For example, use a Grid control with * columns to split the screen by percentages, or a StackPanel to stack controls so they as they fit. GridViews can scale to fill the screen (and beyond). This will let the app flow to use the available space.
MSDN discusses this technique in Quickstart: Defining layouts
For larger scale changes where the app should make bigger changes to adjust to larger changes such as portrait vs. landscape vs. snapped modes you can use Visual States. Visual States allow the app to set a specific state (e.g. "Landscape") which automatically changes properties of the page's controls. For dynamic layout the visual states will typically hide and show different controls, for example to switch from a horizontally oriented GridView in Landscape mode to a vertically oriented ListView in Portrait mode. By data-binding both controls to the same data the code-behind doesn't need to know any details about which controls are used at any specific time.
MSDN discusses this technique in Quickstart: Designing apps for different window sizes
Blend has a very good Visual States editor that you can use to define and set up different visual states visually.
The same techniques and code apply to Windows Store apps and for Windows Phone Store apps, but the exact layouts are likely to be different to cater to the different device sizes. Windows Store apps run on a wide range of display sizes and users can resize Windows Store apps freely, so Windows Store apps need to support much more flexible layouts than Windows Phone Store apps. Windows Phone Store apps need to take display resolution into account, but run on fairly consistent aspect ratios which change only for portrait or landscape.
For very simple apps you may be able get away with sharing a single Xaml page in the Shared project of a Universal app, but in most cases you'll be better off with separate page designs for Windows Store and Windows Phone apps. In addition to the screen size differences, there are a few control differences that will require separate Xaml. Xaml doesn't support conditional compilation, so a Shared Xaml file would need to be exactly the same in both.
For Windows Store you can use 'visual states'. You can set rules that determine which visual state is to be used, e.g. when the width is 320 switch to snap mode and modify the layout to suit.
Be careful when looking up information on this because the paradigm changed a lot between Windows 8 and 8.1.
Jerry Nixon has a great tutorial on visual states:
http://blog.jerrynixon.com/2013/11/windows-81-how-to-use-visual-states-in.html
This post from my blog covers a simple scenario using code behind only (VB, but should be easy to change to C#) - not advisable when you have a complex layout:
http://grogansoft.com/blog/?p=116
And there is a sample somewhere amongst these on the Windows Dev Center:
https://code.msdn.microsoft.com/windowsapps/Windows-8-Modern-Style-App-Samples/view/SamplePack#content
For the phone version(s) you should probably not bother with visual states as a phone app always has the full screen, and it's a better user experience to lock the display to either portrait or landscape.
Your phone/Store apps can share controls, but they have their own pages. I usually create full sized and smaller versions of any data-bound controls and use the smaller size on the phone and when the Store version is in a small state (e.g. 1/2 the screen).

VGA/Skeletal Viewer in Windows Form?

I'm developing a C# application with the Kinect, and I'd like to relay back to the user their reflection (with the RGB camera) or the skeletal view while they're using the application. Is that possible? Or is there a better way to show the user what the camera sees while running?
Thanks!
The Kinect for Windows Developer Toolkit has examples that do exactly this. There are multiple examples Demonstrating how to display the depth and color streams, as well as how to show the skeleton by it'll or overlayed on the video stream.
The "Kinect Explorer" example is the more advanced of those examples, showing how to put it all together.

Categories

Resources