fix bitmap rotate/flip interaction

closes PR 14585
This commit is contained in:
Robby Findler 2014-06-18 01:20:05 -05:00
parent f347af3c98
commit a3370be15d
2 changed files with 14 additions and 5 deletions

View File

@ -775,10 +775,9 @@
[flipped? (flip-flipped? atomic-shape)])
(make-flip flipped?
(make-ibitmap (ibitmap-raw-bitmap bitmap)
(bring-between (if flipped?
(- (ibitmap-angle bitmap) θ)
(+ (ibitmap-angle bitmap) θ))
360)
(bring-between
(+ (ibitmap-angle bitmap) θ)
360)
(ibitmap-x-scale bitmap)
(ibitmap-y-scale bitmap)
(make-hash))))]))
@ -911,8 +910,13 @@
[(text? atomic-shape)
(error 'flip "cannot flip shapes that contain text")]
[(flip? atomic-shape)
(define bitmap (flip-shape atomic-shape))
(make-flip (not (flip-flipped? atomic-shape))
(flip-shape atomic-shape))]))
(make-ibitmap (ibitmap-raw-bitmap bitmap)
(bring-between (- (ibitmap-angle bitmap)) 360)
(ibitmap-x-scale bitmap)
(ibitmap-y-scale bitmap)
(make-hash)))]))
(define (flip-point point) (make-point (point-x point) (- (point-y point))))
(define (flip-points points) (map flip-point points))

View File

@ -1603,6 +1603,11 @@
=>
(to-img (make-object image-snip% green-blue-20x10-bitmap)))
(let ([b (freeze (beside (rectangle 4 8 "solid" "blue") (rectangle 4 8 "solid" "red")))])
(test (flip-vertical (rotate 90 b))
=>
(rotate -90 b)))
;; make sure that raw image snips are equal to image snips
(let ([i1 (make-object image-snip% (collection-file-path "bug09.png" "icons"))]
[i2 (make-object image-snip% (collection-file-path "bug09.png" "icons"))])