Closed
Description
I noticed an off-by-one error for the sizing of Rectangle. I observed this when writing the example that included in PR #14, see Sparkline example "display_shapes_sparkline_ticks.py").
Current code in rect.py
(starting at line 69):
for w in range(width):
for line in range(stroke):
self._bitmap[w, line] = 1
self._bitmap[w, height - 1 - line] = 1
for _h in range(height):
for line in range(stroke):
self._bitmap[line, _h] = 1
self._bitmap[width - 1 - line, _h] = 1
Proposed code change for rect.py
:
for w in range(width):
for line in range(stroke):
self._bitmap[w, line] = 1
self._bitmap[w, height - line] = 1
for _h in range(height):
for line in range(stroke):
self._bitmap[line, _h] = 1
self._bitmap[width - line, _h] = 1
In the Sparkline example, I just hardcoded an extra +1 to the rectangles to make it line up. Once rect.py
is updated, that example will need to be corrected "display_shapes_sparkline_ticks.py".
Potential negative impact
If this is updated, any existing working code will be off-by-one in the other direction.