ctm rename

main
Matthew Butterick 6 years ago
parent 0672e129d1
commit 2a1dde5c5c

@ -58,7 +58,7 @@
(let ([y2 y1]
[y1 (+ y1 h)]
[x2 (+ x1 w)])
(match-define (list m0 m1 m2 m3 m4 m5) (· this _ctm))
(match-define (list m0 m1 m2 m3 m4 m5) (· this @ctm))
(let* ([x1 (+ (* x1 m0) (* y1 m2) m4)]
[y1 (+ (* x1 m1) (* y1 m3) m5)]
[x2 (+ (* x2 m0) (* y2 m2) m4)]

@ -38,7 +38,7 @@
;; initialize mixins
(send this initVector)
(inherit-field _ctm)
(inherit-field @ctm)
(send this initFonts)
(inherit-field @font-families)
(send this initText)
@ -70,7 +70,7 @@
(set! @y (margin-right (get-field margins (page))))
;; flip PDF coordinate system so that the origin is in
;; the top left rather than the bottom left
(set! _ctm default-ctm-value)
(set! @ctm default-ctm-value)
(send this transform 1 0 0 -1 0 (get-field height (page)))
this)

@ -11,11 +11,13 @@
"path.rkt")
(provide vector-mixin default-ctm-value)
(define default-ctm-value '(1 0 0 1 0 0))
(define (vector-mixin [% mixin-tester%])
(class %
(super-new)
(field [_ctm default-ctm-value]
[_ctmStack null])
(field [@ctm default-ctm-value]
[@ctm-stack null])
(as-methods
initVector
save
@ -45,25 +47,24 @@
scale)))
(define default-ctm-value '(1 0 0 1 0 0))
(define/contract (initVector this)
(->m void?)
(set-field! _ctm this default-ctm-value)
(set-field! _ctmStack this null))
(set-field! @ctm this default-ctm-value)
(set-field! @ctm-stack this null))
(define/contract (save this)
(->m object?)
(push-field! _ctmStack this (· this _ctm))
(push-field! @ctm-stack this (· this @ctm))
(send this addContent "q"))
(define/contract (restore this)
(->m object?)
(set-field! _ctm this (if (pair? (· this _ctmStack))
(pop-field! _ctmStack this)
(set-field! @ctm this (if (pair? (· this @ctm-stack))
(pop-field! @ctm-stack this)
default-ctm-value))
(send this addContent "Q"))
@ -228,7 +229,7 @@
(define/contract (transform this scaleX shearY shearX scaleY mdx mdy)
(number? number? number? number? number? number? . ->m . object?)
(define new-ctm (list scaleX shearY shearX scaleY mdx mdy))
(set-field! _ctm this (combine-transforms (· this _ctm) new-ctm))
(set-field! @ctm this (combine-transforms (· this @ctm) new-ctm))
(send this addContent (make-transform-string new-ctm)))

Loading…
Cancel
Save