Skip to content
Snippets Groups Projects
Commit bdeac8ff authored by q3k's avatar q3k
Browse files

sim: imlement ctx.stroke

parent f473abf2
Branches
No related tags found
No related merge requests found
......@@ -95,6 +95,7 @@ class Ctx:
CENTER = 'center'
END = 'end'
MIDDLE = 'middle'
BEVEL = 'bevel'
def __init__(self, _ctx):
self._ctx = _ctx
......@@ -102,6 +103,7 @@ class Ctx:
self.text_align = 'start'
self.text_baseline = 'alphabetic'
self.font_size = 10.0
self.line_join = 'bevel'
def _emit(self, text):
_wasm.ctx_parse(self._ctx, text)
......@@ -110,6 +112,10 @@ class Ctx:
self._emit(f"moveTo {int(x)} {int(y)}")
return self
def line_to(self, x, y):
self._emit(f"lineTo {int(x)} {int(y)}")
return self
def rgb(self, r, g, b):
# TODO(q3k): dispatch by type instead of value, warn on
# ambiguous/unexpected values for type.
......@@ -135,6 +141,11 @@ class Ctx:
self._emit(f"rectangle {x} {y} {width} {height}")
return self
def stroke(self):
self._emit(f"lineJoin {self.line_join}")
self._emit(f"stroke")
return self
def fill(self):
self._emit(f"fill")
return self
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment