(above d1, d2, ...) -> drawing?
d1, d2, ...: drawing?
Creates a new drawing formed by places the drawing d1, d2, …, above each other (vertically in descending order).
(above d1, d2, ...) -> drawing?
d1, d2, ...: drawing?
Creates a new drawing formed by places the drawing d1, d2, …, above each other (vertically in descending order).
(above/align align d1, d2, ...) -> drawing?
align: string?, either "left", "middle", or "right"
d1, d2, ...: drawing?
Creates a new drawing formed by places the drawing d1, d2, …, above each other on the y-axis, aligning them along the x-axis according to align.
(all-color-names ) -> list?
Returns a list of all valid color names.
(beside d1, d2, ...) -> drawing?
d1, d2, ...: drawing?
Creates a new drawing formed by places the drawing d1, d2, …, beside each other (horizontally).
(beside/align align d1, d2, ...) -> drawing?
align: string?, either "top", "center", or "bottom"
d1, d2, ...: drawing?
Creates a new drawing formed by places the drawing d1, d2, …, beside each other on the x-axis, aligning them along the y-axis according to align.
(circle radius fill color) -> drawing?
radius: number?
fill: string?, either "solid" or "outline"
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a circle of radius radius.
(color r b g a) -> string?
r: integer?, 0 <= r <= 255
b: integer?, 0 <= b <= 255
g: integer?, 0 <= g <= 255
a: integer?, 0 <= a <= 1
Returns a string of the form "rgba(r, g, b, a)" appropriate for use as a color.
(color-name->hsv color-name) -> hsv?
color-name: string
Returns the hsv value of the color name.
(color-name->rgb color-name) -> rgb?
color-name: string
Returns the rgb value of the color name.
(color? v) -> boolean?
v: any
Returns #t if and only if v is a valid color: a string containing a named color, an rgb value, or an hsv value.
(square width fill color) -> drawing?
width: number?
fill: string?, either "solid" or "outline"
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a square with length width.
(ellipse width height fill color) -> drawing?
width: integer?
height: integer?
fill: boolean?
color: string?
Returns a new drawing containing an ellipse with dimensions width × height.
(find-colors color-name) -> list?
color-name: string
Returns a list of all color names that contain color, case-insensitive.
(font face system-face bold? italic?) -> font?
face: string? A valid font name
system-face: string? A generic font family name (optional, default "sans-serif")
bold?: boolean? (optional, default #f)
italic?: boolean? (optional, default #f)
Returns a new font value with the given arguments. The system-face name is drawn from one of the possible system font families, a list can be found on MDN (font-family)
(hsv h s v a) -> hsv?
h: number?, 0 <= h <= 360
s: number?, 0 <= s <= 100
v: number?, 0 <= v <= 100
a: number?, 0 <= a <= 255
Returns a hsv value with the specified components.
(hsv-alpha hsv) -> number?
hsv: hsv?
Returns the alpha component of the hsv value.
(hsv-complement hsv) -> hsv?
hsv: hsv?
Returns the complement of the hsv value.
(hsv-hue hsv) -> number?
hsv: hsv?
Returns the hue component of the hsv value.
(hsv-saturation hsv) -> number?
hsv: hsv?
Returns the saturation component of the hsv value.
(hsv->rgb hsv) -> rgb?
hsv: hsv?
Converts the hsv value to an rgb value.
(hsv->string hsv) -> string?
hsv: hsv?
Returns a string representation of the hsv value.
(hsv-value hsv) -> number?
hsv: hsv?
Returns the value component of the hsv value.
(image-color img) -> string?
img: drawing?
Returns the color of the image.
(image-get-pixel img x y) -> rgb?
img: image?
x: integer?
y: integer?
Returns the rgb value of the pixel at position (x, y) in the image.
(image-height img) -> number?
img: drawing?
Returns the height of the image.
(image? v) -> boolean?
v: any
Returns #t if and only v is an image.
(image-recolor img color) -> drawing?
img: drawing?
color: color?
Returns a new image with the same dimensions as img but with the color color.
(image-width img) -> number?
img: drawing?
Returns the width of the image.
(color-name? v) -> boolean?
v: string
Returns #t if and only if v is a valid color name.
(hsv? v) -> boolean?
v: any
Returns #t if and only if v is a hsv value.
(rgb? v) -> boolean?
v: any
Returns #t if and only if v is a rgb value.
(rgb-component? v) -> boolean?
v: any
Returns #t if and only if v is an integer between 0 and 255.
(isosceles-triangle width height fill color) -> drawing?
width: number?
height: number?
fill: string?, either "solid" or "outline"
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a isosceles triangle with base base and height height.
(outlined-rectangle width height color) -> drawing?
width: number?
height: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of an outlined rectangle with dimensions width × height.
(outlined-square width color) -> drawing?
width: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of an outline square with length width.
(outlined-circle radius color) -> drawing?
radius: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of an outlined circle of radius radius.
(outlined-ellipse width height color) -> drawing?
width: integer?
height: integer?
color: string?
Returns a new drawing containing an outlined ellipse with dimensions width × height.
(outlined-isosceles-triangle width height color) -> drawing?
width: number?
height: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of an outlined isosceles triangle with base base and height height.
(outlined-triangle length color) -> drawing?
length: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of an outlined equilateral triangle with length length.
(overlay d1, d2, ...) -> drawing?
d1, d2, ...: drawing?
Creates a new drawing formed by places the drawing d1, d2, …, on top of each other. (d1 is the topmost drawing).
(overlay/align xAlign yAlign d1, d2, ...) -> drawing?
xAlign: string?, either "left", "middle", or "right"
yAlign: string?, either "top", "center", or "bottom"
d1, d2, ...: drawing?
Creates a new drawing formed by places the drawing d1, d2, …, on top of each other, aligning them according to xAlign and yAlign.
(overlay/offset dx dy d1 d2) -> drawing?
dx: number?
dy: number?
d1: drawing?
d2: drawing?
Creates a new drawing formed by places the drawing d1 on top of d2, offset by (dx, dy).
(path width height points fill color) -> drawing?
width: number?
height: number?
points: list?, a list of points, pairs of numbers
fill: string?, either "solid" or "outline"
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing with dimensions width × height formed by connecting the points in points with straight lines. The points are specified as a pair of coordinates.
(pixel-map fn img) -> image?
fn: function?
img: image?
Returns a new img that is the result of applying fn to each pixel (represented as a rgb value) of the original img.
(rgb-alpha rgb) -> rgbComponent?
rgb: rgb?
Returns the alpha component of the rgb value.
(rgb-blue rgb) -> rgbComponent?
rgb: rgb?
Returns the blue component of the rgb value.
(rgb-green rgb) -> rgbComponent?
rgb: rgb?
Returns the green component of the rgb value.
(rgb-red rgb) -> rgbComponent?
rgb: rgb?
Returns the red component of the rgb value.
(rgb->string rgb) -> string?
rgb: rgb?
Returns a string representation of the rgb value, e.g., approrpiate for use as a shape color.
(rectangle width height fill color) -> drawing?
width: number?
height: number?
fill: string?, either "solid" or "outline"
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a rectangle with dimensions width × height.
(rgb r g b a) -> rgb?
r: rgb-component?
g: rgb-component?
b: rgb-component?
a: rgb-component?, optional
Returns an rgb value with the specified components.
(rgb-add rgb1 rgb2) -> rgb?
rgb1: rgb?
rgb2: rgb?
Returns the sum of the two rgb values.
(rgb-average rgb1 rgb2) -> rgb?
rgb1: rgb?
rgb2: rgb?
Returns the average of the two rgb values.
(rgb-bluer rgb) -> rgb?
rgb: rgb?
Returns a bluer version of the rgb value.
(rgb-darker rgb) -> rgb?
rgb: rgb?
Returns a darker version of the rgb value.
(rgb-distance rgb1 rgb2) -> number?
rgb1: rgb?
rgb2: rgb?
Returns the Euclidean distance between the two rgb values.
(rgb-greener rgb) -> rgb?
rgb: rgb?
Returns a greener version of the rgb value.
(rgb-greyscale rgb) -> rgb?
rgb: rgb?
Returns a greyscale version of the rgb value.
(rgb-hue rgb) -> number?
rgb: rgb?
Returns the hue component of the rgb value.
(rgb-lighter rgb) -> rgb?
rgb: rgb?
Returns a lighter version of the rgb value.
(rgb-phaseshift rgb) -> rgb?
rgb: rgb?
Returns a phaseshifted version of the rgb value.
(rgb-pseudo-complement rgb) -> rgb?
rgb: rgb?
Returns a pseudo-complement of the rgb value.
(rgb-redder rgb) -> rgb?
rgb: rgb?
Returns a redder version of the rgb value.
(rgb-rotate-components rgb) -> rgb?
rgb: rgb?
Returns a rotated version of the rgb value.
(rgb-saturation rgb) -> number?
rgb: rgb?
Returns the saturation component of the rgb value.
(rgb-subtract rgb1 rgb2) -> rgb?
rgb1: rgb?
rgb2: rgb?
Returns the difference of the two rgb values.
(rgb-thicken rgb) -> rgb?
rgb: rgb?
Returns a thicker version of the rgb value.
(rgb-thin rgb) -> rgb?
rgb: rgb?
Returns a thinner version of the rgb value.
(rgb->hsv rgb) -> hsv?
rgb: rgb?
Converts the rgb value to an hsv value.
(rgb-value rgb) -> number?
rgb: rgb?
Returns the value component of the rgb value.
(rotate angle d) -> drawing?
angle: number?, in degrees
d: drawing?
Returns a new drawing formed by rotating drawing d by angle degrees around the center of its bounding box. Note: currently buggy and shifts off-center.
(shape? v) -> boolean?
v: any
Returns #t if and only v is a shape.
(solid-circle radius color) -> drawing?
radius: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a solid circle of radius radius.
(solid-ellipse width height color) -> drawing?
width: integer?
height: integer?
color: string?
Returns a new drawing containing a solid ellipse with dimensions width × height.
(solid-isosceles-triangle width height color) -> drawing?
width: number?
height: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a solid isosceles triangle with base base and height height.
(solid-rectangle width height color) -> drawing?
width: number?
height: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a solid rectangle with dimensions width × height.
(solid-square width color) -> drawing?
width: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a solid square with length width.
(solid-triangle length color) -> drawing?
length: number?
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a solid equilateral triangle with length length.
(text str size color font) -> drawing?
str: string?
size: number? A valid font size (in px)
color: color?
font: font? (optional, default (font "Arial"))
Returns a new drawing formed by drawing str with the given arguments.
(triangle length fill color) -> drawing?
length: number?
fill: string?, either "solid" or "outline"
color: string?, either a color name or the form "rgba(r, g, b, a)"
Returns a drawing consisting of a equilateral triangle with length length.
(with-dash dash-spec d) -> drawing?
dash-spec: list?, a list of numbers
d: drawing?
Returns a new drawing formed by drawing d but with lines drawn according to dash-spec. dash-spec is an list of numbers where each successive pair of numbers describe the length of a dash and the length of the subsequent gap.
(with-image-file callback) -> html?
callback: function?
Returns a container with a file chooser that, when used, calls callback with the selected image and replaces the container's contentsr with the output produced by callback.
(with-image-from-url url callback) -> html?
url: string?
callback: function?
Returns a container that, when used, calls callback with the selected image and replaces the chooser with the output produced by callback.