Textures are essentially images: a 2D grid of color values. The
(chickadee graphics texture)
module provides an interface for
working with texture objects.
Load the image data from file and return a new texture object.
min-filter and mag-filter describe the method that should
be used for minification and magnification when rendering,
respectively. Possible values are nearest
and linear
.
wrap-s and wrap-t describe how to interpret texture
coordinates that are greater than 1.0
. Possible values are
repeat
, clamp
, clamp-to-border
, and
clamp-to-edge
.
For color-keyed images (images where a specific color should be made transparent), specify the appropriate transparent-color.
Return #t
if obj is a texture.
Return #t
if obj is a texture region.
If texture is a texture region, return the full texture that it
is based upon. Otherwise, return #f
.
Return the minification filter for texture, either
nearest
or linear
.
Return the magnification filter for texture, either
nearest
or linear
.
Return the method used for wrapping texture coordinates along the X axis for texture.
Possible wrapping methods:
repeat
clamp
clamp-to-border
clamp-to-edge
Return the method used for wrapping texture coordinates along the Y axis for texture.
Return the width of texture in pixels.
Return the height of texture in pixels.
It is common practice to combine multiple bitmap images into a single texture, known as a “tile atlas” or “tile set”, because it is more efficient to render many regions of a large texture than it is to render a bunch of small textures. Chickadee provides a tile atlas data type for collecting texture regions into a single vector.
Return a new texture atlas that splits texture into a grid of tile-width by tile-height rectangles. Optionally, each tile may have spacing pixels of horizontal and vertical space between surrounding tiles and the entire image may have margin pixels of empty space around its border.
This type of texture atlas layout is very common for 2D tile maps. See Tile Maps for more information.
Return a new texture atlas that splits the texture loaded from the
file file-name into a grid of tile-width by
tile-height rectangles. See load-image
and
split-texture
for information about all keyword arguments.
Return #t
if obj is a texture atlas.
Return the texture that all texture regions in atlas have been created from.
Return the texture region in atlas at index.