-
Notifications
You must be signed in to change notification settings - Fork 1.3k
OnDiskBitmap: INCOMPATIBLE CHANGE: Allow them to use palettes #4823
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
Conversation
Before, when an OnDiskBitmap was a paletted bitmap type, the palette was internal to the OnDiskBitmap, and it internally performed the palette conversion itself. When using with a tilegrid, a ColorConverter() object always had to be passed. Now, an OnDiskBitmap has a "pixel_shader" property. If the bitmap is a paletted bitmap type, it is a (modifiable) Palette object. Otherwise, it is a ColorConverter() object as before. This allows palette effects to be applied to paletted OnDiskBitmaps. Code that used to say: ```python face = displayio.TileGrid(odb, pixel_shader=displayio.ColorConverter()) ``` must be updated to say: ```python face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader) ``` Compatible code for 6.x and 7.x can say ```python face = displayio.TileGrid(odb, pixel_shader=getattr(odb, 'pixel_shader', ColorConverter()) ```
@tannewt requesting your review since this is an incompatible change. |
.. this branch was old and stale, it turns out
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.
Looked it all over and looks good to me. I won't approve until someone else can view the incompatibility part.
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 looks good to me! I believe it'll only break indexed on disk bitmaps. non-indexed bitmaps will use ColorConverter regardless.
Thank you! |
It's now tracked in #4982 and I've asked @jepler to do the reviews for @lesamouraipourpre on that issue. |
Before, when an OnDiskBitmap was a paletted bitmap type, the palette was internal to the OnDiskBitmap, and it internally performed the palette conversion itself. When using with a tilegrid, a ColorConverter() object always had to be passed.
Now, an OnDiskBitmap has a "pixel_shader" property. If the bitmap is a paletted bitmap type, it is a (modifiable) Palette object. Otherwise, it is a ColorConverter() object as before. This allows palette effects to be applied to paletted OnDiskBitmaps.
Code that used to say:
must be updated to say:
Compatible code for 6.x and 7.x can say
Closes: #4636. An alternative to #4438 which adds less code and is more general.