add image interop section to 2htdp/image

This commit is contained in:
Robby Findler 2013-07-03 10:56:06 -05:00
parent 0e3ede92a0
commit 2dc004b2a1
2 changed files with 16 additions and 2 deletions

View File

@ -10,6 +10,6 @@
"gui-lib"
"htdp-lib"
"sandbox-lib"
))
"pict-lib"))
(define build-deps '(#;"at-exp-lib"
#;"rackunit-lib"))

View File

@ -4,7 +4,10 @@
(except-in lang/htdp-beginner posn make-posn posn? posn-x posn-y image?)
lang/posn
(only-in racket/base foldl)
(except-in racket/gui/base make-color make-pen))
(except-in racket/gui/base make-color make-pen)
file/convertible
pict/convert
(only-in mrlib/image-core render-image))
"shared.rkt"
"img-eval.rkt"
scribble/decode
@ -371,6 +374,17 @@ and now the rotating hero looks reasonable:
(rotate 40 (hero-on-blank 50))
(rotate 50 (hero-on-blank 25)))]
@section{Image Interoperability}
Images can connect to other libraries. Specifically:
@itemlist[@item{images are @racket[snip%] objects, so can
be @method[text% insert]ed into @racket[text%]
and @racket[pasteboard%] objects}
@item{they implement the @racket[convert] protocol for @racket['png-bytes]}
@item{they implement the @racket[pict-convert] protocol, and}
@item{there is a low-level interface for drawing directly into
a @racket[dc<%>] object: @racket[render-image].}]
@section[#:tag "nitty-gritty"]{The Nitty Gritty of Pixels, Pens, and Lines}
The image library treats coordinates as if they are in the upper-left corner