2023-04-17 09:55:52 +02:00
|
|
|
#include "../../include/microfx/ext/img.h"
|
2023-07-18 16:25:46 +02:00
|
|
|
#include "../../include/microfx/microfx.h"
|
2023-01-16 19:41:49 +01:00
|
|
|
|
|
|
|
void simage(int sx, int sy, int w, int h, unsigned char *img, int mode) {
|
2023-05-04 16:48:58 +02:00
|
|
|
/* Draws an image from a sprite coder string */
|
|
|
|
int x, y, rpos, gpos, bpos, color;
|
|
|
|
for(y=0;y<h;y++){
|
|
|
|
for(x=0;x<w;x++){
|
|
|
|
rpos = y*(w+(w%2))+x;
|
|
|
|
gpos = rpos/8;
|
|
|
|
bpos = rpos%8;
|
|
|
|
color = (img[gpos] << bpos) & 0x80;
|
|
|
|
switch(mode){
|
|
|
|
case STRANSP:
|
|
|
|
if(color) spixel(sx+x, sy+y, SWHITE);
|
|
|
|
break;
|
|
|
|
case SNOWHITE:
|
|
|
|
if(color) spixel(sx+x, sy+y, SBLACK);
|
|
|
|
break;
|
|
|
|
case SNOBLACK:
|
|
|
|
if(!color) spixel(sx+x, sy+y, SWHITE);
|
|
|
|
break;
|
|
|
|
default: /* SNORMAL or SINVERTED */
|
|
|
|
spixel(sx+x, sy+y, mode ? !color : color);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-16 19:41:49 +01:00
|
|
|
}
|