canvas.nim 513 B

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