fix the png conversion code for 2htdp/image images
closes PR 12061 please merge to the release branch
This commit is contained in:
parent
f7f3971d15
commit
56b82ba83c
|
@ -2194,8 +2194,18 @@
|
|||
|
||||
(test (convertible? (circle 20 "solid" "red")) => #t)
|
||||
(test (bytes? (convert (circle 20 "solid" "red") 'png-bytes)) => #t)
|
||||
|
||||
|
||||
(let ()
|
||||
(define tmpfile (make-temporary-file "2htdpimage-test-~a"))
|
||||
(define i (circle 15 "solid" "red"))
|
||||
(call-with-output-file tmpfile
|
||||
(lambda (p)
|
||||
(display (convert i 'png-bytes) p))
|
||||
#:exists 'truncate)
|
||||
(define i2 (rotate 0 (read-bitmap tmpfile))) ;; add rotate to be sure we get an image so that equal? works properly
|
||||
(delete-file tmpfile)
|
||||
(test (image-width i2) => 30)
|
||||
(test (image-height i2) => 30)
|
||||
(test i2 => i))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
|
|
|
@ -231,8 +231,8 @@ has been moved out).
|
|||
(define (to-bitmap img)
|
||||
(let* ([bb (send img get-bb)]
|
||||
[bm (make-bitmap
|
||||
(add1 (inexact->exact (ceiling (bb-right bb))))
|
||||
(add1 (inexact->exact (ceiling (bb-bottom bb)))))]
|
||||
(inexact->exact (ceiling (bb-right bb)))
|
||||
(inexact->exact (ceiling (bb-bottom bb))))]
|
||||
[bdc (new bitmap-dc% [bitmap bm])])
|
||||
(send bdc erase)
|
||||
(render-image img bdc 0 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user