Draw a line and an arrow at the end (zB) of the given line width the specified (CSS-) color and size.
The start point of the arrow-line.
The end point of the arrow-line.
Any valid CSS color string.
Optional
lineWidth: number(optional) The line width to use; default is 1.
Optional
headLength: number(optional) The length of the arrow head (default is 8 units).
Optional
strokeOptopns: StrokeOptionsarrow
DrawLib
Draw just an arrow head a the end of an imaginary line (zB) of the given line width the specified (CSS-) color and size.
The start point of the arrow-line.
The end point of the arrow-line.
Any valid CSS color string.
Optional
lineWidth: number(optional) The line width to use; default is 1.
Optional
headLength: number(optional) The length of the arrow head (default is 8 pixels).
Optional
strokeOptopns: StrokeOptionsarrow
DrawLib
Called before each draw cycle.
This is required for compatibility with other draw classes in the library (like drawgl).
beginDrawCycle
Draw a circle with the specified (CSS-) color and radius.
Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.
The center of the circle.
The radius of the circle.
The CSS color to draw the circle with.
Optional
lineWidth: number(optional) The line width to use; default is 1.
Optional
strokeOptions: StrokeOptions(optional) Stroke settings to use.
circle
DrawLib
Draw a circular arc (section of a circle) with the given CSS color.
The center of the circle.
The radius of the circle.
The angle to start at.
The angle to end at.
The CSS color to draw the circle with.
Optional
lineWidth: number(optional) The line width to use; default is 1.
Optional
strokeOptions: StrokeOptions(optional) Stroke settings to use.
circleArc
DrawLib
Draw a circle handle with the given CSS color.
It is an inherent featur of the handle functions that the drawn elements are not scaled and not
distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
as even shaped circles.
circleHandle
DrawLib
Due to gl compatibility there is a generic 'clear' function required to avoid accessing the context object itself directly.
This function just fills the whole canvas with a single color.
Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.
Note that the x's radius will not be affected by scaling.
crosshair
DrawLib
Draw a crosshair with given radius and color at the given position.
Note that the crosshair radius will not be affected by scaling.
crosshair
DrawLib
Draw the given (cubic) bézier curve.
The start point of the cubic Bézier curve
The end point the cubic Bézier curve.
The start control point the cubic Bézier curve.
The end control point the cubic Bézier curve.
The CSS color to draw the curve with.
Optional
lineWidth: number(optional) The line width to use.
Optional
strokeOptopns: StrokeOptionscubicBezier
DrawLib
Draw a cubic Bézier curve and and an arrow at the end (endControlPoint) of the given line width the specified (CSS-) color and arrow size.
The start point of the cubic Bézier curve
The end point the cubic Bézier curve.
The start control point the cubic Bézier curve.
The end control point the cubic Bézier curve.
The CSS color to draw the curve with.
Optional
lineWidth: number(optional) The line width to use.
Optional
headLength: number(optional) The length of the arrow head (default is 8 units).
Optional
strokeOptopns: StrokeOptionscubicBezierArrow
DrawLib
Draw the given (cubic) Bézier path.
The given path must be an array with n*3+1 vertices, where n is the number of curves in the path:
[ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]
The cubic bezier path as described above.
The CSS colot to draw the path with.
Optional
lineWidth: number(optional) The line width to use.
Optional
strokeOptopns: StrokeOptionscubicBezierPath
DrawLib
Draw a diamond handle (square rotated by 45°) with the given CSS color.
It is an inherent featur of the handle functions that the drawn elements are not scaled and not distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn as even shaped diamonds.
diamondHandle
DrawLib
Draw a 1x1 dot with the specified (CSS-) color.
dot
DrawLib
Draw an ellipse with the specified (CSS-) color and thw two radii.
The center of the ellipse.
The radius of the ellipse.
The radius of the ellipse.
The CSS color to draw the ellipse with.
Optional
lineWidth: number(optional) The line width to use; default is 1.
Optional
rotation: number(optional, default=0) The rotation of the ellipse.
Optional
strokeOptions: StrokeOptions(optional) Stroke settings to use.
ellipse
DrawLib
Called after each draw cycle.
This is required for compatibility with other draw classes in the library (like drawgl).
endDrawCycle
Draw a grid of horizontal and vertical lines with the given (CSS-) color.
The center of the grid.
The total width of the grid (width/2 each to the left and to the right).
The total height of the grid (height/2 each to the top and to the bottom).
The horizontal grid size.
The vertical grid size.
The CSS color to draw the grid with.
grid
DrawLib
Draw the given handle and handle point (used to draw interactive Bézier curves).
The colors for this are fixed and cannot be specified.
handle
DrawLib
Draw a handle line (with a light grey).
handleLine
DrawLib
Draw an image at the given position with the given size.
Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
image
DrawLib
Draw a non-scaling text label at the given absolute position.
label
DrawLib
Draw the line between the given two points with the specified (CSS-) color.
The start point of the line.
The end point of the line.
Any valid CSS color string.
Optional
lineWidth: numberOptional
strokeOptopns: StrokeOptionsline
DrawLib
Draw an SVG-like path given by the specified path data.
An array of path commands and params.
Optional
color: string(optional) The color to draw this path with (default is null).
Optional
lineWidth: number(optional) the line width to use (default is 1).
Optional
options: { path
DrawLib
An instance representing the drawn path.
Draw the given point with the specified (CSS-) color and radius 3.
point
DrawLib
Draw a polygon.
The polygon to draw.
The CSS color to draw the polygon with.
Optional
lineWidth: numberThe line width to draw this polygon with.
Optional
strokeOptions: StrokeOptions(optional) Stroke settings to use.
polygon
DrawLib
Draw a polygon line (alternative function to the polygon).
The polygon vertices to draw.
If true the polyline will not be closed at its end.
The CSS color to draw the polygon with.
Optional
lineWidth: number(optional) The line width to use; default is 1.
Optional
strokeOptions: StrokeOptions(optional) Stroke settings to use.
polyline
DrawLib
Draw a raster of crosshairs in the given grid.
This works analogue to the grid() function
The center of the raster.
The total width of the raster (width/2 each to the left and to the right).
The total height of the raster (height/2 each to the top and to the bottom).
The horizontal raster size.
The vertical raster size.
The CSS color to draw the raster with.
raster
DrawLib
Draw a rectangle at the given left upper corner, with, height; and with the specified line width and (CSS-) color.
The width of the rectangle.
The height of the rectangle.
The CSS color to draw the rectangle with.
Optional
lineWidth: number(optional) The line width to use; default is 1.
Optional
strokeOptions: StrokeOptions(optional) Stroke settings to use.
rect
DrawLib
Set the current drawlib configuration.
The new configuration settings to use for the next render methods.
setConfiguration
This method shouled be called each time the currently drawn Drawable
changes.
Determine the class name for further usage here.
A class name for further custom use cases.
setCurrentClassName
This method shouled be called each time the currently drawn Drawable
changes.
It is used by some libraries for identifying elemente on re-renders.
A UID identifying the currently drawn element(s), or null to clear.
setCurrentId
Draw square at the given center, size and with the specified (CSS-) color.
Note that if the x-scale and the y-scale are different the result will be a rectangle rather than a square.
The center of the square.
The size of the square.
The CSS color to draw the square with.
Optional
lineWidth: number(optional) The line width to use; default is 1.
Optional
strokeOptions: StrokeOptions(optional) Stroke settings to use.
square
DrawLib
Draw a square handle with the given CSS color.
It is an inherent featur of the handle functions that the drawn elements are not scaled and not
distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
as even shaped squares.
squareHandle
DrawLib
Draw a text at the given relative position.
The text to draw.
The x-position to draw the text at.
The y-position to draw the text at.
Optional
options: FontOptionstext
DrawLib
Draw an image at the given position with the given size.
Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
The image object to draw.
The texture size to use; these are the original bounds to map the polygon vertices to.
The polygon to use as clip path.
The polygon's position (relative), measured at the bounding box's center.
The rotation to use for the polygon (and for the texture).
texturedPoly
DrawLib
An interface all drawing libraries must implement to be used with PlotBoilerplate.
The generic type
R
specifies the return-types for all draw functions. Libraries might want to specify their own draw result; for PlotBoilerplatevoid
orany
is fine.Default implementation is
draw
.