From 75e5d7ad6120719ea9c71ab6603541da56729d62 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 22 Aug 2017 17:09:18 -0700 Subject: [PATCH] add `shear` --- pitfall/pitfall/vector.rkt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pitfall/pitfall/vector.rkt b/pitfall/pitfall/vector.rkt index 5a2e5999..c418d750 100644 --- a/pitfall/pitfall/vector.rkt +++ b/pitfall/pitfall/vector.rkt @@ -30,6 +30,7 @@ stroke fillAndStroke clip + shear transform translate scale))) @@ -216,13 +217,18 @@ (send this addContent (string-append "W" (_windingRule rule) " n"))) -(define/contract (transform this m11 m12 m21 m22 mdx mdy) +(define/contract (transform this scaleX shearY shearX scaleY mdx mdy) (number? number? number? number? number? number? . ->m . object?) - (define new-ctm (list m11 m12 m21 m22 mdx mdy)) + (define new-ctm (list scaleX shearY shearX scaleY mdx mdy)) (set-field! _ctm this (combine-transforms (ยท this _ctm) new-ctm)) (send this addContent (make-transform-string new-ctm))) +(define/contract (shear this x y) + (number? number? . ->m . object?) + (transform this 1 y x 1 0 0)) + + (define/contract (translate this x y) (number? number? . ->m . object?) (transform this 1 0 0 1 x y))