Open bablokb opened 10 months ago
BTW: works correct when replacing vectorio.Rectangle
with adafruit_display_shapes.rect.Rect
. But this is not a valid option, since the latter uses much more memory.
Could you upload a picture
Below are five images with varying parameters. The first, third and fifth are the expected result. But for the third and fifth I have to tweak the values so the result is correct.
If you take a closer look at the second image, you can see that the border on left is missing and the border on the right is two pixels wide. In the fourth image, the bottom border is missing and the top border is two pixels wide.
adafruit_display_shapes.rect.Rect
: rotation=270, x=0,y=0 and x=1,y=1:
vectorio.Rectangle
: rotation=270, x=0,y=0 and x=1,y=1:vectorio.Rectangle
: rotation=270, x=1,y=0 and x=2,y=1:vectorio.Rectangle
: rotation=90, x=0,y=0 and x=1,y=1:vectorio.Rectangle
: rotation=90, x=0,y=1 and x=1,y=2:why do you have the rotation on the rects
If you want to use the display in landscape mode, you either need rotation=270 or rotation=90.
See the example code from Adafruit here: https://learn.adafruit.com/adafruit-2-13-eink-display-breakouts-and-featherwings/circuitpython-usage
I confirmed this issue exists on TFT screens as well with a Feather ESP32-S2 TFT.
Here is some reproducer code that can run on any device with a built-in display:
import board
import displayio
import vectorio
main_group = displayio.Group()
palette = displayio.Palette(2)
palette[0] = 0x00ff00
palette[1] = 0x000000
display = board.DISPLAY
display.rotation = 180
print(f"width: {display.width} height: {display.height}")
border_rectangle = vectorio.Rectangle(pixel_shader=palette,
width=display.width,
height=display.height,
x=0, y=0)
main_group.append(border_rectangle)
inside_rectangle = vectorio.Rectangle(pixel_shader=palette,
width=display.width - 2,
height=display.height - 2,
x=1, y=1,
color_index=1)
main_group.append(inside_rectangle)
display.root_group = main_group
while True:
pass
CircuitPython version
Code/REPL
Behavior
The code should create a one-pixel border around the screen. I am testing this with an Adafruit 2.13 monochrome e-ink.
The code only creates the border on the top, right and bottom (pin) side (i.e. missing on the left). Setting the rotation parameter to 90 instead of 270, the missing border is now on the pin-side (which is now the "top"-side after rotation). Not logical, my expectation here was that rotating by 180° would move the missing border to the other side.
I also tried with a PyPortal (with slightly changed colors), but also here the borders don't render as expected.
This seems to be some sort of "off-by-1" problem. In the rotation=270 case, I get the expected result by assuming that the x-axis starts at pixel 1 (i.e.
x=1,y=0
for the first rectangle andx=2,y=1
for the second rectangle). In the rotation=90 case, the y-axis has to start at pixel 1.Description
No response
Additional information
No response