summaryrefslogtreecommitdiff
path: root/wasp/draw565.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-27 08:38:54 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-27 08:40:45 (GMT)
commit8a14faa66867c2dfdef66c48a0669c00a5e4440e (patch)
tree6da5354e8d1e72a9ab80f8b74e0f1bf65f8e6794 /wasp/draw565.py
parent2034340f3bc4fc97cb8d097d7e1a1d810028fb0f (diff)
draw565: Improve default argument values for line()
Currently there are default argument values for the start and end coordinates but the defaults don't really make any sense since there is no reason to prefer the value 0 over any other. Remove them. Similarly color currently defaults to 0xffff which isn't right. It should default to the foreground colour. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/draw565.py')
-rw-r--r--wasp/draw565.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/wasp/draw565.py b/wasp/draw565.py
index 77bd286..869a6d6 100644
--- a/wasp/draw565.py
+++ b/wasp/draw565.py
@@ -356,8 +356,8 @@ class Draw565(object):
return chunks
- def line(self, x0=0, y0=0, x1=0, y1=0, color=0xffff):
- """Draw a line between points (x0;y0) and (x1;y1) with color.
+ def line(self, x0, y0, x1, y1, color=None):
+ """Draw a line between points (x0, y0) and (x1, y1).
Example:
@@ -366,13 +366,14 @@ class Draw565(object):
draw = wasp.watch.drawable
draw.line(0, 120, 240, 240, 0xf800)
- :param x0: X coordinate of the start of the line, defaults to 0
- :param x1: Y coordinate of the end of the line, defaults to 0
- :param y0: Y coordinate of the start of the line, defaults to 0
- :param y1: Y coordinate of the end of the line, defaults to 0
- :param color: Color to draw line in, in RGB565 format, defaults to 0xffff
+ :param x0: X coordinate of the start of the line
+ :param y0: Y coordinate of the start of the line
+ :param x1: X coordinate of the end of the line
+ :param y1: Y coordinate of the end of the line
+ :param color: Colour to draw line, defaults to the foreground colour
"""
-
+ if color is None:
+ color = self._bgfg & 0xffff
px = bytes(((color >> 8) & 0xFF, color & 0xFF))
write_data = self._display.write_data
set_window = self._display.set_window