一Cairo 概念 ................................................................................................................................... 3
环境 (Context) ............................................................................................................................. 3
路径 (Path) ................................................................................................................................... 3
源 (Source) ................................................................................................................................... 3
外观 (Surface) .............................................................................................................................. 3
蒙板 (Mask) ................................................................................................................................. 4
图案 (Pattern) ............................................................................................................................... 4
二Cairo 后端 ................................................................................................................................... 4
1. PNG 图像 ................................................................................................................................. 4
2. PDF 文件 ................................................................................................................................. 5
3. SVG 文件 ................................................................................................................................. 6
4. GTK 窗口 ................................................................................................................................ 7
三 基本绘图 ..................................................................................................................................... 9
直线段 .......................................................................................................................................... 9
描绘 (Stroke) 与填充 (Fill) ..................................................................................................... 12
虚线 (Dash) ................................................................................................................................ 14
线帽 (Line caps) ........................................................................................................................ 17
线的交合 (Line joins) ................................................................................................................ 19
四 高级形状绘制 ........................................................................................................................... 21
基本形状..................................................................................................................................... 21
复杂的图形................................................................................................................................. 24
填充 (Fill) .................................................................................................................................. 27
纯色 (Solid color) .................................................................................................................. 27
图案 (Pattern) ......................................................................................................................... 28
渐变 (Gradient) ...................................................................................................................... 32
五 透明........................................................................................................................................... 35
透明的矩形................................................................................................................................. 35
淡出的效果................................................................................................................................. 37
“等待”的演示 ............................................................................................................................. 40
六 合成........................................................................................................................................... 43
七 裁剪与遮蔽 ............................................................................................................................... 46
裁剪 ............................................................................................................................................ 46
裁剪矩形..................................................................................................................................... 49
遮蔽 ............................................................................................................................................ 53
变换 ............................................................................................................................................ 55
平移......................................................................................................................................... 55
旋转......................................................................................................................................... 56
缩放......................................................................................................................................... 58
错切......................................................................................................................................... 60
椭圆......................................................................................................................................... 63
星星......................................................................................................................................... 65
七 文本........................................................................................................................................... 68
灵魂伙伴..................................................................................................................................... 68
一个字接一个字…… ................................................................................................................. 71
膨胀 ............................................................................................................................................ 73
八 图像........................................................................................................................................... 76
图像的显示................................................................................................................................. 77
垂帘效果(Blind Down) ......................................................................................................... 78
光谱效果..................................................................................................................................... 81
1