cairo
文章目录
PyCairo
用途
绘制 2D 矢量图
Cairo backend
即输出端,eg: X window system, SVG, PDF, Win32 GDI
隶属
version >= 2.8, 包含于 GTK system
概念
drawing context
作用:存储所有图形参数(状态参数和如何绘制)
The drawing context holds all of the graphics state parameters that describe how drawing is to be done. This includes information such as line width, color, the surface to draw to, and many other things. It allows the actual drawing functions to take fewer arguments to simplify the interface.
path
由点组成的线或图形。
A path is a collection of points used to create primitive shapes such as lines, arcs, and curves.
- lines
- arcs
- curves
类型
- closed path
- open path
创建步骤
- create empty path
- define a path
make visible
by stroking (线宽?)
- 方法:strok()
or filling them (填充)
- 方法: fill()
source
类似画笔:A source is the paint we use in drawing. We can compare the source to a pen or ink that we use to draw the outlines and fill the shapes.
四种基本 source 类型
- colors
- gradients
- patterns
- images
surface
输出端,类似纸张,eg: PDF surface, Win32 surface, Xlib surface
filter 处理
source 绘制到 surface 前的处理,opaque(不透明)部分被复制上去, transparent(透明)部分不被复制
pattern
绘制内容(source when drawing onto a sourface)
In PyCairo, a pattern is something that you can read from and that is used as the source or mask of a drawing operation.
文章作者
上次更新 2022-03-07 (de34a70)