Have you ever dreamt of creating generative print artwork that could be printed in any size without losing quality? Meet Cairo.
Cairo is a vector-graphics software library that allows you to draw all the crazy vector stuff that can be done in software, such as Illustrator, and it allows us to save it as a separate vector-graphics file. If you want to know more about Cairo itself, visit it website (http://cairographics.org/).
Let's try this out! Search for the CairoBasic
folder in the samples
directory. Open xcode/CairoBasic.xcodeproj
(vc10CairoBasic.sln
, if you're on Windows). Build and run the project. Nothing special seems to be there except a radial gradient background. But try to click on it! A flower. Click again! Random flowers. Try to fill the entire screen with them—you can smell the aroma, right?
Ok, that's enough. Close the application window. So, what did just happen? To understand this open the file CairoBasicApp.cpp
in your code editor. I won't explain it yet, but it is possible to see that there is not very much code in it. Go to a block of code that looks like the following:
void CairoBasicApp::keyDown( KeyEvent event ) {
This is a method of the main application class that does something when we press a key on the keyboard. We can see that it is possible to make the application fullscreen, if we press F, and then there is something defined for letters S, E, P, and D—what is it? If you press one of these buttons, you save the ready image in a file, but the file format of this file will be a vector one. As you can see, if you press S, you get a SVG file, for E you get an EPS, for P you get a PS or PostScript file, and for D you get a PDF.
Try it out! Build and run the application again, create your artwork, and press S, E, P, and D one after another. Then go to your home folder (/Users/You/
on MAC and C:UsersYou
on Windows) and you will see that there are four new files:
Try to open one of these files with your favorite vector-graphics software.
Yes, it is true, you can zoom in to infinity and the details remain crisp and clear. That is the power of vector-graphics! Now you can post-process and print that 1 m x 1 m generative flower poster in 300 dpi without losing any detail. Cool, isn't it? And you can do so much more except just printing your artwork—you can use it as a base for physical objects to be made with a laser cutter or a CNC mill, for example.
3.129.194.106