The graphics tools in previous versions of Visual Studio might best be described as mediocre. However, in Visual Studio 2012 they have been revisited to provide some much needed updates.
Visual Studio 2012 in no way replaces a full featured graphics package, however if you just need to tweak an image or make some simple changes then Visual Studio can be very useful.
In this recipe, you'll create an image that you could use in the website project we've been using throughout this chapter.
Right-click on the
VS2010_Web
project and select Add | New Folder. Call the new folderImages
.With the
Images
folder selected, from the File menu choose New File or press Ctrl+N. From the New File dialog select Graphics | PNG Image (.png) and click on Open.The new Visual Studio Graphics Designer will appear.
Save the image to the
Images
folder of your project using File | Save As with the default name ofImage1.png
.In Solution Explorer turn on the Show all files option and locate the image you just saved to the
Images
folder. Include it in the project by right-clicking it and choosing the Include In Project option.Back in Graphics Designer you will see two new toolbars. One along the top of the image area and one along the side. For reference we will call these toolbars the top toolbar and the side toolbar.
Select the Brush tool so you can draw on your wonderfully blank picture.
To set the color of the brush, ensure the Properties panel is open. If it isn't it can be accessed by pressing F4 or choosing View | Properties Window.
To select the brush thickness change the Width property of Appearance to a value of your choice, such as
10
.Now draw on the canvas and start creating your next masterpiece! Experiment with the other options in the toolbar to get a feel for what the graphics tool provides. Just make sure you produce something better than this horrible effort!!
The new graphics designer is a DirectX accelerated design surface. You can alter the DirectX rendering output method to use software acceleration if, for example, you are using older hardware and are seeing graphics glitches. To switch, use the side toolbar and select Advanced | Graphics Engines | Render with D3D11WARP.
While the graphics editor is a much better editor that the previous resource editor, and even though DirectX acceleration means that the image editor can now work with very large, and complex images and a multitude of formats, it still isn't a match for a full featured graphics editing program. For advanced graphics needs, use a specialist tool.
Visual Studio 2012 doesn't simply provide the same 2D image editing options of the past with a new interface; it now provides for some more advanced techniques specifically designed for those who need to produce visually rich applications such as games or information visualization tools.
MIP mapping is a technique used in video games for texture mapping 3D models. A single image file is structured to contain a high resolution texture as well as multiple versions of the same texture at lower levels of resolution. When the game is running, a texture of the appropriate resolution is extracted from the image file and applied to the 3D model based on the distance the model is from the camera. The further away the object, the lower the resolution chosen.
Visual Studio 2012 supports the editing of MIP map images using the new Graphics Designer.