API Docs for: 1.4.4
Show:

ukeGeeks.canvasTools Class

Wraps three common canvas actions: adding canvas element to DOM, drawing a dot, adding text.

Item Index

Properties

Methods

addCanvas

(
  • element
  • width
  • height
)
CanvasContextHandle

Create new canvas DOM element and add it to element. Return convas context handle. Reutns null if there's a problem.

Parameters:

  • element DOMEelement

    Destination DOM element

  • width Int

    Desired width of new canvas element

  • height Int

    Desired height of new canvas element

Returns:

CanvasContextHandle:

drawDot

(
  • ctx
  • centerPos
  • radius
  • color
)
Void

Parameters:

  • ctx CanvasContext

    Valid Canvas Context handle

  • centerPos XyPositionJson

    JSON with two properties: x & y ints, position in pixels, format {x: , y: }

  • radius Int

    Dot's Radius

  • color String

    Hex color

Returns:

Void:

drawText

(
  • ctx
  • pos
  • text
  • font
  • color
  • align
)
Void

Parameters:

  • ctx CanvasContext

    Valid Canvas Context handle

  • pos XYPosObject

    JSON with two properties: x & y ints, position in pixels, format {x: , y: }

  • text String

    Any string to be places at Pos

  • font String

    Font, CSS-like definition of size and font-family, i.e.

  • color String

    Hexadecimal RGB color definition

  • align String

    (optional) Text will be aligned at position (pos) as [left,right,center]. Default is center.

Returns:

Void:

Properties

_public

JsonObject

attach public members to this object