Sprite not as expected [Solved]

I have this sprite:

With this mask:

and yet the resulting sprite looks like this:

Which is weird. Can anyone explain why, please?

Thanks in advance,

Mike

Post some code for us to examine, it will help :slight_smile:

Even just the relevant snippets

const unsigned char PROGMEM SMALLBOX[] =
{
16, 16,
0xf8, 0x14, 0x94, 0x32, 0x22, 0x63, 0xc1, 0xc1, 0xe3, 0xe2, 0xf6, 0xf4, 0xf8, 0x00, 0x00, 0x00,
0x07, 0x08, 0x0a, 0x10, 0x15, 0x20, 0x3f, 0x3f, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x00, 0x00, 0x00,
};

const unsigned char PROGMEM SMALLBOXMASK[] =
{
0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xf8, 0x00, 0x00, 0x00,
0x07, 0x0f, 0x0f, 0x1f, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x00, 0x00, 0x00,
};

sprites.drawExternalMask( 56, 24, SMALLBOX, SMALLBOXMASK, 0, 0);

Hm, isn’t that what is meant to happen. The stuff inside the mask is drawn and the rest of the pixels are unchanged, Or do you mean that the resulting image is offset (eg, not in the top left)

Look at the image. It is totally different to the first image.

From a quick glance (I didn’t map the whole thing), it looks like the contents of the arrays matches the resulting image. It appears your converter isn’t working properly.

Hmmm… I’m use TeamARGs convertor…
https://teamarg.github.io/arduboy-image-converter/

Oh sorry i see now, it looks horizontally smeared. I don’t think i will be able to help

Looks like a bug in the Team A.R.G. image converter.

  • I saved your original images
  • Opened them in Gimp
  • Scaled them to 16 x 16
  • Exported them as .png
  • Dragged them to the converter web page (twice each)

The images shown on the web page after conversion looked correct but the output data was wrong (identical to yours).

@JO3RI, any ideas?

Problem solved.

@TheArduinoGuy, your images are not pure black and white pixels. Some are grey.

I repainted them as full white and full black and now I think the output is correct:

const unsigned char PROGMEM SMALLBOX[] =
{
16, 16,
0xf8, 0x14, 0x94, 0x22, 0x22, 0x41, 0xc1, 0xc1, 0xe2, 0xe2, 0xf4, 0xf4, 0xf8, 0x00, 0x00, 0x00, 
0x07, 0x08, 0x0a, 0x10, 0x15, 0x20, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x00, 0x00, 0x00, 
};

const unsigned char PROGMEM SMALLBOXMASK[] =
{
16, 16,
0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xf8, 0x00, 0x00, 0x00, 
0x07, 0x0f, 0x0f, 0x1f, 0x1f, 0x3f, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x00, 0x00, 0x00, 
};
1 Like

Yeah you got to be careful. I think my converter allows you to be a little fuzzy for this reason. Or maybe it just supports black and “not black”.

Oh that’s weird I didn’t spot that. Thanks. Need to be more careful in future.

Yeah i’m surprised the TeamARG convertor doesn’t treat anything dark over a threshold as being BLACK.

File an issue on github. :slight_smile:

Yep Black, not black and transparent.

Just convert your image to 1-bit (and back to RGB if you like) before saving.