I think you put your answer inside the quote Eiyeron

I think I should miswrite somewhere: I request the help from someone to make this function...
Anyway, my function for my project
Two pixels are concatened like this:
0bAAAABBBB
or
0xAB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| void CopySprite_Palette_Alpha_Nibbles(unsigned char* data, unsigned short* palette, int x, int y, int width, int height) { unsigned short* VRAM = (unsigned short*)0xA8000000; unsigned short* ptr = VRAM + y*LCD_WIDTH_PX + x; int i,j; unsigned char nibble; //Get the color's index to use. for(j=0; j<height; j++) { for(i = 0; i < width; i+=2) { nibble = (*data)>>4; We get the first pixel if(nibble) //First index is alpha. *ptr = palette[nibble]; //COpy from the palette nibble = (*data) %16; We get the second pixel if(nibble) //On the road again *(ptr+1) = palette[nibble]; /* else *(ptr+1) = palette[0];*/ // FOr tests ptr+=2; //We go furtherer on the VRAM data++; //Idem } ptr += LCD_WIDTH_PX-width; // Go one line lower. } } |
Max 16 colours, enough for Pokémons, in example... :-°
First index is alpha
(Could you please too adapt this function to add a zoom factor, please? I would be erternally grateful)