Creating a variable-width stroke in Cairo
stroke() in Cairo applies a stroke of a single specified wid开发者_如何学编程th to a line path.
I'd like to draw a path with a varying width (thinner when the user was drawing faster, thicker when slower). Is this possible in Cairo?
Use cairo_set_line_width
to set it and "split" the path in more than one piece. Unluckly as you noticed cairo_set_line_width is the width for the whole current path (since it sets the attribute as if you are choosing a pen to draw that path):
cairo_set_line_width
«As with the other stroke parameters, the current line width is examined by cairo_stroke(), cairo_stroke_extents(), and cairo_stroke_to_path(), but does not have any effect during path construction.»
精彩评论