The canvas namespace provides functions which can be used for rendering graphs, game graphics, art, or othe visual images on the fly.
See http://www.w3.org/TR/html5/scripting-1.html#the-canvas-element and http://www.w3.org/TR/2dcontext/
The canvas namespace provides functions which can be used for rendering graphs, game graphics, art, or othe visual images on the fly. See http://www.w3.org/TR/html5/scripting-1.html#the-canvas-element and http://www.w3.org/TR/2dcontext/
(alpha ctx a)
Global Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).
Global Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).
(arc ctx {:keys [x y r start-angle end-angle counter-clockwise?]})
Draws an arc at position (x, y) with radius r, beginning at start-angle, finishing at end-angle, in the direction specified.
Draws an arc at position (x, y) with radius r, beginning at start-angle, finishing at end-angle, in the direction specified.
(begin-path ctx)
Starts a new path by resetting the list of sub-paths. Call this method when you want to create a new path.
Starts a new path by resetting the list of sub-paths. Call this method when you want to create a new path.
(bezier-curve-to ctx {:keys [cp1x cp1y cp2x cp2y x y]})
(bezier-curve-to ctx cp1x cp1y cp2x cp2y x y)
(circle ctx {:keys [x y r]})
Draws a circle at position (x, y) with radius r
Draws a circle at position (x, y) with radius r
(clear-rect ctx {:keys [x y w h]})
Sets all pixels in the rectangle defined by starting point (x, y) and size (w, h) to transparent black.
Sets all pixels in the rectangle defined by starting point (x, y) and size (w, h) to transparent black.
(clip ctx)
Further constrains the clipping region to the current path.
Further constrains the clipping region to the current path.
(close-path ctx)
Tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing.
Tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing.
(composition-operation ctx operation)
With Global Alpha applied this sets how shapes and images are drawn onto the existing bitmap. Possible values (as string or keyword): source-atop, source-in, source-out, source-over (default), destination-atop, destination-in, destination-out, destination-over, lighter, darker, copy, xor
With Global Alpha applied this sets how shapes and images are drawn onto the existing bitmap. Possible values (as string or keyword): source-atop, source-in, source-out, source-over (default), destination-atop, destination-in, destination-out, destination-over, lighter, darker, copy, xor
(draw-image ctx img {:keys [x y w h sx sy sw sh dx dy dw dh] :as params})
(draw-image ctx img x y)
Draws the image onto the canvas at the given position. If a map of params is given, the number of entries is used to determine the underlying call to make.
Draws the image onto the canvas at the given position. If a map of params is given, the number of entries is used to determine the underlying call to make.
(draw-loop {:keys [canvas updating? ctx active entities last-frame-time]
:as mc})
(ellipse ctx {:keys [x y rw rh]})
Draws an ellipse at position (x, y) with radius (rw, rh)
Draws an ellipse at position (x, y) with radius (rw, rh)
(fill ctx)
Fills the subpaths with the current fill style.
Fills the subpaths with the current fill style.
(fill-rect ctx {:keys [x y w h]})
Draws a filled rectangle at (x, y) position whose size is determined by width w and height h.
Draws a filled rectangle at (x, y) position whose size is determined by width w and height h.
(fill-style ctx color)
Color or style to use inside shapes. Default #000 (black).
Color or style to use inside shapes. Default #000 (black).
(font-style ctx font)
Sets the font. Default value 10px sans-serif.
Sets the font. Default value 10px sans-serif.
(get-pixel ctx x y)
Gets the pixel value as a hash map of RGBA values
Gets the pixel value as a hash map of RGBA values
(line-to ctx x y)
Connects the last point in the subpath to the x, y coordinates with a straight line.
Connects the last point in the subpath to the x, y coordinates with a straight line.
(move-to ctx x y)
Moves the starting point of a new subpath to the (x, y) coordinates.
Moves the starting point of a new subpath to the (x, y) coordinates.
(quadratic-curve-to ctx {:keys [cpx cpy x y]})
(quadratic-curve-to ctx cpx cpy x y)
(rect ctx {:keys [x y w h]})
Path for a rectangle at position (x, y) with a size (w, h).
Path for a rectangle at position (x, y) with a size (w, h).
(restore ctx)
Restores the drawing style state to the last element on the 'state stack' saved by save.
Restores the drawing style state to the last element on the 'state stack' saved by save.
(save ctx)
Saves the current drawing style state using a stack so you can revert any change you make to it using restore.
Saves the current drawing style state using a stack so you can revert any change you make to it using restore.
(scale ctx x y)
Scales the context by a floating-point factor in each direction
Scales the context by a floating-point factor in each direction
(stroke ctx)
Strokes the subpaths with the current stroke style.
Strokes the subpaths with the current stroke style.
(stroke-cap ctx cap)
Sets the line cap. Possible values (as string or keyword): butt (default), round, square
Sets the line cap. Possible values (as string or keyword): butt (default), round, square
(stroke-join ctx join)
Can be set, to change the line join style. Possible values (as string or keyword): bevel, round, and miter. Other values are ignored.
Can be set, to change the line join style. Possible values (as string or keyword): bevel, round, and miter. Other values are ignored.
(stroke-rect ctx {:keys [x y w h]})
Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.
Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.
(stroke-style ctx color)
Color or style to use for the lines around shapes. Default #000 (black).
Color or style to use for the lines around shapes. Default #000 (black).
(stroke-width ctx w)
Sets the line width. Default 1.0
Sets the line width. Default 1.0
(text ctx {:keys [text x y]})
Paints the given text at a starting point at (x, y), using the current fill style.
Paints the given text at a starting point at (x, y), using the current fill style.
(text-align ctx alignment)
Sets the text alignment attribute. Possible values (specified as a string or keyword): start (default), end, left, right or center.
Sets the text alignment attribute. Possible values (specified as a string or keyword): start (default), end, left, right or center.
(text-baseline ctx alignment)
Sets the text baseline attribute. Possible values (specified as a string or keyword): top, hanging, middle, alphabetic (default), ideographic, bottom
Sets the text baseline attribute. Possible values (specified as a string or keyword): top, hanging, middle, alphabetic (default), ideographic, bottom
(transform ctx {:keys [m11 m12 m21 m22 dx dy]})
(transform ctx m11 m12 m21 m22 dx dy)
Multiplies a custom transformation matrix to the existing HTML5 canvas transformation according to the follow convention:
[ x'] [ m11 m21 dx ] [ x ] [ y'] = [ m12 m22 dy ] [ y ] [ 1 ] [ 0 0 1 ] [ 1 ]
Multiplies a custom transformation matrix to the existing HTML5 canvas transformation according to the follow convention: [ x'] [ m11 m21 dx ] [ x ] [ y'] = [ m12 m22 dy ] [ y ] [ 1 ] [ 0 0 1 ] [ 1 ]
(translate ctx x y)
Moves the origin point of the context to (x, y).
Moves the origin point of the context to (x, y).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close