canvas.nim 480 B

1234567891011121314151617181920
  1. import dom
  2. type
  3. CanvasRenderingContext* = ref object
  4. fillStyle* {.importc.}: cstring
  5. strokeStyle* {.importc.}: cstring
  6. {.push importcpp.}
  7. proc getContext*(canvasElement: Element,
  8. contextType: cstring): CanvasRenderingContext
  9. proc fillRect*(context: CanvasRenderingContext, x, y, width, height: int)
  10. proc moveTo*(context: CanvasRenderingContext, x, y: int)
  11. proc lineTo*(context: CanvasRenderingContext, x, y: int)
  12. proc stroke*(context: CanvasRenderingContext)