-
Notifications
You must be signed in to change notification settings - Fork 0
/
canvas.zig
48 lines (37 loc) · 1.48 KB
/
canvas.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const std = @import("std");
const allocator = std.heap.page_allocator;
pub extern "ctx" fn save() void;
pub extern "ctx" fn restore() void;
pub extern "ctx" fn translate(x: f64, y: f64) void;
pub extern "ctx" fn scale(x: f64, y: f64) void;
pub extern "ctx" fn rotate(angle: f64) void;
pub extern "ctx" fn beginPath() void;
pub extern "ctx" fn moveTo(x: f64, y: f64) void;
pub extern "ctx" fn lineTo(x: f64, y: f64) void;
extern "ctx" fn _font(pointer: [*]const u8, length: u32) void;
pub fn font(style: []const u8) void {
_font(style.ptr, style.len);
}
extern "ctx" fn _fillStyle(pointer: [*]const u8, length: u32) void;
pub fn fillStyle(style: []const u8) void {
_fillStyle(style.ptr, style.len);
}
extern "ctx" fn _fillText(pointer: [*]const u8, length: u32, x: f64, y: f64) void;
pub fn fillText(style: []const u8, x: f64, y: f64) void {
_fillText(style.ptr, style.len, x, y);
}
pub extern "ctx" fn fill() void;
pub extern "ctx" fn lineWidth(width: f64) void;
extern "ctx" fn _lineCap(pointer: [*]const u8, length: u32) void;
pub fn lineCap(style: []const u8) void {
_lineCap(style.ptr, style.len);
}
extern "ctx" fn _strokeStyle(pointer: [*]const u8, length: u32) void;
pub fn strokeStyle(style: []const u8) void {
_strokeStyle(style.ptr, style.len);
}
extern "ctx" fn _strokeText(pointer: [*]const u8, length: u32, x: f64, y: f64) void;
pub fn strokeText(style: []const u8, x: f64, y: f64) void {
_strokeText(style.ptr, style.len, x, y);
}
pub extern "ctx" fn stroke() void;