Pass fillRect through to canvas.js.

This commit is contained in:
Alexander Gorshenev
2017-10-06 13:47:14 +03:00
committed by alexander-gorshenev
parent dc8840e14c
commit 21e376cc46
2 changed files with 8 additions and 0 deletions
@@ -30,6 +30,9 @@ konan.libraries.push ({ // This one will be auto generated.
knjs_fillRect: function(arena, obj, x1, y1, width, height) {
kotlinObject(arena, obj).fillRect(x1, y1, width, height);
},
knjs_fillText: function(arena, obj, textPtr, textLength, x, y, maxWidth) {
kotlinObject(arena, obj).fillText(toUTF16String(textPtr, textLength), x, y, maxWidth);
},
knjs_fill: function(arena, obj) {
kotlinObject(arena, obj).fill();
},
@@ -30,6 +30,8 @@ external public fun knjs_lineTo(arena: Int, obj: Int, x: Int, y: Int): Int;
@SymbolName("knjs_fillRect")
external public fun knjs_fillRect(arena: Int, obj: Int, x1: Int, y1: Int, width: Int, height: Int)
@SymbolName("knjs_fillText")
external public fun knjs_fillText(arena: Int, obj: Int, textPtr: Int, textWidth: Int, x: Int, y: Int, maxWidth: Int)
@SymbolName("knjs_fill")
external public fun knjs_fill(arena: Int, obj: Int)
@@ -97,6 +99,9 @@ open class Context(arena: Int, index: Int): JsValue(arena, index) {
fun fillRect(x: Int, y: Int, width: Int, height: Int) {
knjs_fillRect(this.arena, this.index, x, y, width, height)
}
fun fillText(text: String, x: Int, y: Int, maxWidth: Int) {
knjs_fillText(this.arena, this.index, stringPointer(text), stringLengthBytes(text), x, y, maxWidth)
}
fun fill() {
knjs_fill(this.arena, this.index)
}