Upload Tizen2.0 source
[framework/graphics/cairo.git] / doc / tutorial / src / README
1 Welcome to the cairo tutorial:
2
3 +--------------------------------+
4 | How to Recognize Ugly Graphics |
5 |(and what you can do about them)|
6 +--------------------------------+
7
8 This directory is your personal playground for following along with
9 the examples. In order for you to make use of these files you will
10 need to have cairo and its header files installed. You can find
11 instructions for doing this at:
12
13         http://cairographics.org/tutorial
14
15 Notice that there are a few .c files in this directory.
16
17 You should start out by just typing "make" which will turn each .c
18 file into several different programs. Go ahead and run each of the
19 programs and see what they do. Some of them will open up new X windows
20 while others will simply write their output to files (such .png or
21 .pdf).
22
23 After you play with those a bit, go ahead and take a look at the
24 contents of the .c files. You'll see that each file contains a draw()
25 function that does all of the drawing.
26
27 You might be surprised to notice that there is no main() function in
28 any of the files. Instead, main is hidden away by means of
29 cairo-tutorial.h. This rather non-conventional style is used to allow
30 you to focus on the actual drawing code involved in using cairo, while
31 not having to worry about the setup semantics. We don't recommend that
32 you follow this style for real projects.
33
34 As you follow along during the tutorial and get some ideas for things
35 to draw, you'll want to start making your own .c files. You can copy
36 an existing file or make your own by following this simple minimal
37 template:
38
39         #include "cairo-tutorial.h"
40
41         static void
42         draw (cairo_t *cr, int width, int height)
43         {
44             /* Put your drawing code here. */
45         }
46
47 Any new file you create will automatically get picked up by the
48 Makefile so that "make" will compile your file into several different
49 programs, just like the existing examples.
50
51 If you'd like to control the initial size of the output, you may
52 define WIDTH and HEIGHT before including cairo-tutorial.h like so:
53
54         #define WIDTH  100
55         #define HEIGHT 100
56
57         #include "cairo-tutorial.h"
58
59 If you would like to change the set of cairo-backend target programs
60 that are compiled, you may edit the "all" target in the Makefile.
61
62 Have fun!
63
64 -Carl Worth
65
66 cworth@redhat.com