fix rotation problems and sense of `transform'-like operations
so that they conceptually apply after the current transformation, instead of before the current transformation; more general rotation problems were related to aligned drawing and the calculation of the effective scale for alignment
This commit is contained in:
parent
dc7e8ef379
commit
0011f5957d
|
@ -379,8 +379,11 @@
|
|||
(cairo_matrix_translate mx origin-x origin-y)
|
||||
(cairo_matrix_scale mx scale-x scale-y)
|
||||
(cairo_matrix_rotate mx (- rotation))
|
||||
(set! effective-scale-x (cairo_matrix_t-xx mx))
|
||||
(set! effective-scale-y (cairo_matrix_t-yy mx))
|
||||
(let ([ssq (lambda (a b) (sqrt (+ (* a a) (* b b))))])
|
||||
(set! effective-scale-x (ssq (cairo_matrix_t-xx mx)
|
||||
(cairo_matrix_t-xy mx)))
|
||||
(set! effective-scale-y (ssq (cairo_matrix_t-yy mx)
|
||||
(cairo_matrix_t-yx mx))))
|
||||
(set! effective-origin-x (cairo_matrix_t-x0 mx))
|
||||
(set! effective-origin-y (cairo_matrix_t-y0 mx))
|
||||
(let ([v (vector (cairo_matrix_t-xx mx)
|
||||
|
@ -448,13 +451,14 @@
|
|||
(cairo_matrix_translate mx origin-x origin-y)
|
||||
(cairo_matrix_scale mx scale-x scale-y)
|
||||
(cairo_matrix_rotate mx (- rotation))
|
||||
(cairo_matrix_multiply mx mx mx2)
|
||||
(cairo_matrix_multiply mx mx2 mx)
|
||||
(set! origin-x 0.0)
|
||||
(set! origin-y 0.0)
|
||||
(set! scale-x 1.0)
|
||||
(set! scale-y 1.0)
|
||||
(set! rotation 0.0)
|
||||
(set! matrix mx)
|
||||
(reset-effective!)
|
||||
(reset-matrix)))
|
||||
|
||||
(def/public (set-initial-matrix [matrix-vector? m])
|
||||
|
|
|
@ -1151,7 +1151,7 @@ rotation settings have their identity values.
|
|||
[dy real?])
|
||||
void?]{
|
||||
|
||||
Adds a scaling of @racket[dx] in the X-direction and @racket[dy] in
|
||||
Adds a translation of @racket[dx] in the X-direction and @racket[dy] in
|
||||
the Y-direction to the drawing context's current transformation.
|
||||
|
||||
Afterward, the drawing context's transformation is represented in the
|
||||
|
|
Loading…
Reference in New Issue
Block a user