Next: , Previous: , Up: Graphics   [Contents][Index]


2.3.4 Lines and Shapes

Sprites are fun, but sometimes simple, untextured lines and polygons are desired. That’s where the (chickadee render shapes) module comes in!

Procedure: draw-line start end [#:thickness 0.5] [#:feather 1.0] [#:cap round] [#:color] [#:shader]

Draw a line segment from start to end. The line will be thickness pixels thick with an antialiased border feather pixels wide. The line will be colored color. cap specifies the type of end cap that should be used to terminate the lines, either none, butt, square, round, triangle-in, or triangle-out. Advanced users may use the shader argument to override the built-in line segment shader.

Procedure: draw-bezier-curve bezier [#:segments 32] [#:control-points?] [#:tangents?] [#:control-point-size 8] [#:control-point-color yellow] [#:tangent-color yellow] [#:thickness 0.5] [#:feather 1.0] [#:matrix]

Draw the curve defined by bezier using a resolution of N segments. When control-points? is #t, the control points are rendered as squares of size control-point-size pixels and a color of control-point-color. When tangents? is #t, the tangent lines from terminal point to control point are rendered using the color tangent-color.

All line segments rendered use draw-line, and thus the arguments thickness and feather have the same effect as in that procedure.

A custom matrix may be passed for applications that require more control over the final output.

Procedure: draw-bezier-path path [#:segments 32] [#:control-points?] [#:tangents?] [#:control-point-size 8] [#:control-point-color yellow] [#:tangent-color yellow] [#:thickness 0.5] [#:feather 1.0] [#:matrix]

Render path, a list of bezier curves. See the documentation for draw-bezier-curve for an explanation of all the keyword arguments.