improve WXME docs, and fix bug in getting image data

svn: r6476
This commit is contained in:
Matthew Flatt 2007-06-05 00:45:57 +00:00
parent 27c1b7e612
commit e5af3f7897
2 changed files with 22 additions and 16 deletions

View File

@ -31,6 +31,13 @@ Takes an import port whose stream starts with WXME-format data and
returns an input port that produces text content converted to bytes, returns an input port that produces text content converted to bytes,
and non-text content as "special" values. and non-text content as "special" values.
These special values produced by the new import port are different
than the ones produced by reading a file into a MrEd `editor<%>'
object. Instead of instances of the MrEd `snip%' class, the special
values are typically simple extensions of `object%'. See "Snip Class
Mapping" (below) for information about the kinds of non-text content
that can be read.
If `close?' is true (the default), then closing the result port close If `close?' is true (the default), then closing the result port close
the original port. the original port.
@ -43,9 +50,6 @@ object implementing the `readable<%>' interface provided by "wxme.ss",
then the object's `read-special' method is called to produce the then the object's `read-special' method is called to produce the
special value. special value.
See "Snip Class Mapping" (below) for information about the kinds of
non-text content that can be read.
> (extract-used-classes input-port) > (extract-used-classes input-port)
Returns two values: a list of snip-class names (as strings) used by Returns two values: a list of snip-class names (as strings) used by
@ -155,7 +159,7 @@ or space, and must not be "." or "..".
In that case, the first quoted module path is used by MrEd for loading In that case, the first quoted module path is used by MrEd for loading
WXME files in graphical mode; the corresponding module must provide WXME files in graphical mode; the corresponding module must provide
`snip-class' object that implements MrEd's `snip-class%' class. the `snip-class' object that implements MrEd's `snip-class%' class. The
second quoted module path is used by the "wxme.ss" library for second quoted module path is used by the "wxme.ss" library for
converting WXME streams without MrEd support; the corresponding module converting WXME streams without MrEd support; the corresponding module
must provide a `reader' object that implements `reader<%>' interface must provide a `reader' object that implements `reader<%>' interface
@ -234,15 +238,17 @@ provides several methods:
data is available instead data is available instead
> (get-data) - returns bytes for a PNG, XBM,or XPM file for the > (get-data) - returns bytes for a PNG, XBM,or XPM file for the
image image
> (get-width) - returns the display width of the image, which may > (get-w) - returns the display width of the image, which may
differ from the width of the actual image secified differ from the width of the actual image secified
as data or by a filename as data or by a filename; -1 means that the image
> (get-height) - returns the display height of the image, which may data's width should be used
> (get-h) - returns the display height of the image, which may
differ from the width of the actual image secified differ from the width of the actual image secified
as data or by a filename as data or by a filename; -1 means that the image
> (get-x-offset) - returns an offset into the actual image to be used data's width should be used
> (get-dx) - returns an offset into the actual image to be used
as the left of the display image as the left of the display image
> (get-y-offset) - returns an offset into the actual image to be used > (get-dy) - returns an offset into the actual image to be used
as the top of the display image as the top of the display image
====================================================================== ======================================================================

View File

@ -460,7 +460,7 @@
(if (= i len) (if (= i len)
null null
(cons (cons
(read-a-string who port vers "image-snip image content") (read-raw-string who port vers "image-snip image content")
(loop (add1 i))))))))]) (loop (add1 i))))))))])
(if (header-plain-text? header) (if (header-plain-text? header)
#"." #"."