How Do I recognize basic shapes with Ink and WinRT - windows-8

Is there a simple way to get shape recognition working with WinRT?
With WPF it was simple I could just use InkAnalysis but it seems that it is not available in WinRT(?).
I want to be able to draw basic shapes circle, rectangle and square and I want to be able to recognize them.
Any suggestions?

The GestureRecognizer class that you get out of the box only supports the simple gestures used in various standard Windows 8 controls. For your scenario you could try the 1$/n$ recognizers I linked to in this previous question.

Related

How would I create a visual simulation in C++/CLI within a panel? (What libraries?)

Using C++/CLI on Visual Studio I want to create a 2D simulation, with the options to change the user's inputs on one side of the screen and the simulation on the other side. (The user's inputs would be used to calculate what to draw for the simulation)
I would like to be able to do this within a panel/fixed region keeping the drawing separate from UI elements (buttons etc). Essentially I would like to draw multiple dots on the screen and the position of those dots changes every second. Trouble is all the examples of of drawing I've seen take up the whole form.
What libraries and how can I use to create multiple 2D drawings either by controlling the colours of pixels or any other way inside a fixed region like a panel?
This really depends on what GUI toolkit you're using.
If you're using WinForms, create a control and override the OnPaint method.
If you're using WPF, I'd use WritableBitmap.
There are other methods for both toolkits, of course, but those are the ones I would use. Plus there's things like DirectX and OpenGL, but it sounds like you want something simple, so those would probably be overkill.

Color Picker for Windows store App

I want to add a color picker control to a windows store App (using VB), I came to know that there is no standard control for that. So any ideas about what could be a good purchased or open source option?
So I started building one into WinRT XAML Toolkit here but never got round to finishing it. Mainly because I figured there would need to be very different designs for different platforms. The control isn't finished, but a lot of the components that are there you could use to build a color picker that fits your design. There's a ColorExtensions class that might help you convert between HSL/HSV/RGB models, there's a FromString() method in it that can parse a color string in the formats available in XAML (e.g. "Transparent" or #FFAA0080 or #FB0) and there's a WriteableBitmapColorPickerExtensions class that you can use to render a hue ring, 2D color selector bitmap or a 1D color bar. I'll probably create some usable controls one day to use all of these primitives, but for now - you have that power! :)
I've created a simple color picker for Universal Apps, you can read about it from this blog post...

Can I have a composite shape as a resource in WinRT XAML?

I'm developing a Windows 8 Metro-style application and I want to use vector images. As there seems to be no direct support for svg images, I am trying to use a xaml fragment consisting of multiple shapes (a path and some lines) as an image. I would like to have a resource dictionary entry with the composite shape and be able to include it in different pages. Ideally, I would also like to be able to resolve a specific composite shape from a data bound property.
From what I've read, the WPF approach was to have a VisualBrush or DrawingBrush consisting of the shapes, but there are no such classes in Windows 8 (and it seems like it's not even possible to derive from Brush).
How am I supposed to do this using WinRT UI?
No, you cannot use a DrawingBrush as the value of a background property in WinRT XAML. It's too bad, huh? Seems like a very powerful features to setup the fill of an object with vector layouts. In fact DrawingBrush is not even part of Windows 8 yet. It is what it is. For now, images are a fine solution. But we feel your pain.
I might as well toss in that VisualBrush is not part of WinRT-XAML either.
Each XAML fragment is really a UI element. I think the simplest approach would be to put the XAML into it's own user control and then add the user control to each page you wanted to display the "drawing" on. If you want the user control to display different shapes, you can expose a property on the control, data bind to that property, and inside the setter of the property read the value and toggle the visibility of the various XAML shapes to show or hide whatever parts of the composite image you want. It is a bit brute force, but will do what you want.
Windows8 way to have vector graphics in it is just to use ViewBox+Canvas and Path elements. It works well in my opinion, though I do miss VisualBrush.

How to draw a "speech bubble" above NSWindow?

Notice this app:
How can I draw that sort of triangle above an existing NSWindow? I know the app in question probably draws the whole thing as a custom window, but I want to keep the existing title bar. Is there any way to draw a triangle and attach it above a NSWindow? Please note that the solution has to be MAS-compatible (i.e. no private frameworks or classes).
The only way to do this would be to create a borderless child window with no shadow that overlays the edge of the existing window. You'd need to draw any shadow yourself.
A more comprehensive solution would involve subclassing NSThemeFrame and doing some custom drawing. Take a look at Matt Gallagher's Drawing a custom window on Mac OS X. It contains a wealth of helpful information, and Google will also be of great help here.
I've written an open source (BSD) framework that draws windows similar to this: https://github.com/sbooth/SFBPopovers
It won't directly do what you need but will illustrate the basics of drawing custom window frames.

custom colors in bing maps?

I was looking at http://www.msnbc.msn.com/id/26295161/ns/weather/ and noticed that the flash map is provided by bing and have a custom color scheme. I have a similar need to show maps with a black & white colortheme, is it possible using their api or have they made custom tiles ? (doesnt seem feasible to provide tiles for alls maps on all levels :)
If you are not wedded to Bing maps, you could look into Mapbox, which provide maps based on OpenStreetMap in any style that you desire.
This question is still not answered and even if it's kind of old, I think it matters.
In fact, they're not using different tiles or a custom tile scheme. You can see those in the network inspection tool.
Since they're inside a Flash application, they can easily change the color of the image using filter on image (ColorMatrixFilter) and changing dynamically on the client side the rendered colors.
Well now some years later you can: https://msdn.microsoft.com/en-us/library/mt823636.aspx :-)
(I got here by looking for some sample styles and thought I add the link for anybody else finding this question)
Perhaps a custom tile skinner is that you need: http://rbrundritt.wordpress.com/2009/11/27/bing-maps-custom-tile-skinner/
In this example, the author changes the color of roads using ColorMatrix and ColorMap:
The two key methods used to transform the colors
consist of using ColorMatrix or a ColorMap. By
using a color matrix all the colors on the tile
can be changed within a couple lines of code. Using
a ColorMap allows you to change one color at a
time. This is useful if you only want to change a
few colors on the map.