Skip to content
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

update logic for displayio.TileGrid's transform_xy #4464

Merged
merged 1 commit into from
Mar 22, 2021

Conversation

kmatch98
Copy link
Collaborator

@kmatch98 kmatch98 commented Mar 22, 2021

This resolves an error in redrawing when using transform_xy with displayio.TileGrid, referenced in issue #4450.

The logic for displayio_tilegrid_get_refresh_areas did not consider the TileGrid's transform_xy value and the transform of dirty rectangles was not being performed.

Here is the result with version Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Adafruit PyPortal with samd51j20:
IMG_7566

Here is the result with the updated code in this PR:
IMG_7567

Here is my test code:

import displayio
import board
import time
import math
import gc
from bitmaptools import rotozoom, fill_region
import adafruit_imageload
from _pixelbuf import colorwheel

delay_time=1

display=board.DISPLAY

bmap1 = displayio.Bitmap(150,200, 4)
palette1=displayio.Palette(4)
#palette1.make_transparent(3)
palette1[0]=0xFF0000
palette1[1]=0x00FF00
palette1[2]=0x0000FF
palette1[3]=0x00FFFF

tilegrid1=displayio.TileGrid(bmap1, pixel_shader=palette1)

group1=displayio.Group(max_size=1)
group1.x=20
group1.y=20

#group1.append(tilegrid0)
group1.append(tilegrid1)
display.show(group1)
time.sleep(delay_time)

print('1 change fill color of bitmap to blue')
bmap1.fill(2)
time.sleep(delay_time)

tilegrid1.transpose_xy=True
#tilegrid1.flip_x=True
#tilegrid1.flip_y=True

print('2 write red and light blue into two corners')

for i in range(bmap1.width//2):
    for j in range(bmap1.height//2):
        #print("i,j: {},{}".format(i,j))
        #time.sleep(0.001)
        bmap1[i,j]=0
        bmap1[bmap1.width-i-1, bmap1.height-j-1]=3

print('3 just finished')

time.sleep(10000)

@kmatch98 kmatch98 changed the title update logic for transform_xy update logic for displayio.TileGrid's transform_xy Mar 22, 2021
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants