Graphics functions to use with a CanvasRenderingContext2D.
Methods
-
(static) drawNormalizedPolygon(G2D, points, sx, sy, width, height, colF, colS, lineWidthopt)
-
Draw a polygon (defined as an array of 2-element arrays describing points in 2D cartesian space where each coordinate is normalized ranging from 0.0 to 1.0) in arbitrary width, height and colors.
Parameters:
Name Type Attributes Default Description G2DCanvasRenderingContext2D the 2D canvas context to use for drawing
points_pointsarray_ e.g [ [0.0,0.0],[0.5,0.0],[1.0,1.0] ] (would define a triangle)
sxnumber the left pixel column at which to start drawing
synumber the upper pixel row at which to start drawing
widthnumber the width in pixels to draw
heightnumber the height in pixels to draw
colFstring | null html color code for the fill color (null to disable filling)
colSstring | null html color code for the stroke color (null to disable stroke drawing)
lineWidthnumber <optional>
1.0 the width of the stroke in pixels
-
(static) drawPalette(G2D, pal, sx, sy, cw, rh, cpr)
-
Draw the given palette as a table of colored rectangles.
Parameters:
Name Type Description G2DCanvasRenderingContext2D the 2D canvas context to use for drawing
palrlPalette the palette to draw
sxnumber the left pixel column at which to start drawing
synumber the upper pixel row at which to start drawing
cwnumber the column width for the table
rhnumber the row height for the table
cprnumber the colors to display per row
-
(static) drawRefugeeLibLogo(G2D, sx, sy, width, height, colA, colB)
-
Draw the Refugee Lib logo.
Parameters:
Name Type Description G2DCanvasRenderingContext2D the 2D canvas context to use for drawing
sxnumber the left pixel column at which to start drawing
synumber the upper pixel row at which to start drawing
widthnumber the width in pixels to draw
heightnumber the height in pixels to draw
colAstring html color code for the base shape color
colBstring html color code for the letters color