Skip to content

Document that Bitmap can store any value that fits its bits per value - #11703

Merged
dhalbert merged 1 commit into
adafruit:mainfrom
mikeysklar:fix-5195
Nov 1, 2026
Merged

dhalbert merged 1 commit into
adafruit:mainfrom
mikeysklar:fix-5195

Conversation

@mikeysklar

Copy link
Copy Markdown
Collaborator

What

Docs only: value_count sets the storage size, and any value that fits can be stored.

Why

Fixes #5195, which names docs as an option.

A strict check would break adafruit_imageload GIF and PBM loading.

Testing

check, desktop lab now with strict check
Bitmap(2,2,3), write 3 ok ValueError
4 colour GIF load ok ValueError
PBM load ok ValueError
value 3 on Palette(3) transparent not run; fill_region, blit still store 3
CLUE, stock same as above, past-palette pixels transparent not tested

Limits: strict column is the 64-bit desktop lab only. Docs build not run locally. TilePaletteMapper does not bounds check, separate bug.

AI assistance

Written with Claude Code, which ran the lab and CLUE tests.

🤖 Generated with Claude Code

value_count sets the storage size, so any value that fits can be stored.

Fixes adafruit#5195.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@dhalbert dhalbert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

@dhalbert
dhalbert merged commit 589a2a9 into adafruit:main Nov 1, 2026
630 checks passed
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.

Bitmap allows pixels to be set to color indexes that exceed value_count

2 participants