-
Notifications
You must be signed in to change notification settings - Fork 1.3k
adding skip_self_index argument to bitmap.blit() #8136
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
The more recent commits in this branch have refactored I made that move because adding this new functionality inside of the Bitmap class in displayio caused a few of the SAMD21 builds in some languages to go over the size limit. The devices that had problems already seem to have bitmaptools disabled, so adding code into there has no effect on their size, which allows the actions checks to pass. I'm not 100% certain if that is the best resolution to the issue though. I am open to other ideas / options here are a few that I thought of but didn't elect to do initially:
Also note, as it is now, this is a breaking change, anything using
|
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.
Moving it makes total sense to me. Good to do the API breakage in 9.0. I think this is ok to do without a backwards compatibility because it is an advanced API.
One suggestion for the new API.
Thank you. The latest commit renames I also have an updated version of bitmap_label that checks for and uses this newer API, I'll submit the PR with that over in it's repo. |
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.
Thank you!
This change adds
skip_self_index
argument tobitmap.blit()
this argument functions similarly to the existingskip_index
argument, but instead of checking in the source bitmap it checked inside the self (destination) bitmap and if the index at the current location is this value then it will get skipped instead of overwritten from the source.This allows
bitmap.blit()
to be used to provide a pretty significant speed up in this example script which is using a process called "morphological dilation" (if I understand it correctly) to add an outlined around some text. Although the underlying code could operate on any shape inside a bitmap, it doesn't have to be text, but text was my primary intended use.The above script was tested on a PyPortal and produces this output on the display:
