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

Data in displayio.Bitmap is mirrored for depths < 8 #6675

Open
deshipu opened this issue Aug 1, 2022 · 2 comments
Open

Data in displayio.Bitmap is mirrored for depths < 8 #6675

deshipu opened this issue Aug 1, 2022 · 2 comments
Assignees
Milestone

Comments

@deshipu
Copy link

deshipu commented Aug 1, 2022

CircuitPython version

Adafruit CircuitPython 8.0.0-alpha.0-dirty on 2022-07-26; S2Mini with ESP32S2-S2FN4R2

Code/REPL

>>> b = displayio.Bitmap(8, 8, 65526)
>>> m = memoryview(b)
>>> b[0, 0] = 1
>>> m[0]
1
>>> b = displayio.Bitmap(8, 8, 256)
>>> m = memoryview(b)
>>> b[0, 0] = 1
>>> m[0]
1
>>> b = displayio.Bitmap(8, 8, 16)
>>> m = memoryview(b)
>>> b[0, 0] = 1
>>> m[0]
0
>>> m[1]
0
>>> m[2]
0
>>> m[3]
16

Behavior

When the depth is less than 8, the data inside the bitmap is saved right to left instead of left to right. This makes writing image loaders harder, as we have to consider every depth separately, instead of just dumping the image data into the bitmap.

Description

No response

Additional information

No response

@deshipu deshipu added the bug label Aug 1, 2022
@tannewt tannewt added this to the Long term milestone Aug 1, 2022
@tannewt
Copy link
Member

tannewt commented Aug 1, 2022

I don't think this is intentional. My brain hurt after writing all that code. I'd be happy to merge in a change for this. I agree it should be consistent.

@deshipu
Copy link
Author

deshipu commented Aug 1, 2022

Bits are painful, I will see if I can get it consistent without making the code bigger.

@deshipu deshipu self-assigned this Aug 1, 2022
deshipu added a commit to deshipu/Adafruit_CircuitPython_ImageLoad that referenced this issue Aug 3, 2024
Add a workaround for bug adafruit/circuitpython#6675
and use bitmap[x, y] instead of putting data into the bitmap directly
through the memoryview for bit depths < 8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants