-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tilegrid transpose fix #4331
Tilegrid transpose fix #4331
Conversation
Yes, I will try this tonight, Both in the "simple" code example and in the New Veritcal label proposal. Thanks @dhalbert . I will report my tests in here. |
This was tested in using the new proposal Vertical Library PR122 adafruit/Adafruit_CircuitPython_Display_Text#122 in Resultsand in the MAGTAG ResultsTest codeimport board
import displayio
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import vertical_label
from adafruit_display_text import label
import time
import digitalio
display = board.DISPLAY
# wait until we can draw
time.sleep(display.time_to_refresh)
# main group to hold everything
group = displayio.Group()
# white background. Scaled to save RAM
bg_bitmap = displayio.Bitmap(display.width // 8, display.height // 8, 1)
bg_palette = displayio.Palette(1)
bg_palette[0] = 0xFFFFFF
bg_sprite = displayio.TileGrid(bg_bitmap, x=0, y=0, pixel_shader=bg_palette)
bg_group = displayio.Group(scale=8)
bg_group.append(bg_sprite)
group.append(bg_group)
text = "Reporting"
MEDIUM_FONT = bitmap_font.load_font("/fonts/Helvetica-Bold-16.bdf")
BIG_FONT = bitmap_font.load_font("/fonts/LeagueSpartan-Bold-16.bdf")
bitmap = displayio.Bitmap(320, 3, 2)
palette = displayio.Palette(2)
palette[0] = 0x004400
palette[1] = 0x00FFFF
tile_grid = displayio.TileGrid(bitmap, pixel_shader=palette, x=0, y=115)
bitmap2 = displayio.Bitmap(3, 260, 2)
tile_grid2 = displayio.TileGrid(bitmap2, pixel_shader=palette, x=120, y=10)
text_areah = label.Label(
BIG_FONT,
text=text,
color=0xFFFFFF,
background_color=0x666666,
x=0,
y=100,
)
group.append(text_areah)
text_area3 = vertical_label.Label(BIG_FONT,
text="Pythoñ",
color=0x00FF00,
background_color=0x990022,
background_tight=False,
padding_top=5,
padding_bottom=0,
padding_left=0,
padding_right=0,
x=120,
y=80,
base_alignment= True,
scale=1,)
group.append(text_area3)
text_area4 = vertical_label.Label(MEDIUM_FONT,
text="Circuit",
color=0x00FF00,
background_color=0x990099,
background_tight=False,
padding_top=4,
padding_bottom=15,
padding_left=10,
padding_right=3,
base_alignment= True,
x=100,
y=80
,)
group.append(text_area4)
text_area = vertical_label.Label(MEDIUM_FONT, text="V6.2.0",
color=0x00FF00, background_color=0x330099, padding_left=0,
padding_right=0, padding_bottom=0, padding_top=0, anchor_point=(0.0, 0.0),
anchored_position=(130,120),
scale=2,)
text_area2 = label.Label(MEDIUM_FONT,
text=text, color=0xAA5522,
background_color=0x22FF44,
padding_left=0,
padding_right=0,
padding_bottom=0,
padding_top=0,
x=20,
y=140)
group.append(text_area)
group.append(text_area2)
group.append(tile_grid)
group.append(tile_grid2)
# show the main group and refresh.
display.show(group)
display.refresh()
while True:
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, but I didn't test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR regresses TinyUSB from 52855 to 28029
Fixes #4284.
Setting
TileGrid.transpose_xy
forces the x,y, height, and width to be recalculated using_update_current_x()
and_update_current_y()
. Those routines did not handle the case ofabsolute_transform
beingNULL
, and used NULL as a pointer to a transform, so they got random values.This fix guards against that. It also makes
null_transform
, an identity transform defined for use invectorio
, be a global. I used it in the fix.An alternative fix would be to never use a
NULL
pointer asabsolute_transform
, and use&null_transform
to signify the identity transform. However,absolute_transform == NULL
is overloaded as a signal the object has no parent, and so some other indicator (like a new bool) would have to be added to indicate no parent. I chose not to make that change now.I tested this with a simple quotes example on a PyPortal Titano. @jposada202020 if you would like to test this in the context of your full program, that would be great. Thanks.