Skip to content

What's the intuition behind using blip with BLIT_2BPP? #422

Answered by aduros
tupini07 asked this question in Questions
Discussion options

You must be logged in to vote

Hello!

Consider the 8 bits in a byte: a a b b c c d d. They can divided into 2 bit chunks.

aa is the first pixel (representing a color value between 0 and 3).
bb is the second...
cc is the third...
dd is the fourth...

We use 2 bits per pixel color (this is why it's called 2BPP!), or in other words, each byte contains 4 pixel colors.

So in your example, to draw an 8x8 image, you only need an array of 16 bytes, not 64.

DRAW_COLORS is a level of indirection that allows you to change the colors that get drawn without modifying the entire image data. So for each color in the image, it looks up the equivalent entry in DRAW_COLORS, then that color gets put into the framebuffer. And from there, t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tupini07
Comment options

Answer selected by tupini07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
2 participants