Created
June 7, 2016 13:36
-
-
Save dom96/18413eb7e06b58727cc4d457c6b76fc9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dom | |
type | |
CanvasRenderingContext* = ref object | |
fillStyle* {.importc.}: cstring | |
strokeStyle* {.importc.}: cstring | |
width* {.importc.}: int | |
height* {.importc.}: int | |
shadowColor* {.importc.}: cstring | |
shadowBlur* {.importc.}: int | |
lineWidth* {.importc.}: int | |
font* {.importc.}: cstring | |
ContextAttributes* = ref object | |
alpha* {.importc.}: bool | |
# TODO: WebGL | |
{.push importcpp.} | |
proc getContext*(canvasElement: Element, contextType: cstring, | |
contextAttributes = ContextAttributes(alpha: true)): CanvasRenderingContext | |
proc fillRect*(context: CanvasRenderingContext, | |
x, y, width, height: int) | |
proc beginPath*(context: CanvasRenderingContext) | |
proc moveTo*(context: CanvasRenderingContext, x, y: int) | |
proc lineTo*(context: CanvasRenderingContext, x, y: int) | |
proc stroke*(context: CanvasRenderingContext) | |
proc fillText*(context: CanvasRenderingContext, text: cstring, x, y: int) | |
proc translate*(context: CanvasRenderingContext, x, y: int) | |
proc setTransform*(context: CanvasRenderingContext, a, b, c, d, e, f: int) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment