Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Why is one color missing? #774

Open
zt1514 opened this issue Nov 1, 2024 · 2 comments
Open

Why is one color missing? #774

zt1514 opened this issue Nov 1, 2024 · 2 comments

Comments

@zt1514
Copy link

zt1514 commented Nov 1, 2024

The original 24 x24 pixel image is as follows:
demo

After executing w4 run cart.wasm, the displayed image is as follows:
image

I executed w4 png2src demo.png --as and copied the code into main.ts as follows:

import * as w4 from "./wasm4";

const demoWidth = 24;
const demoHeight = 24;
const demoFlags = 1; // BLIT_2BPP
const demo = memory.data<u8>([0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x80, 0x00, 0x1a, 0x90, 0x00, 0x02, 0x80, 0x00, 0x1a, 0x90, 0x00, 0x02, 0x80, 0x00, 0x15, 0x50, 0x00, 0x02, 0x80, 0x00, 0x15, 0x50, 0x00, 0x02, 0x80, 0x00, 0x3f, 0xf0, 0x00, 0x02, 0x80, 0x00, 0x3f, 0xf0, 0x00, 0x02, 0x80, 0x00, 0x3f, 0xf0, 0x00, 0x02, 0x80, 0x00, 0x3f, 0xf0, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa]);
export function update(): void {
    w4.blit(demo, 0, 0, demoWidth, demoHeight, demoFlags);
}

The color of the pixel where blue should appear is not displayed.
Did I make a mistake in my operation?

@zt1514
Copy link
Author

zt1514 commented Nov 1, 2024

The four colors in original 24 x24 pixel image are :
#FFFFFF – White
#FF0000 – Red
#00FF00 – Green
#0000FF – Blue

@aduros
Copy link
Owner

aduros commented Dec 11, 2024

You may have to set DRAW_COLORS so that none of the 4 nibbles are 0 (transparent).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants