From 2dc004b2a173ec3690adac14e307febcac37e725 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 3 Jul 2013 10:56:06 -0500 Subject: [PATCH] add image interop section to 2htdp/image --- pkgs/htdp-pkgs/htdp-doc/info.rkt | 2 +- .../2htdp/scribblings/image-guide.scrbl | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pkgs/htdp-pkgs/htdp-doc/info.rkt b/pkgs/htdp-pkgs/htdp-doc/info.rkt index a114943344..929b49505a 100644 --- a/pkgs/htdp-pkgs/htdp-doc/info.rkt +++ b/pkgs/htdp-pkgs/htdp-doc/info.rkt @@ -10,6 +10,6 @@ "gui-lib" "htdp-lib" "sandbox-lib" - )) + "pict-lib")) (define build-deps '(#;"at-exp-lib" #;"rackunit-lib")) diff --git a/pkgs/htdp-pkgs/htdp-doc/teachpack/2htdp/scribblings/image-guide.scrbl b/pkgs/htdp-pkgs/htdp-doc/teachpack/2htdp/scribblings/image-guide.scrbl index 21f0dee70c..8a625611f0 100644 --- a/pkgs/htdp-pkgs/htdp-doc/teachpack/2htdp/scribblings/image-guide.scrbl +++ b/pkgs/htdp-pkgs/htdp-doc/teachpack/2htdp/scribblings/image-guide.scrbl @@ -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