Exported save-image per Matthias' request, wrote conservative documentation

This commit is contained in:
John Clements 2010-04-28 11:48:07 -07:00
parent 2c54268228
commit f81ebbfbf7
3 changed files with 23 additions and 3 deletions

View File

@ -115,6 +115,8 @@ and they all have good sample contracts. (It is amazing what we can do with kids
make-color make-color
make-pen make-pen
save-image
) )
(provide bitmap) (provide bitmap)

View File

@ -5,8 +5,7 @@
(require 2htdp/image (require 2htdp/image
lang/posn lang/posn
scheme/runtime-path scheme/runtime-path)
(only-in 2htdp/private/image-more save-image))
(define-runtime-path image.scrbl "image.scrbl") (define-runtime-path image.scrbl "image.scrbl")
(define-runtime-path img "img") (define-runtime-path img "img")

View File

@ -4,7 +4,8 @@
2htdp/image 2htdp/image
(except-in lang/htdp-beginner make-posn posn? posn-x posn-y image?) (except-in lang/htdp-beginner make-posn posn? posn-x posn-y image?)
lang/posn lang/posn
scheme/gui/base) scheme/gui/base
(only-in scheme/base path-string?))
lang/posn lang/posn
"shared.ss" "shared.ss"
"image-util.ss" "image-util.ss"
@ -1044,3 +1045,21 @@ pixel wide pen draws the pixels above and below the line, but each with
a color that is half of the intensity of the given color. Using a a color that is half of the intensity of the given color. Using a
@scheme[pen] with with two, colors the pixels above and below the line @scheme[pen] with with two, colors the pixels above and below the line
with the full intensity. with the full intensity.
@;-----------------------------------------------------------------------------
@section{Exporting Images to Disk}
In order to use an image as an input to another program (Photoshop, e.g., or
a web browser), it is necessary to represent it in a format that these programs
can understand. The @scheme[save-image] function provides this functionality,
writing an image to disk using the @tt{PNG} format. Since this
format represents an image using a set of pixel values, an image written to disk
generally contains less information than the image that was written, and cannot be scaled
or manipulated as cleanly (by any image program).
@defproc[(save-image [image image?] [filename path-string?]) boolean?]{
writes an image to the path specified by @scheme[filename], using the
@tt{PNG} format.}