raster
0.0.0A library for software rasterisation
About Raster
This is a portable software rasterisation library. It implements many primitives to perform drawing operations in software onto a portable and ubiquitous format: 8-bit RGBA pixel buffers.
Basic Operation
We'll assume the package org.shirakumo.raster
is nicknamed to raster
. You can perform simple raster operations with the with-drawing
macro and the draw commands:
(raster:with-drawing (800 600)
(raster:draw-line 10 10 100 100)
(raster:draw-line 10 20 100 100 :sampler (raster:encode-color 255 0 0))
(raster:draw-rectangle 400 300 100 100 :sampler (raster:encode-color 0 255 0 128))
(raster:draw-ellipse 800 600 200 100 :feather 10)
(raster:with-rect-clip (0 0 100 100)
(raster:draw-ellipse 100 100 50 50)))
This will return the completed image
into which the shapes were drawn. Please see the respective functions for all available options.
Compositing and Sampling
Most draw-*
calls are relatively simple wrappers over composite-sdf
. Sometimes though it can be too expensive to perform raster operations via SDFs. In this case you may want to either draw pixels directly yourself via color-ref
and color-ref*
, or at least handle the compositing of different buffers and samplers.
blit-buffer
simply copies pixels from one buffer's sub-region to another. It does not perform interpolation, so it can't stretch or squash the image.
composite-buffer
composites the pixels from one buffer onto another with basic "source-over" alpha blending applied. This is typically how two images are combined.
composite-mask
does the same but using an arbitrary sampler
and an alpha mask to determine which pixels to draw to.
composite-sdf
finally is the same as composite-mask
but instead of using an explicit mask, it relies on an sdf
function to provide the mask.
A sampler
is a function that simply returns a color
value for a given pixel index
pair. The underlying source can be a constant colour (via solid-color
), another image (via sampler
), a gradient (via radial-gradient
, linear-gradient
, bilinear-gradient
, diamond-gradient
, or conical-gradient
), or some other function that computes the colour value to use.
The primary sampler
constructed from an image also allows you to rotate and transform the image arbitrarily. To do this it uses the sample-color
function to access pixels, which performs bilinear interpolation of colours as needed.
Signed Distance Fields
Most drawing operations happen via Signed Distance Fields. These are functions that represent the distance to an outline as a signed number, positive being outside, negative inside. They are a very convenient representation of shapes, since they can easily be combined together and evaluated to produce blurred and anti-aliased shapes.
This library provides a variety of functions to create sdf
s for particular shapes:
And to combine or manipulate them:
While SDFs are extremely convenient in this way, be aware that the more complex the shape, the more expensive it gets to evaluate and thus raster the SDF, so they aren't suitable for everything, especially when performance is crucial.
System Information
Definition Index
-
ORG.SHIRAKUMO.RASTER
No documentation provided.-
EXTERNAL STRUCTURE IMAGE
Representation of a pixel buffer along with its image dimensions. See IMAGE-BUFFER See IMAGE-WIDTH See IMAGE-HEIGHT See MAKE-IMAGE
-
EXTERNAL TYPE-DEFINITION BUFFER
Type representing a pixel buffer. This is an alias for (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)) with the following additional constraint: the data contained within should be pixels in row-major order laid out as B G R A quadruplets. As such, the length of a buffer should always be a multiple of four. A buffer can hold a maximum of 1073741823 (2^30-1) pixels. See COLOR (type) See CHANNEL (type) See COLOR-REF See COLOR-REF*
-
EXTERNAL TYPE-DEFINITION CHANNEL
Type representing a single color channel. This is an alias for (UNSIGNED-BYTE 8). See BUFFER (type) See COLOR (type)
-
EXTERNAL TYPE-DEFINITION COLOR
Type representing a single color or pixel. This is an alias for (UNSIGNED-BYTE 32) with four eight-bit color channels laid out as B G R A in little-endian order, meaning B occupies the lowest bits and A the highest bits. See BUFFER (type) See ENCODE-COLOR See DECODE-COLOR See COLOR-REF See COLOR-REF*
-
EXTERNAL TYPE-DEFINITION COORDINATE
Type representing a coordinate within an SDF. This is an alias for SINGLE-FLOAT. See COORDINATE
-
EXTERNAL TYPE-DEFINITION INDEX
Type representing an index into a color buffer. This is an alias for (UNSIGNED-BYTE 32) and is used to represent dimensions and coordinates for a color buffer. The index of a pixel must not exceed 1073741823 (2^30-1). See BUFFER (type)
-
EXTERNAL TYPE-DEFINITION SAMPLER
Type representing sampling functions. This is an alias for (FUNCTION (INDEX INDEX) COLOR). A sampler should be a function that takes an X and Y pixel index, and returns a single COLOR for that point. See COLOR (type) See INDEX (type)
-
EXTERNAL TYPE-DEFINITION SDF
Type representing a signed distance field. This is an alias for (FUNCTION (COORDINATE COORDINATE) SINGLE-FLOAT). A SDF should be a function that takes an X and Y pixel index and returns a single SINGLE-FLOAT that describes the signed distance function value at that point. Positive values lie outside, and negative values lie inside the described shape. See COORDINATE (type)
-
EXTERNAL TYPE-DEFINITION TRANSFORM
Type representing a 2D affine transformation matrix. This is an alias for (SIMPLE-ARRAY SINGLE-FLOAT (6)). The matrix elements are stored in row-major order. The identity matrix is therefore #(1 0 0 0 1 0). See MAKE-TRANSFORM
-
EXTERNAL FUNCTION ALPHA-BLEND
- SRC
- DST
- ALPHA
Performs source-over alpha blending for a single color channel. SRC should be the source color to be overlaid, DST should be the target color to be overlaid onto. ALPHA should be the alpha value of the new color. Returns the blended result. All values should be (UNSIGNED-BYTE 8).
-
EXTERNAL FUNCTION BILINEAR-GRADIENT
- STOPS
- AX
- AY
- BX
- BY
Creates a bilinear gradient sampler. STOPS should be a list where each entry describes a griadent stop. A gradient stop should be a list of two elements, the first being the stop index and the second being the colour at that stop. The indices should be in the range of [0,1]. AX and AY should be the coordinates of the gradient's start. BX and BY should be the coordinates of the gradient's stop. The bilinear gradient is like the linear gradient, but mirrored at A. See SAMPLER (type) See LINEAR-GRADIENT
-
EXTERNAL FUNCTION BLIT-BUFFER
- SOURCE
- SW
- SH
- TARGET
- TW
- TH
- &KEY
- TX
- TY
- SX
- SY
- W
- H
Copy one pixel buffer to another. This simply replaces pixels with no attempt at blending and as such is much faster of an operation than COMPOSITE-BUFFER. Both SOURCE and TARGET must be BUFFERs. SW and SH should be the dimensions of the source image. TW and TH should be the dimensions of the target image. SX and SY should be offsets of the region to read from the source. TX and TY should be offsets of the region to write into the target. W and H should be the width and height of the region to transfer. If any part of the source or target region should be out of bounds, the operation is truncated to only transfer valid pixels. If the SOURCE and TARGET are EQ the consequences are undefined. See BUFFER (type) See COMPOSITE-BUFFER
-
EXTERNAL FUNCTION CLEAR
- BUFFER
- &OPTIONAL
- COLOR
Clears the pixel buffer to :white or :black. This is equivalent to (fill buffer 0) for black or (fill buffer 255) for white, but may be more efficient. See BUFFER
-
EXTERNAL FUNCTION CLIP
- SDF
Clip the SDF to be within the clipping region only. See PUSH-CLIP See POP-CLIP See WITH-CLIP See WITH-NO-CLIPPING See SDF (type)
-
EXTERNAL FUNCTION COLOR-REF
- BUFFER
- I
Accesses a single pixel in a color buffer. The color buffer must be a BUFFER, and the INDEX must be in the valid buffer range. Attempting to reference a pixel outside the buffer leads to undefined behaviour. See COLOR (type) See BUFFER (type) See INDEX (type) See COLOR-REF*
-
EXTERNAL FUNCTION (SETF COLOR-REF)
- VALUE
- BUFFER
- I
No documentation provided. -
EXTERNAL FUNCTION COLOR-REF*
- BUFFER
- X
- Y
- W
- H
- &KEY
- BORDER
Accesses a single pixel in a color buffer with border handling. BORDER defines how to deal with coordinates that lie outside of the buffer region. It can be one of the following: :CLAMP --- Accesses the nearest pixel on the border of the buffer. :REPEAT --- Wraps the coordinate around. COLOR --- Returns the BORDER color instead. When setting this place, :BORDER and :CLAMP do not modify anything when the pixel lies outside the buffer. The color buffer must be a BUFFER and the X, Y, W, and H descriptors must be INDEXes. X and Y may lay outside their respective ranges, but the W and H must be accurate to the buffer's contents. If they are not, undefined behaviour occurs. See COLOR (type) See INDEX (type) See BUFFER (type) See COLOR-REF
-
EXTERNAL FUNCTION (SETF COLOR-REF*)
- COLOR
- BUFFER
- X
- Y
- W
- H
- &KEY
- BORDER
No documentation provided. -
EXTERNAL FUNCTION COMBINE
- A
- B
Combine (union) the two shapes. See SDF (type)
-
EXTERNAL FUNCTION COMPOSITE-BUFFER
- SOURCE
- SW
- SH
- TARGET
- TW
- TH
- &KEY
- TX
- TY
- SX
- SY
- W
- H
Composite two image buffers together. This performs basic "source-over" alpha blending. Both SOURCE and TARGET must be BUFFERs. SW and SH should be the dimensions of the source image. TW and TH should be the dimensions of the target image. SX and SY should be offsets of the region to read from the source. TX and TY should be offsets of the region to write into the target. W and H should be the width and height of the region to transfer. If any part of the source or target region should be out of bounds, the operation is truncated to only transfer valid pixels. If the SOURCE and TARGET are EQ the consequences are undefined. See ALPHA-BLEND See BUFFER (type) See COMPOSITE-MASK
-
EXTERNAL FUNCTION COMPOSITE-MASK
- SAMPLER
- SOURCE
- SW
- SH
- TARGET
- TW
- TH
- &KEY
- TX
- TY
- SX
- SY
- W
- H
Composite a mask onto a target buffer using a color function. This performs basic "source-over" alpha blending. TARGET must be a BUFFER. SOURCE must be a W*H sized (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)) that holds the alpha mask. SAMPLER should be a SAMPLER. SW and SH should be the dimensions of the source image. TW and TH should be the dimensions of the target image. SX and SY should be offsets of the region to read from the source. TX and TY should be offsets of the region to write into the target. W and H should be the width and height of the region to transfer. If any part of the source or target region should be out of bounds, the operation is truncated to only transfer valid pixels. If the SAMPLER accesses the TARGET the consequences are undefined. See ALPHA-BLEND See BUFFER (type) See SAMPLER (type)
-
EXTERNAL FUNCTION COMPOSITE-SDF
- SAMPLER
- SDF
- SW
- SH
- TARGET
- TW
- TH
- &KEY
- TX
- TY
- SX
- SY
- W
- H
- FEATHER
Composite a shape described by a signed distance function onto a target buffer using a color function. This performs basic "source-over" alpha blending. TARGET must be a BUFFER. SDF should be an SDF. SAMPLER should be a SAMPLER. SW and SH should be the dimensions of the source image. TW and TH should be the dimensions of the target image. SX and SY should be offsets of the region to read from the source. TX and TY should be offsets of the region to write into the target. W and H should be the width and height of the region to transfer. If any part of the source or target region should be out of bounds, the operation is truncated to only transfer valid pixels. If the SAMPLER accesses the TARGET the consequences are undefined. See ALPHA-BLEND See BUFFER (type) See SDF (type) See SAMPLER (type)
-
EXTERNAL FUNCTION CONICAL-GRADIENT
- STOPS
- X
- Y
Creates a conical gradient sampler. STOPS should be a list where each entry describes a griadent stop. A gradient stop should be a list of two elements, the first being the stop index and the second being the colour at that stop. The indices should be in the range of [0,2*PI]. X and Y should be the coordinates of the gradient's center. See SAMPLER (type)
-
EXTERNAL FUNCTION COORDINATE
- X
Coerces the input into a coordinate. See COORDINATE (type)
-
EXTERNAL FUNCTION CURVE
- AX
- AY
- WX
- WY
- VX
- VY
- BX
- BY
- &KEY
- THICKNESS
No documentation provided. -
EXTERNAL FUNCTION DECODE-COLOR
- C
Decodes an (UNSIGNED-BYTE 32) into its B G R A color components. See ENCODE-COLOR
-
EXTERNAL FUNCTION DIAMOND-GRADIENT
- STOPS
- X
- Y
Creates a diamond gradient sampler. STOPS should be a list where each entry describes a griadent stop. A gradient stop should be a list of two elements, the first being the stop index and the second being the colour at that stop. The indices are relative to the actual coordinate system in which the sampler is evaluated. X and Y should be the coordinates of the gradient's center. See SAMPLER (type)
-
EXTERNAL FUNCTION DRAW-CURVE
- AX
- AY
- WX
- WY
- VX
- VY
- BX
- BY
- BUFFER
- BW
- BH
- &KEY
- SAMPLER
- LINE-WIDTH
- FEATHER
Draw a cubic bezier curve onto the given buffer. A and B are the end points and W and V the corresponding handle points. BUFFER must be a pixel buffer and BW and BH its dimensions. SAMPLER is coerced via ENSURE-SAMPLER. It is used to derive the actual color information to fill the shape. LINE-WIDTH should be the width of the stroke. FEATHER should be a feathering (blurring) radius applied to the shape. Note that the blur only extends inwards, meaning the shape only ever gets perceptually "smaller". You may have to increase its size to compensate. The shape is clipped by the current clipping region prior to rasterisation. See BUFFER (type) See INDEX (type) See SAMPLER (type) See ENSURE-SAMPLER See CLIP See CURVE
-
EXTERNAL FUNCTION DRAW-CURVES
- POINTS
- BUFFER
- BW
- BH
- &KEY
- SAMPLER
- LINE-WIDTH
- FEATHER
- LINE-STYLE
- JOIN-STYLE
- CAP-STYLE
TODO: Implement
-
EXTERNAL FUNCTION DRAW-ELLIPSE
- X
- Y
- W
- H
- BUFFER
- BW
- BH
- &KEY
- SAMPLER
- LINE-WIDTH
- FEATHER
- START
- END
- INNER-RADIUS
Draw an ellipse onto the given buffer. BUFFER must be a pixel buffer and BW and BH its dimensions. SAMPLER is coerced via ENSURE-SAMPLER. It is used to derive the actual color information to fill the shape. LINE-WIDTH should be the width of the stroke. If none is passed, the rectangle is filled instead. FEATHER should be a feathering (blurring) radius applied to the shape. Note that the blur only extends inwards, meaning the shape only ever gets perceptually "smaller". You may have to increase its size to compensate. START and END, if given, describe the starting and ending angles of the pie that is drawn. INNER-RADIUS, if given, describes the radius of the inner cutout of the arc that is drawn. If the arc is not symmetrical, this radius is relative to the width and the inner radius in height is derived automatically. The shape is clipped by the current clipping region prior to rasterisation. See BUFFER (type) See INDEX (type) See SAMPLER (type) See ENSURE-SAMPLER See CLIP See ELLIPSE
-
EXTERNAL FUNCTION DRAW-IMAGE
- IMAGE
- X
- Y
- BUFFER
- BW
- BH
- &KEY
- TRANSFORM
Draw another image onto the given buffer. BUFFER must be a pixel buffer and BW and BH its dimensions. IMAGE must be an IMAGE. X and Y must be INDEX coordinates of where to draw the image in the buffer. TRANSFORM may be a transform matrix by which to transform the image. The shape is clipped by the current clipping region prior to rasterisation. See BUFFER (type) See INDEX (type) See IMAGE (type) See CLIP
-
EXTERNAL FUNCTION DRAW-LINE
- AX
- AY
- BX
- BY
- BUFFER
- BW
- BH
- &KEY
- SAMPLER
- LINE-WIDTH
- FEATHER
Draw a line onto the given buffer. BUFFER must be a pixel buffer and BW and BH its dimensions. SAMPLER is coerced via ENSURE-SAMPLER. It is used to derive the actual color information to fill the shape. LINE-WIDTH should be the width of the stroke. FEATHER should be a feathering (blurring) radius applied to the shape. Note that the blur only extends inwards, meaning the shape only ever gets perceptually "smaller". You may have to increase its size to compensate. The shape is clipped by the current clipping region prior to rasterisation. See BUFFER (type) See INDEX (type) See SAMPLER (type) See ENSURE-SAMPLER See CLIP See LINE
-
EXTERNAL FUNCTION DRAW-LINES
- POINTS
- BUFFER
- BW
- BH
- &KEY
- SAMPLER
- LINE-WIDTH
- FEATHER
- LINE-STYLE
- JOIN-STYLE
- CAP-STYLE
TODO: Implement
-
EXTERNAL FUNCTION DRAW-POLYGON
- POINTS
- BUFFER
- BW
- BH
- &KEY
- SAMPLER
- LINE-WIDTH
- FEATHER
Draw a closed polygon onto the given buffer. BUFFER must be a pixel buffer and BW and BH its dimensions. SAMPLER is coerced via ENSURE-SAMPLER. It is used to derive the actual color information to fill the shape. LINE-WIDTH should be the width of the stroke. If none is passed, the rectangle is filled instead. FEATHER should be a feathering (blurring) radius applied to the shape. Note that the blur only extends inwards, meaning the shape only ever gets perceptually "smaller". You may have to increase its size to compensate. The POINTS should be a SEQUENCE in which the points are packed. Meaning the sequence contains [X1 Y1 X2 Y2 ...]. The shape is clipped by the current clipping region prior to rasterisation. See BUFFER (type) See INDEX (type) See SAMPLER (type) See ENSURE-SAMPLER See CLIP See POLYGON
-
EXTERNAL FUNCTION DRAW-RECTANGLE
- X
- Y
- W
- H
- BUFFER
- BW
- BH
- &KEY
- SAMPLER
- LINE-WIDTH
- CORNER-RADII
- FEATHER
Draw a rectangle onto the given buffer. BUFFER must be a pixel buffer and BW and BH its dimensions. SAMPLER is coerced via ENSURE-SAMPLER. It is used to derive the actual color information to fill the shape. LINE-WIDTH should be the width of the stroke. If none is passed, the rectangle is filled instead. FEATHER should be a feathering (blurring) radius applied to the shape. Note that the blur only extends inwards, meaning the shape only ever gets perceptually "smaller". You may have to increase its size to compensate. CORNER-RADII if given should be a sequence of four elements, which describe the radii of the corners of the rectangle, with the first being top left, second top right, third bottom right, and fourth bottom left. The shape is clipped by the current clipping region prior to rasterisation. See BUFFER (type) See INDEX (type) See SAMPLER (type) See ENSURE-SAMPLER See CLIP See RECTANGLE
-
EXTERNAL FUNCTION ELLIPSE
- X
- Y
- W
- H
- &KEY
- START
- END
- INNER-RADIUS
Construct an ellipse SDF. X and Y should be the centre coordinates of the ellipse. W and H should be the half-size dimensions of the ellipse. START and END, if given, describe the starting and ending angles of the pie that is drawn. INNER-RADIUS, if given, describes the radius of the inner cutout of the arc that is drawn. If the arc is not symmetrical, this radius is relative to the width and the inner radius in height is derived automatically. See SDF (type)
-
EXTERNAL FUNCTION ENCODE-COLOR
- B
- G
- R
- &OPTIONAL
- A
Encodes a B G R A quadruplet into an (UNSIGNED-BYTE 32) color. See DECODE-COLOR
-
EXTERNAL FUNCTION ENSURE-SAMPLER
- SAMPLER
Tries to ensure the object is a sampler. If the object is a FUNCTION, it is returned. If the function is not an actual SAMPLER, the behaviour is undefined. If the object is a COLOR, a SOLID-COLOR sampler is returned. If the object is an IMAGE, a SAMPLER with REPEAT bordering is returned. If the object is NIL, a SOLID-COLOR sampler of 0 (transparent black) is returned. See SOLID-COLOR See SAMPLER See COLOR (type) See SAMPLER (type)
-
EXTERNAL FUNCTION EVALUATE-GRADIENT
- STOPS
- I
Evaluates a linear gradient. STOPS should be a list where each entry describes a griadent stop. A gradient stop should be a list of two elements, the first being the stop index and the second being the colour at that stop. I should be the point at which to evaluate the gradient. If I is smaller than the first stop, the first stop's color is returned. If I is larger than the last stop, the last stop's color is returned. If I lies between two stops, the returned color is a linear interpolation of the two stops, respective to I's position between them. See COLOR (type) See LERP-COLOR
-
EXTERNAL FUNCTION IMAGE-BUFFER
- INSTANCE
Accesses the underlying pixel buffer of the image. The buffer must be 4*WIDTH*HEIGHT in size. See IMAGE (type) See BUFFER (type)
-
EXTERNAL FUNCTION (SETF IMAGE-BUFFER)
- VALUE
- INSTANCE
No documentation provided. -
EXTERNAL FUNCTION IMAGE-HEIGHT
- INSTANCE
Accesses the height of the pixel buffer. See IMAGE (type) See INDEX
-
EXTERNAL FUNCTION (SETF IMAGE-HEIGHT)
- VALUE
- INSTANCE
No documentation provided. -
EXTERNAL FUNCTION IMAGE-WIDTH
- INSTANCE
Accesses the width of the pixel buffer. See IMAGE (type) See INDEX
-
EXTERNAL FUNCTION (SETF IMAGE-WIDTH)
- VALUE
- INSTANCE
No documentation provided. -
EXTERNAL FUNCTION INTERSECT
- A
- B
Intersect the two shapes. See SDF (type)
-
EXTERNAL FUNCTION LERP-COLOR
- A
- B
- X
Linearly interpolates between two colors. A and B must be COLORs, and X must be a SINGLE-FLOAT in range [0,1] that encompasses the interpolation distance between the two for the resulting color. Each CHANNEL of the colors is interpolated separately. If X is out of range or A or B aren't COLORs the results are undefined. See COLOR (type)
-
EXTERNAL FUNCTION LINE
- AX
- AY
- BX
- BY
- &KEY
- THICKNESS
Construct a line SDF. AX and AY describe the start point coordinates. BX and BY describe the end point coordinates. THICKNESS describes the width of the line. See SDF (type)
-
EXTERNAL FUNCTION LINEAR-GRADIENT
- STOPS
- AX
- AY
- BX
- BY
Creates a linear gradient sampler. STOPS should be a list where each entry describes a griadent stop. A gradient stop should be a list of two elements, the first being the stop index and the second being the colour at that stop. The indices should be in the range of [0,1]. AX and AY should be the coordinates of the gradient's start. BX and BY should be the coordinates of the gradient's stop. See SAMPLER (type) See BILINEAR-GRADIENT
-
EXTERNAL FUNCTION MAKE-BUFFER
- W
- H
- &OPTIONAL
- CONTENTS
Creates a fresh pixel buffer. If CONTENTS is given, it must be a sequence that equals 4*W*H in length. See BUFFER (type)
-
EXTERNAL FUNCTION MAKE-IMAGE
- W
- H
- &OPTIONAL
- BUFFER
Creates a new image. If BUFFER is given and it is already a BUFFER, then the value is shared with the resulting IMAGE instance. Otherwise, a new BUFFER is allocated and the contents are copied over. See IMAGE (type) See BUFFER
-
EXTERNAL FUNCTION MAKE-TRANSFORM
- &REST
- ARGS
Create a transform matrix. If no arguments are passed, an identity matrix is returned. Otherwise you must pass 6 arguments, which form the 6 elements of the matrix in row-major order. See TRANSFORM (type)
-
EXTERNAL FUNCTION OUTLINE
- SDF
- THICKNESS
Create an outline of the given thickness out of the shape. See SDF (type)
-
EXTERNAL FUNCTION POLYGON
- POINTS
Construct a closed polygon SDF. The POINTS should be a SEQUENCE in which the points are packed. Meaning the sequence contains [X1 Y1 X2 Y2 ...]. See SDF (type)
-
EXTERNAL FUNCTION POP-CLIP
Pop a clipping SDF from the stack. If no corresponding push operation happened first, an error is signalled. See PUSH-CLIP See CLIP See WITH-CLIP See WITH-NO-CLIPPING
-
EXTERNAL FUNCTION PUSH-CLIP
- SDF
Push a clipping SDF onto the stack. This will only ever //narrow// the clipping region to become the intersection of the current clipping region and the newly passed one. See POP-CLIP See CLIP See WITH-CLIP See WITH-NO-CLIPPING See SDF (type)
-
EXTERNAL FUNCTION RADIAL-GRADIENT
- STOPS
- X
- Y
Creates a radial gradient sampler. STOPS should be a list where each entry describes a griadent stop. A gradient stop should be a list of two elements, the first being the stop index and the second being the colour at that stop. The indices are relative to the actual coordinate system in which the sampler is evaluated. X and Y should be the coordinates of the gradient's center. See SAMPLER (type)
-
EXTERNAL FUNCTION RECTANGLE
- X
- Y
- W
- H
- &KEY
- CORNER-RADII
Construct a rectangular SDF. X and Y should be the centre coordinates of the rectangle. W and H should be the half-size dimensions of the rectangle. CORNER-RADII if given should be a sequence of four elements, which describe the radii of the corners of the rectangle, with the first being top left, second top right, third bottom right, and fourth bottom left. See SDF (type)
-
EXTERNAL FUNCTION ROTATE
- SDF
- ANGLE
Rotate the shape by the given angle. See SDF (type)
-
EXTERNAL FUNCTION SAMPLE-COLOR
- BUFFER
- X
- Y
- W
- H
- &KEY
- BORDER
Samples a color from a buffer. Unlike COLOR-REF and COLOR-REF* this allows COORDINATEs for X and Y, performing bilinear interpolation as necessary if the requested index should lie between pixels. The BORDER argument is the same as for COLOR-REF* See BUFFER (type) See COORDINATE (type) See COLOR (type) See COLOR-REF See COLOR-REF*
-
EXTERNAL FUNCTION SAMPLER
- BUFFER
- W
- H
- &KEY
- BORDER
- TRANSFORM
Creates a texture sampler function. The color buffer must be a BUFFER. The BORDER argument is the same as for COLOR-REF* The TRANSFORM may be a TRANSFORM matrix by which the coordinates passed to the resulting SAMPLER are transformed before sampling the color buffer, thereby allowing you to rotate, scale, and otherwise transform the buffer. See SAMPLER (type) See TRANSFORM (type) See COLOR-REF* See COMPOSITE-MASK See COMPOSITE-SDF
-
EXTERNAL FUNCTION SCALE
- SDF
- X
- Y
Scale the shape by the given coordinates. See SDF (type)
-
EXTERNAL FUNCTION SKEW
- SDF
- X
- Y
Skew the shape by the given degrees. See SDF (type)
-
EXTERNAL FUNCTION SOLID-COLOR
- R
- G
- B
- &OPTIONAL
- A
Creates a sampler with a uniform color. See SAMPLER (type) See COLOR (type) See COMPOSITE-MASK See COMPOSITE-SDF
-
EXTERNAL FUNCTION SUBTRACT
- A
- B
Subtract the second shape from the first. See SDF (type)
-
EXTERNAL FUNCTION TRANSFORM
- SDF
- MAT
Transform the shape by the given affine transform matrix. See TRANSFORM (type) See SDF (type)
-
EXTERNAL FUNCTION TRANSLATE
- SDF
- X
- Y
Trasnlate (move) the shape by the given coordinates. See SDF (type)
-
EXTERNAL MACRO WITH-CLIP
- SDF
- &BODY
- BODY
Narrow the clipping region during BODY by SDF. See WITH-NO-CLIPPING See PUSH-CLIP See POP-CLIP See CLIP See SDF (type) See WITH-RECT-CLIP
-
EXTERNAL MACRO WITH-DRAWING
- IMAGE
- &BODY
- BODY
Convenience macro for drawing to an image. IMAGE may either be a variable bound to an IMAGE instance, or a list of arguments to pass to MAKE-IMAGE. For instance, in order to draw to a buffer, you may use (WIDTH HEIGHT BUFFER) for the IMAGE. Either way, the IMAGE instance is returned at the end. Within BODY the DRAW-* functions act the same as documented, except that the BUFFER, BW, and BH arguments cannot be passed and are instead filled in for you by the values of the IMAGE. This makes it a lot more convenient to perform a sequence of draw operations on a buffer. See IMAGE (type) See DRAW-LINE See DRAW-CURVE See DRAW-LINES See DRAW-CURVES See DRAW-RECTANGLE See DRAW-ELLIPSE See DRAW-POLYGON See DRAW-IMAGE
-
EXTERNAL MACRO WITH-NO-CLIPPING
- &BODY
- BODY
Disables previously applied clipping during BODY. See WITH-CLIP
-
EXTERNAL MACRO WITH-RECT-CLIP
- X
- Y
- W
- H
- &BODY
- BODY
-
EXTERNAL SOURCE-TRANSFORM IMAGE-BUFFER
No documentation provided. -
EXTERNAL SOURCE-TRANSFORM (SETF IMAGE-BUFFER)
No documentation provided. -
EXTERNAL SOURCE-TRANSFORM IMAGE-HEIGHT
No documentation provided. -
EXTERNAL SOURCE-TRANSFORM (SETF IMAGE-HEIGHT)
No documentation provided. -
EXTERNAL SOURCE-TRANSFORM IMAGE-WIDTH
No documentation provided. -
EXTERNAL SOURCE-TRANSFORM (SETF IMAGE-WIDTH)
No documentation provided.
-