fix bitmap-related docs
This commit is contained in:
parent
439683af5e
commit
af4ccd2de1
|
@ -104,7 +104,7 @@
|
|||
(bytes-fill! (cairo_image_surface_get_data s) 255)])
|
||||
s)
|
||||
#f)]
|
||||
[([path-string? filename]
|
||||
[([(make-alts path-string? input-port?) filename]
|
||||
[kind-symbol? [kind 'unknown]]
|
||||
[(make-or-false color%) [bg-color #f]])
|
||||
(let-values ([(s b&w?) (do-load-bitmap filename kind bg-color)]
|
||||
|
|
|
@ -16,7 +16,7 @@ Sometimes, a bitmap object creation fails in a low-level manner. In
|
|||
[height (integer-in 1 10000)]
|
||||
[monochrome? any/c #f]
|
||||
[alpha? any/c #f])
|
||||
([filename path-string?]
|
||||
([in (or/c path-string? input-port?)]
|
||||
[kind (one-of/c 'unknown 'unknown/mask 'unknown/alpha
|
||||
'gif 'gif/mask 'gif/alpha
|
||||
'jpeg 'jpeg/alpha
|
||||
|
@ -35,9 +35,9 @@ When @scheme[width] and @scheme[height] are provided: Creates a new
|
|||
bitmap has an alpha channel; otherwise, the bitmap is color without
|
||||
an alpha channel. The initial content of the bitmap is undefined.
|
||||
|
||||
When @scheme[filename] is provided: Creates a bitmap from a file,
|
||||
where @scheme[kind] specifies the kind of image file. See
|
||||
@method[bitmap% load-file] for details.
|
||||
When @scheme[in] is provided: Creates a bitmap from a file format,
|
||||
where @scheme[kind] specifies the format. See @method[bitmap%
|
||||
load-file] for details.
|
||||
|
||||
|
||||
When a @scheme[bits] byte string is provided: Creates a monochrome
|
||||
|
@ -139,7 +139,7 @@ Returns @scheme[#f] if the bitmap is monochrome, @scheme[#t] otherwise.
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(load-file [name path-string?]
|
||||
@defmethod[(load-file [in (or/c path-string? input-port?)]
|
||||
[kind (one-of/c 'unknown 'unknown/mask 'unknown/alpha
|
||||
'gif 'gif/mask 'gif/alpha
|
||||
'jpeg 'jpeg/alpha
|
||||
|
@ -150,15 +150,16 @@ Returns @scheme[#f] if the bitmap is monochrome, @scheme[#t] otherwise.
|
|||
[bg-color (or/c (is-a?/c color%) false/c) #f])
|
||||
boolean?]{
|
||||
|
||||
Loads a bitmap from a file. If the bitmap is in use by a
|
||||
@scheme[bitmap-dc%] object or a control, the bitmap file is not
|
||||
Loads a bitmap from a file format that read from @racket[in].
|
||||
If the bitmap is in use by a
|
||||
@scheme[bitmap-dc%] object or a control, the image data is not
|
||||
loaded. The bitmap changes its size and depth to match that of
|
||||
the loaded image.
|
||||
|
||||
The @scheme[kind] argument specifies the file's format:
|
||||
|
||||
@itemize[
|
||||
@item{@scheme['unknown] --- examine the file to determine its format; creates either a monochrome or
|
||||
@item{@scheme['unknown] --- examine the file to determine its format; creates either a monochrome
|
||||
or color bitmap without an alpha channel}
|
||||
@item{@scheme['unknown/mask] --- like @scheme['unknown], but see @method[bitmap% get-loaded-mask]}
|
||||
@item{@scheme['unknown/alpha] --- like @scheme['unknown], but if the bitmap is color, it has an
|
||||
|
|
|
@ -70,12 +70,13 @@ The pixel RGB values are copied into @scheme[pixels]. The first byte
|
|||
DC. The pixels are in row-major order, left to right then top to
|
||||
bottom.
|
||||
|
||||
If @scheme[alpha?] is false, then the alpha value for each pixel is
|
||||
set to 255. If @scheme[alpha?] is true, then @italic{only} the alpha
|
||||
value is set for each pixel, based on each pixel's inverted value. Thus, the
|
||||
same @scheme[pixels] byte string is in general filled from two bitmaps:
|
||||
one (the main image) for the pixel values and one (the mask) for the
|
||||
alpha values.
|
||||
If @scheme[alpha?] is false, if the bitmap does not have an alpha
|
||||
channel, then the alpha value for each pixel is set to 255. If
|
||||
@scheme[alpha?] is true, then @italic{only} the alpha value is set
|
||||
for each pixel, based on each pixel's inverted value. Thus, when a
|
||||
bitmap has a separate mask bitmap, the same @scheme[pixels] byte
|
||||
string is in general filled from two bitmaps: one (the main image)
|
||||
for the pixel values and one (the mask) for the alpha values.
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user