Controlling Imaging SDK with Surface Dial
A few months ago, I had the chance to receive a Microsoft Surface Dial. I took the opportunity to make a small sample project. It took me very long time to finish it, sorry
The idea I had is to control the Imaging SDK (https://msdn.microsoft.com/en-us/library/mt598503.aspx) with the Dial. To add saturation and adjust the level, for example. Or then toggle the sepia filter.
Create the classes
What I need for each effect:
- Increase (or turn on)
- Decrease (or turn off)
- Give the current value
- Chain it with other effects
So I will create a common interface that will be implemented by each effect.
Two example of effect, Blur:
I’ll place the effects in a list, to chain them like this:
Surface Dial API
To use the Dial Surface, I must get an instance first:
Then add the menus to the Dial
The Tags come from this class:
Now, we must add the BoutonClicked and RotationChanged events
The first event is to detect the selection of an effect via the Dial menu, and the second event is raised when the dial is rotated
For the selection of the effect, we look at the menu tag. It is the key to the effect in the dictionary.
For the change of value, I’m just seeing if rotation is negative or positive to decide if I increment or decrement the effect
And finally, I render the image.
A video showing the result:
A small but very nice tool, with a simple API and that opens the door to all kinds of possibilities.
The code of the application is here