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

Idea: support 32-bit values in expand bitmap command #240

Open
stevesims opened this issue Jun 23, 2024 · 1 comment
Open

Idea: support 32-bit values in expand bitmap command #240

stevesims opened this issue Jun 23, 2024 · 1 comment

Comments

@stevesims
Copy link
Contributor

the current buffered commands API command to expand out a bitmap supports expanding to 8-bit values only - as it was essentially intended to create RGBA2222 format bitmaps

there may be utility in allowing an option to expand to 32-bit values (and thus if used for bitmap graphics to RGBA8888 format)

additionally a mode that can be used to create RGBA8888 format bitmap data directly from RGBA2222 format bitmap data could be useful. this would not need a mapping list of values as they can be created from the source values directly

(thinking about it, a simple way to expand RGBA2222 to RGBA8888 would be to expand 2-bits per pixel...)

@stevesims
Copy link
Contributor Author

experiments showed that it is possible to expand RGBA2222 into RGBA8888, by using the fact that it can be expanded as if an RGBA2222 bitmap is really a 2-bpp "greyscale" image. the byte order of an RGBA8888 image however does not match the bit order of an RGBA2222 image. this can be resolved tho by using a "reverse" command

an example command sequence is as follows:

REM first expand bitmap data into target buffer
VDU 23, 0, &A0, targetId%; &48, 2, sourceId%; 0, &7F, &BF, &FF
REM then reverse bytes to correct order
VDU 23, 0, &A0, targetId%; 24, 4, 4;
REM get the bitmap system to select the target buffer
VDU 23, 27, &20, targetId%;
REM and set that to be an RGBA8888 bitmap
VDU 23, 27, &21, width%; height%; 0

this should be added to the documentation

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

No branches or pull requests

1 participant