Fixes for PNG conversion, and make `image-snip%' convertible.

original commit: 13cae20838e8d7a6de1fff3c242fb8d85fca22cb
This commit is contained in:
Sam Tobin-Hochstadt 2010-12-15 13:59:57 -05:00
parent 942143113a
commit 95fd314cad

View File

@ -28,6 +28,7 @@ has been moved out).
|#
(require racket/class
racket/draw
racket/gui/base
racket/math
racket/contract
@ -211,13 +212,15 @@ has been moved out).
(define (to-bitmap img)
(let* ([bb (send img get-bb)]
[bm (make-object bitmap%
(add1 (inexact->exact (ceiling (bb-right bb))))
(add1 (inexact->exact (ceiling (bb-bottom bb)))))]
[bdc (make-object bitmap-dc% bm)])
[bm (make-bitmap
(add1 (inexact->exact (ceiling (bb-right bb))))
(add1 (inexact->exact (ceiling (bb-bottom bb)))))]
[bdc (new bitmap-dc% [bitmap bm])])
(send bdc clear)
(render-image img bdc 0 0)
(send bdc get-bitmap)))
(begin0
(send bdc get-bitmap)
(send bdc set-bitmap #f)))
(define image%
(class* snip% (png-convertible<%> equal<%> image<%>)