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 G2D
CanvasRenderingContext2D 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)
sx
number the left pixel column at which to start drawing
sy
number the upper pixel row at which to start drawing
width
number the width in pixels to draw
height
number the height in pixels to draw
colF
string | null html color code for the fill color (null to disable filling)
colS
string | null html color code for the stroke color (null to disable stroke drawing)
lineWidth
number <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 G2D
CanvasRenderingContext2D the 2D canvas context to use for drawing
pal
rlPalette the palette to draw
sx
number the left pixel column at which to start drawing
sy
number the upper pixel row at which to start drawing
cw
number the column width for the table
rh
number the row height for the table
cpr
number the colors to display per row
-
(static) drawRefugeeLibLogo(G2D, sx, sy, width, height, colA, colB)
-
Draw the Refugee Lib logo.
Parameters:
Name Type Description G2D
CanvasRenderingContext2D the 2D canvas context to use for drawing
sx
number the left pixel column at which to start drawing
sy
number the upper pixel row at which to start drawing
width
number the width in pixels to draw
height
number the height in pixels to draw
colA
string html color code for the base shape color
colB
string html color code for the letters color