3 Cache-image Snip
The mrlib/cache-image-snip library provides the core
data structure for DrScheme’s "image.ss" teachpack. Images in
the "image.ss" teachpack are instances of the
The library also defines a new type, argb, that represents a
bitmap, but with alpha values. It has a maker, two selectors, and a
Returns a pixel array for this image, forcing it to be
Returns a procedure that fills in an argb with the contents of this image
at the given offset
Returns a pixel array for this image or #f if it has not
been computed yet.
Builds (if not yet built) a bitmap corresponding to
this snip and returns it.
If the width or the height of the snip is 0,
this method return #f.
Either returns false, or a procedure that draws the
contents of this snip into a dc.
Returns the pinhole coordinates for this image, counting
from the top-left of the image.
Returns the width and height for the image.
This snipclass is used for saved cache image snips.
Constructs a new argb value. The vector has four entries
for each pixel, an alpha, red, green, and blue value. The
int specifies the width of the image; the height is the
size of the vector, divided by 4, divided by the width.
Extracts the vector from argb.
Extracts the width from argb.
Extracts the height from argb.
Returns #t if v is an argb, #f otherwise.
Changes argb, overlaying img with masking based on
mask at (dx, dy) from the top-left.
Builds a bitmap of size width by height, using the
procedure draw to render the bitmap content into the given
Builds a new bitmap that flattens the original bitmap
with its mask (as determined by get-loaded-mask in bitmap%), producing a bitmap that has no mask, and looks
the way that bitmap would draw (when drawn with the mask) onto a
Builds a new cache-image-snip% based on the contents of
argb, using dx and dy as the pinhole.
Builds a bitmap that draws the same way as argb; the alpha
pixels are put into the bitmap’s get-loaded-mask
If the width or height of argb is 0,
this returns #f.