A new version of Sketches just landed in the latest Xamarin Studio alpha. Let’s take a look at a couple new things that have been added.
In the previous version, images could be loaded in a sketch given the path on disk. Now, you can add a .Resources folder next to the sketch file, with the naming convention of sketchname.sketchcs.Resources.
For example, with a sketch named Sample.sketchcs, I created a folder named Sample.sketchcs.Resources at the same location as the sketch file, and added a file named hockey.png in the folder. WIth this I can write code like the following in the sketch:
using AppKit; var image = NSImage.ImageNamed ("hockey");
Then I can visualize the image in the sketch:
Speaking of visualizers, they have been greatly enhanced in the latest version. For example, one of the many visualizers that has been added is for a CIImage. Therefore you can quickly iterate and test the results of different Core Image filters without needing to deploy an app!
For example, here’s some code to apply a noir effect to the above photo:
var noir = new CIPhotoEffectNoir { Image = new CIImage(image.CGImage) }; var output = noir.OutputImage;
This result is immediately available to view as shown below:
There are 41 filters in total now, including NSAttributedString, NSBezierPath and CGPath to name a few.
See the Xamarin Studio release notes for the complete list, as well as all the other features that have been added.