[cairo] Problems with cairo_get_line_width and "new" semantics
Bill Spitzak
spitzak at d2.com
Tue May 16 14:42:08 PDT 2006
Better proposal for dashes to make pens only be a matrix:
The gstate has a "pen space" where the pen is a 1-unit diameter circle
or square. The "penCTM" transforms from pen space to the device. There
is also a current dash pattern, measured in pen diameters (and thus in
1-unit lengths in pen space). There is also a number called "dashscale"
which does not effect drawing and is provided for back-compatability.
Stoking a path is done by transforming the path to pen space. The line
cap and dash pattern are used to figure out the border paths in pen
space. These paths are then transformed to device space and filled.
cairo_set_pen(cairo_t*, const cairo_matrix_t*) multiplies the matrix by
the CTM and changes the penCTM to that. The dash pattern and dashscale
are unchanged.
cairo_get_pen(cairo_t*, cairo_matrix_t*) returns the penCTM divided by
the current CTM.
cairo_set_dash_pattern(...) multiplies all the lengths by the dashscale
and stores that as the dash pattern.
cairo_get_dash_pattern() divides the current dash pattern by dashscale
and returns that.
cairo_set_dashscale(,n) stores this number, and multiplies the current
dash pattern by the ratio between this and the previous one (? if this
is what back-compatability requires).
cairo_get_dashscale sets or returns this number.
cairo_set_line_width(size) does cairo_set_pen(identity*size) and
cairo_set_dashscale(1/width).
cairo_get_line_width() returns 1/cairo_get_dashscale() times the square
root of the determinant of the penCTM divided by the CTM.
More information about the cairo
mailing list