mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2025-07-04 03:06:39 +02:00
fxgxa: dump g3a icons with half blocks
This commit is contained in:
parent
ce0784f765
commit
1db7bb209e
3 changed files with 31 additions and 2 deletions
|
@ -258,10 +258,10 @@ void dump_g3a(struct g3a const *g3a, size_t size)
|
||||||
field(header->filename, 324);
|
field(header->filename, 324);
|
||||||
|
|
||||||
printf("\nUnselected program icon:\n\n");
|
printf("\nUnselected program icon:\n\n");
|
||||||
icon_print_16(header->icon_uns, 92, 64);
|
icon_print_16_half(header->icon_uns, 92, 64);
|
||||||
|
|
||||||
printf("\nSelected program icon:\n\n");
|
printf("\nSelected program icon:\n\n");
|
||||||
icon_print_16(header->icon_sel, 92, 64);
|
icon_print_16_half(header->icon_sel, 92, 64);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,5 +194,7 @@ void icon_print_1(uint8_t const *mono, int width, int height);
|
||||||
|
|
||||||
/* icon_print_16(): Show a 16-bit image on stdout (RGB ANSI escape codes) */
|
/* icon_print_16(): Show a 16-bit image on stdout (RGB ANSI escape codes) */
|
||||||
void icon_print_16(uint16_t const *rgb16be, int width, int height);
|
void icon_print_16(uint16_t const *rgb16be, int width, int height);
|
||||||
|
/* icon_print_16_half(): Like icon_print_16() with half-block characters */
|
||||||
|
void icon_print_16_half(uint16_t const *rgb16be, int width, int height);
|
||||||
|
|
||||||
#endif /* FX_FXGXA */
|
#endif /* FX_FXGXA */
|
||||||
|
|
27
fxgxa/icon.c
27
fxgxa/icon.c
|
@ -172,3 +172,30 @@ void icon_print_16(uint16_t const *rgb16be, int width, int height)
|
||||||
|
|
||||||
free(rgb24);
|
free(rgb24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void icon_print_16_half(uint16_t const *rgb16be, int width, int height)
|
||||||
|
{
|
||||||
|
uint8_t *rgb24 = icon_conv_16to24(rgb16be, width, height);
|
||||||
|
if(!rgb24) {
|
||||||
|
fprintf(stderr, "error: %m\n");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
for(int y2 = 0; y2 < height; y2 += 2) {
|
||||||
|
for(int x = 0; x < width; x++) {
|
||||||
|
int inT = 3 * (y2 * width + x);
|
||||||
|
int rT = rgb24[inT], gT = rgb24[inT+1], bT = rgb24[inT+2];
|
||||||
|
|
||||||
|
int inB = 3 * ((y2 + 1) * width + x);
|
||||||
|
int rB = 0, gB = 0, bB = 0;
|
||||||
|
if(y2 + 1 < height)
|
||||||
|
rB = rgb24[inB], gB = rgb24[inB+1], bB = rgb24[inB+2];
|
||||||
|
|
||||||
|
printf("\e[38;2;%d;%d;%dm\e[48;2;%d;%d;%dm▀",
|
||||||
|
rT, gT, bT, rB, gB, bB);
|
||||||
|
}
|
||||||
|
printf("\e[0m\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
free(rgb24);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue