forked from hkc/cc-stuff
First semi-working prototype of converter in C
It gives some funky results tho
This commit is contained in:
parent
a06361ad4a
commit
0afb88e147
604
img2cpi.c
604
img2cpi.c
|
@ -1,4 +1,4 @@
|
||||||
// x-run: ~/scripts/runc.sh % -Wall -Wextra -std=c99 -pedantic -lm --- ~/images/boykisser.png cpi-images/boykisser.cpi
|
// x-run: ~/scripts/runc.sh % -Wall -Wextra -lm --- ~/images/boykisser.png cpi-images/boykisser.cpi
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#include <stb/stb_image.h>
|
#include <stb/stb_image.h>
|
||||||
#define STB_IMAGE_RESIZE_IMPLEMENTATION
|
#define STB_IMAGE_RESIZE_IMPLEMENTATION
|
||||||
|
@ -14,11 +14,25 @@
|
||||||
|
|
||||||
#define MAX_COLOR_DIFFERENCE 768
|
#define MAX_COLOR_DIFFERENCE 768
|
||||||
|
|
||||||
|
struct rgba { uint8_t r, g, b, a; };
|
||||||
|
union color {
|
||||||
|
struct rgba rgba;
|
||||||
|
uint32_t v;
|
||||||
|
};
|
||||||
|
struct cc_char {
|
||||||
|
unsigned char character;
|
||||||
|
unsigned char bg, fg;
|
||||||
|
};
|
||||||
|
|
||||||
|
const extern char font_atlas[256][11];
|
||||||
|
const extern union color DEFAULT_PALETTE[16], DEFAULT_GRAY_PALETTE[16];
|
||||||
|
|
||||||
struct arguments {
|
struct arguments {
|
||||||
bool text_mode;
|
bool fast_mode;
|
||||||
int width, height;
|
int width, height;
|
||||||
enum cpi_version {
|
enum cpi_version {
|
||||||
CPI_VERSION_AUTO,
|
CPI_VERSION_AUTO,
|
||||||
|
CPI_VERSION_RAW,
|
||||||
CPI_VERSION_0,
|
CPI_VERSION_0,
|
||||||
CPI_VERSION_1,
|
CPI_VERSION_1,
|
||||||
CPI_VERSION_2,
|
CPI_VERSION_2,
|
||||||
|
@ -31,24 +45,37 @@ struct arguments {
|
||||||
PLACEMENT_EXTEND,
|
PLACEMENT_EXTEND,
|
||||||
PLACEMENT_FILL
|
PLACEMENT_FILL
|
||||||
} placement;
|
} placement;
|
||||||
|
enum palette_type {
|
||||||
|
PALETTE_DEFAULT,
|
||||||
|
PALETTE_DEFAULT_GRAY,
|
||||||
|
PALETTE_AUTO,
|
||||||
|
PALETTE_PATH,
|
||||||
|
PALETTE_LIST
|
||||||
|
} palette_type;
|
||||||
|
char *palette;
|
||||||
char *input_path;
|
char *input_path;
|
||||||
char *output_path;
|
char *output_path;
|
||||||
} args = {
|
} args = {
|
||||||
.text_mode = false,
|
.fast_mode = false,
|
||||||
.width = 4 * 8 - 1,
|
.width = 4 * 8 - 1, // 4x3 blocks screen
|
||||||
.height = 3 * 6 - 2,
|
.height = 3 * 6 - 2,
|
||||||
.cpi_version = CPI_VERSION_AUTO,
|
.cpi_version = CPI_VERSION_AUTO,
|
||||||
.placement = PLACEMENT_FULL,
|
.placement = PLACEMENT_FULL,
|
||||||
.input_path = NULL,
|
.input_path = NULL,
|
||||||
.output_path = NULL
|
.output_path = NULL,
|
||||||
|
.palette = NULL,
|
||||||
|
.palette_type = PALETTE_DEFAULT // TODO(kc): change to PALETTE_AUTO when
|
||||||
|
// k-means is implemented
|
||||||
};
|
};
|
||||||
|
|
||||||
struct image {
|
struct image {
|
||||||
int w, h;
|
int w, h;
|
||||||
union color { // Alpha channel is not used, it's just there to align it all
|
union color *pixels;
|
||||||
struct rgba { uint8_t r, g, b, a; } rgba;
|
};
|
||||||
uint32_t v;
|
|
||||||
} *pixels;
|
struct image_pal {
|
||||||
|
int w, h;
|
||||||
|
uint8_t *pixels;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool parse_cmdline(int argc, char **argv);
|
bool parse_cmdline(int argc, char **argv);
|
||||||
|
@ -56,8 +83,10 @@ void show_help(const char *progname, bool show_all, FILE *fp);
|
||||||
struct image *image_load(const char *fp);
|
struct image *image_load(const char *fp);
|
||||||
struct image *image_new(int w, int h);
|
struct image *image_new(int w, int h);
|
||||||
struct image *image_resize(struct image *original, int new_w, int new_h);
|
struct image *image_resize(struct image *original, int new_w, int new_h);
|
||||||
struct image *image_dither(struct image *original, union color *colors, size_t n_colors);
|
struct image_pal *image_quantize(struct image *original, const union color *colors, size_t n_colors);
|
||||||
|
float get_color_difference(union color a, union color b);
|
||||||
void image_unload(struct image *img);
|
void image_unload(struct image *img);
|
||||||
|
void get_size_keep_aspect(int w, int h, int dw, int dh, int *ow, int *oh);
|
||||||
|
|
||||||
const char *known_file_extensions[] = {
|
const char *known_file_extensions[] = {
|
||||||
".png", ".jpg", ".jpeg", ".jfif", ".jpg", ".gif",
|
".png", ".jpg", ".jpeg", ".jfif", ".jpg", ".gif",
|
||||||
|
@ -72,12 +101,19 @@ static const struct optiondocs {
|
||||||
struct optiondocs_choice { char *value; char *doc; } *choices;
|
struct optiondocs_choice { char *value; char *doc; } *choices;
|
||||||
} optiondocs[] = {
|
} optiondocs[] = {
|
||||||
{ 'h', "help", 0, "Show help", 0 },
|
{ 'h', "help", 0, "Show help", 0 },
|
||||||
{ 't', "textmode", 0, "Output Lua script instead of binary", 0 },
|
{ 'f', "fast", 0, "Use fast (old) method for picking characters and colors", 0 },
|
||||||
{ 'W', "width", "width", "Width in characters", 0 },
|
{ 'W', "width", "width", "Width in characters", 0 },
|
||||||
{ 'h', "height", "height", "Height in characters", 0 },
|
{ 'h', "height", "height", "Height in characters", 0 },
|
||||||
|
{ 'P', "palette", "palette", "Use specific palette.\n"
|
||||||
|
" `auto` uses automatic selection\n"
|
||||||
|
" `default` uses default palette\n"
|
||||||
|
" `defaultgray` uses default grayscale palette\n"
|
||||||
|
" `list:#RRGGBB,#RRGGBB,...` uses hard-coded one\n"
|
||||||
|
" `txt:PATH` reads hex colors from each line in a file\n", 0 },
|
||||||
{ 'V', "cpi_version", "version", "Force specific version of CPI",
|
{ 'V', "cpi_version", "version", "Force specific version of CPI",
|
||||||
(struct optiondocs_choice[]) {
|
(struct optiondocs_choice[]) {
|
||||||
{ "-1", "Choose best available" },
|
{ "-2,raw", "Use raw format. No headers, no palette, just characters and colors" },
|
||||||
|
{ "-1,auto", "Choose best available" },
|
||||||
{ "0", "OG CPI, 255x255, uncompressed" },
|
{ "0", "OG CPI, 255x255, uncompressed" },
|
||||||
{ "1", "CPIv1, huge images, uncompressed" },
|
{ "1", "CPIv1, huge images, uncompressed" },
|
||||||
{ "255", "In-dev version, may not work" },
|
{ "255", "In-dev version, may not work" },
|
||||||
|
@ -103,20 +139,170 @@ int main(int argc, char **argv) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("fast_mode = %s\n", args.fast_mode ? "true" : "false");
|
||||||
|
printf("size = %dx%d\n", args.width, args.height);
|
||||||
|
printf("version = %s\n",
|
||||||
|
args.cpi_version == CPI_VERSION_AUTO ? "AUTO" : (
|
||||||
|
args.cpi_version == CPI_VERSION_RAW ? "RAW" : (
|
||||||
|
args.cpi_version == CPI_VERSION_0 ? "0" : (
|
||||||
|
args.cpi_version == CPI_VERSION_1 ? "1" : (
|
||||||
|
args.cpi_version == CPI_VERSION_2 ? "2" : (
|
||||||
|
"UNKNOWN"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
printf("placement = %s\n",
|
||||||
|
args.placement == PLACEMENT_CENTER ? "CENTER" : (
|
||||||
|
args.placement == PLACEMENT_COVER ? "COVER" : (
|
||||||
|
args.placement == PLACEMENT_TILE ? "TILE" : (
|
||||||
|
args.placement == PLACEMENT_FULL ? "FULL" : (
|
||||||
|
args.placement == PLACEMENT_EXTEND ? "EXTEND" : (
|
||||||
|
args.placement == PLACEMENT_FILL ? "FILL" : (
|
||||||
|
"UNKNOWN"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
printf("palette = %s => %s\n",
|
||||||
|
args.palette_type == PALETTE_DEFAULT ? "DEFAULT" : (
|
||||||
|
args.palette_type == PALETTE_DEFAULT_GRAY ? "DEFAULTGRAY" : (
|
||||||
|
args.palette_type == PALETTE_AUTO ? "AUTO" : (
|
||||||
|
args.palette_type == PALETTE_PATH ? "PATH" : (
|
||||||
|
args.palette_type == PALETTE_LIST ? "LIST" : (
|
||||||
|
"UNKNOWN"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
args.palette
|
||||||
|
);
|
||||||
|
printf("input: %s\n", args.input_path);
|
||||||
|
printf("output: %s\n", args.output_path);
|
||||||
|
|
||||||
struct image *src_image = image_load(args.input_path);
|
struct image *src_image = image_load(args.input_path);
|
||||||
if (!src_image) {
|
if (!src_image) {
|
||||||
fprintf(stderr, "Error: failed to open the file\n");
|
fprintf(stderr, "Error: failed to open the file\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct image *canvas = image_new(args.width * 2, args.height * 3);
|
struct image *canvas;
|
||||||
|
if (args.fast_mode) {
|
||||||
|
canvas = image_new(args.width * 2, args.height * 3);
|
||||||
|
} else {
|
||||||
|
canvas = image_new(args.width * 8, args.height * 11);
|
||||||
|
}
|
||||||
|
|
||||||
if (!canvas) {
|
if (!canvas) {
|
||||||
fprintf(stderr, "Error: failed to allocate second image buffer\n");
|
fprintf(stderr, "Error: failed to allocate second image buffer\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: load palette
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: properly scale
|
||||||
|
struct image *scaled_image;
|
||||||
|
{
|
||||||
|
int new_w, new_h;
|
||||||
|
get_size_keep_aspect(src_image->w, src_image->h, canvas->w, canvas->h, &new_w, &new_h);
|
||||||
|
|
||||||
|
printf("new size: %dx%d\n", new_w, new_h);
|
||||||
|
scaled_image = image_resize(src_image, new_w, new_h);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: position image properly
|
||||||
|
int small_w = scaled_image->w < canvas->w ? scaled_image->w : canvas->w;
|
||||||
|
int small_h = scaled_image->h < canvas->h ? scaled_image->h : canvas->h;
|
||||||
|
for (int y = 0; y < small_h; y++) {
|
||||||
|
memcpy(&canvas->pixels[y * canvas->w],
|
||||||
|
&scaled_image->pixels[y * scaled_image->w],
|
||||||
|
small_w * sizeof(union color));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: actually do stuff
|
// TODO: actually do stuff
|
||||||
|
|
||||||
|
const union color *palette = DEFAULT_PALETTE;
|
||||||
|
struct cc_char *characters = calloc(args.width * args.height, sizeof(struct cc_char));
|
||||||
|
|
||||||
|
struct image_pal *quantized_image = image_quantize(canvas, palette, 16);
|
||||||
|
|
||||||
|
FILE *tmp = fopen("/tmp/img.raw", "wb");
|
||||||
|
for (int i = 0; i < quantized_image->w * quantized_image->h; i++) {
|
||||||
|
union color pix = palette[quantized_image->pixels[i]];
|
||||||
|
fputc(pix.rgba.r, tmp);
|
||||||
|
fputc(pix.rgba.g, tmp);
|
||||||
|
fputc(pix.rgba.b, tmp);
|
||||||
|
}
|
||||||
|
fclose(tmp);
|
||||||
|
|
||||||
|
if (args.fast_mode) {
|
||||||
|
// use old 2x3
|
||||||
|
} else {
|
||||||
|
// use new 8x11 character matching
|
||||||
|
for (int y = 0; y < args.height; y++) {
|
||||||
|
for (int x = 0; x < args.width; x++) {
|
||||||
|
printf("DBG: %d:%d\n", x, y);
|
||||||
|
// Oh boy...
|
||||||
|
int min_diff = 0xffffff;
|
||||||
|
char closest_sym = 0x00, closest_color = 0xae;
|
||||||
|
for (int sym = 0x01; sym <= 0xff; sym++) {
|
||||||
|
if (sym == '\t' || sym == '\n' || sym == '\r' || sym == '\x0e') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int color = 0x00; color <= 0xff; color++) {
|
||||||
|
union color cell_bg = palette[color & 0xF],
|
||||||
|
cell_fg = palette[color >> 4];
|
||||||
|
int difference = 0;
|
||||||
|
for (int oy = 0; oy < 11; oy++) {
|
||||||
|
unsigned char sym_line = font_atlas[sym][oy];
|
||||||
|
for (int ox = 0; ox < 8; ox++) {
|
||||||
|
bool lit = sym_line & (0x80 >> ox);
|
||||||
|
union color pixel = palette[quantized_image->pixels[
|
||||||
|
x * 8 + ox + (y * 11 + oy) * args.width
|
||||||
|
]];
|
||||||
|
difference += get_color_difference(pixel, lit ? cell_fg : cell_bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (difference <= min_diff) {
|
||||||
|
min_diff = difference;
|
||||||
|
closest_sym = sym;
|
||||||
|
closest_color = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (closest_sym != 0) {
|
||||||
|
printf("HIT! %d\n", closest_sym);
|
||||||
|
}
|
||||||
|
characters[x + y * args.width].character = closest_sym;
|
||||||
|
characters[x + y * args.width].bg = closest_color & 0xF;
|
||||||
|
characters[x + y * args.width].fg = closest_color >> 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: implement something other than CPIv0
|
||||||
|
FILE *fp = fopen(args.output_path, "wb");
|
||||||
|
fwrite("CCPI", 1, 4, fp);
|
||||||
|
fputc(args.width, fp);
|
||||||
|
fputc(args.height, fp);
|
||||||
|
fputc(0x00, fp);
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
fputc(palette[i].rgba.r, fp);
|
||||||
|
fputc(palette[i].rgba.g, fp);
|
||||||
|
fputc(palette[i].rgba.b, fp);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < args.width * args.height; i++) {
|
||||||
|
fputc(characters[i].character, fp);
|
||||||
|
fputc(characters[i].bg | (characters[i].fg << 4), fp);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
image_unload(src_image);
|
image_unload(src_image);
|
||||||
image_unload(canvas);
|
image_unload(canvas);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
@ -125,17 +311,18 @@ int main(int argc, char **argv) {
|
||||||
bool parse_cmdline(int argc, char **argv) {
|
bool parse_cmdline(int argc, char **argv) {
|
||||||
static struct option options[] = {
|
static struct option options[] = {
|
||||||
{ "help", no_argument, 0, 'h' },
|
{ "help", no_argument, 0, 'h' },
|
||||||
{ "textmode", no_argument, 0, 't' },
|
{ "fast", no_argument, 0, 'f' },
|
||||||
{ "width", required_argument, 0, 'W' },
|
{ "width", required_argument, 0, 'W' },
|
||||||
{ "height", required_argument, 0, 'H' },
|
{ "height", required_argument, 0, 'H' },
|
||||||
{ "cpi_version", required_argument, 0, 'V' },
|
{ "cpi_version", required_argument, 0, 'V' },
|
||||||
{ "placement", required_argument, 0, 'p' },
|
{ "placement", required_argument, 0, 'p' },
|
||||||
|
{ "palette", required_argument, 0, 'P' },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
int c = getopt_long(argc, argv, "htW:H:V:p:", options, &option_index);
|
int c = getopt_long(argc, argv, "hfW:H:V:p:P:", options, &option_index);
|
||||||
if (c == -1) break;
|
if (c == -1) break;
|
||||||
if (c == 0) c = options[option_index].val;
|
if (c == 0) c = options[option_index].val;
|
||||||
if (c == '?') break;
|
if (c == '?') break;
|
||||||
|
@ -145,8 +332,8 @@ bool parse_cmdline(int argc, char **argv) {
|
||||||
show_help(argv[0], true, stdout);
|
show_help(argv[0], true, stdout);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 'f':
|
||||||
args.text_mode = true;
|
args.fast_mode = true;
|
||||||
if (args.cpi_version != CPI_VERSION_AUTO) {
|
if (args.cpi_version != CPI_VERSION_AUTO) {
|
||||||
fprintf(stderr, "Warning: text mode ignores version\n");
|
fprintf(stderr, "Warning: text mode ignores version\n");
|
||||||
}
|
}
|
||||||
|
@ -159,12 +346,17 @@ bool parse_cmdline(int argc, char **argv) {
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
{
|
{
|
||||||
int v = atoi(optarg);
|
if (0 == strcmp(optarg, "auto") || 0 == strcmp(optarg, "-1")) {
|
||||||
if ((v < -1 || v > 1) && v != 255) {
|
args.cpi_version = CPI_VERSION_AUTO;
|
||||||
fprintf(stderr, "Error: Invalid CPI version: %d\n", args.cpi_version);
|
} else if (0 == strcmp(optarg, "raw") || 0 == strcmp(optarg, "-2")) {
|
||||||
return false;
|
args.cpi_version = CPI_VERSION_RAW;
|
||||||
|
} else if (0 == strcmp(optarg, "0")) {
|
||||||
|
args.cpi_version = CPI_VERSION_0;
|
||||||
|
} else if (0 == strcmp(optarg, "1")) {
|
||||||
|
args.cpi_version = CPI_VERSION_1;
|
||||||
|
} else if (0 == strcmp(optarg, "2")) {
|
||||||
|
args.cpi_version = CPI_VERSION_2;
|
||||||
}
|
}
|
||||||
args.cpi_version = v == -1 ? CPI_VERSION_AUTO : v;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
|
@ -185,6 +377,21 @@ bool parse_cmdline(int argc, char **argv) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'P':
|
||||||
|
if (0 == strcmp(optarg, "default")) {
|
||||||
|
args.palette_type = PALETTE_DEFAULT;
|
||||||
|
} else if (0 == strcmp(optarg, "defaultgray")) {
|
||||||
|
args.palette_type = PALETTE_DEFAULT_GRAY;
|
||||||
|
} else if (0 == strcmp(optarg, "auto")) {
|
||||||
|
args.palette_type = PALETTE_AUTO;
|
||||||
|
} else if (0 == strncmp(optarg, "list:", 5)) {
|
||||||
|
args.palette_type = PALETTE_LIST;
|
||||||
|
args.palette = &optarg[5];
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Error: invaild palette %s\n", optarg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +482,9 @@ void show_help(const char *progname, bool show_all, FILE *fp) {
|
||||||
}
|
}
|
||||||
if (x > 24) fprintf(fp, "\n%24c", ' ');
|
if (x > 24) fprintf(fp, "\n%24c", ' ');
|
||||||
else fprintf(fp, "%*c", 24 - x, ' ');
|
else fprintf(fp, "%*c", 24 - x, ' ');
|
||||||
|
|
||||||
fprintf(fp, "%s\n", doc.doc);
|
fprintf(fp, "%s\n", doc.doc);
|
||||||
|
|
||||||
if (doc.choices) {
|
if (doc.choices) {
|
||||||
for (int j = 0; doc.choices[j].value != 0; j++) {
|
for (int j = 0; doc.choices[j].value != 0; j++) {
|
||||||
fprintf(fp, "%26c", ' ');
|
fprintf(fp, "%26c", ' ');
|
||||||
|
@ -325,3 +534,354 @@ void image_unload(struct image *img) {
|
||||||
free(img);
|
free(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_size_keep_aspect(int w, int h, int dw, int dh, int *ow, int *oh)
|
||||||
|
{
|
||||||
|
*ow = dw;
|
||||||
|
*oh = dh;
|
||||||
|
float ratio = (float)w / (float)h;
|
||||||
|
float ratio_dst = (float)dw / (float)dh;
|
||||||
|
int tmp_1, tmp_2;
|
||||||
|
if (ratio_dst >= ratio)
|
||||||
|
{
|
||||||
|
tmp_1 = floor(dh * ratio);
|
||||||
|
tmp_2 = ceil(dh * ratio);
|
||||||
|
if (fabsf(ratio - (float)tmp_1 / dh) < fabsf(ratio - (float)tmp_2 / dh))
|
||||||
|
*ow = tmp_1 < 1 ? 1 : tmp_1;
|
||||||
|
else
|
||||||
|
*ow = tmp_2 < 1 ? 1 : tmp_2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp_1 = floor(dw / ratio);
|
||||||
|
tmp_2 = ceil(dw / ratio);
|
||||||
|
if (tmp_2 == 0 ||
|
||||||
|
fabs(ratio - (float)dw / tmp_1) < fabs(ratio - (float)dw / tmp_2))
|
||||||
|
(*oh) = tmp_1 < 1 ? 1 : tmp_1;
|
||||||
|
else
|
||||||
|
(*oh) = tmp_2 < 1 ? 1 : tmp_2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct image_pal *image_quantize(struct image *original, const union color *colors, size_t n_colors) {
|
||||||
|
struct image_pal *out = calloc(1, sizeof(struct image_pal));
|
||||||
|
out->w = original->w;
|
||||||
|
out->h = original->h;
|
||||||
|
out->pixels = calloc(original->w, original->h);
|
||||||
|
|
||||||
|
for (int i = 0; i < out->w * out->h; i++) {
|
||||||
|
int closest_color = 0;
|
||||||
|
float closest_distance = 1e20;
|
||||||
|
for (int color = 0; color < n_colors; color++) {
|
||||||
|
float dist = get_color_difference(colors[color], original->pixels[i]);
|
||||||
|
if (dist <= closest_distance) {
|
||||||
|
closest_distance = dist;
|
||||||
|
closest_color = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out->pixels[i] = closest_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_color_difference(union color a, union color b) {
|
||||||
|
int dr = a.rgba.r - b.rgba.r,
|
||||||
|
dg = a.rgba.g - b.rgba.g,
|
||||||
|
db = a.rgba.b - b.rgba.b;
|
||||||
|
return dr * dr + dg * dg + db * db;
|
||||||
|
}
|
||||||
|
|
||||||
|
const union color DEFAULT_PALETTE[16] = {
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xff },
|
||||||
|
{ 0xf2, 0xb2, 0x33, 0xff },
|
||||||
|
{ 0xe5, 0x7f, 0xd8, 0xff },
|
||||||
|
{ 0x99, 0xb2, 0xf2, 0xff },
|
||||||
|
{ 0xde, 0xde, 0x6c, 0xff },
|
||||||
|
{ 0x7f, 0xcc, 0x19, 0xff },
|
||||||
|
{ 0xf2, 0xb2, 0xcc, 0xff },
|
||||||
|
{ 0x4c, 0x4c, 0x4c, 0xff },
|
||||||
|
{ 0x99, 0x99, 0x99, 0xff },
|
||||||
|
{ 0x4c, 0x99, 0xb2, 0xff },
|
||||||
|
{ 0xb2, 0x66, 0xe5, 0xff },
|
||||||
|
{ 0x33, 0x66, 0xcc, 0xff },
|
||||||
|
{ 0x7f, 0x66, 0x4c, 0xff },
|
||||||
|
{ 0x57, 0xa6, 0x4e, 0xff },
|
||||||
|
{ 0xcc, 0x4c, 0x4c, 0xff },
|
||||||
|
{ 0x11, 0x11, 0x11, 0xff }
|
||||||
|
}, DEFAULT_GRAY_PALETTE[16] = {
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xff },
|
||||||
|
{ 0x9d, 0x9d, 0x9d, 0xff },
|
||||||
|
{ 0xbe, 0xbe, 0xbe, 0xff },
|
||||||
|
{ 0xbf, 0xbf, 0xbf, 0xff },
|
||||||
|
{ 0xb8, 0xb8, 0xb8, 0xff },
|
||||||
|
{ 0x76, 0x76, 0x76, 0xff },
|
||||||
|
{ 0xd0, 0xd0, 0xd0, 0xff },
|
||||||
|
{ 0x4c, 0x4c, 0x4c, 0xff },
|
||||||
|
{ 0x99, 0x99, 0x99, 0xff },
|
||||||
|
{ 0x87, 0x87, 0x87, 0xff },
|
||||||
|
{ 0xa9, 0xa9, 0xa9, 0xff },
|
||||||
|
{ 0x77, 0x77, 0x77, 0xff },
|
||||||
|
{ 0x65, 0x65, 0x65, 0xff },
|
||||||
|
{ 0x6e, 0x6e, 0x6e, 0xff },
|
||||||
|
{ 0x76, 0x76, 0x76, 0xff },
|
||||||
|
{ 0x11, 0x11, 0x11, 0xff }
|
||||||
|
};
|
||||||
|
|
||||||
|
const char font_atlas[256][11] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x6c, 0x44, 0x54, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x7c, 0x54, 0x7c, 0x44, 0x6c, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x28, 0x7c, 0x7c, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x38, 0x10, 0x7c, 0x7c, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x38, 0x7c, 0x7c, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x7e, 0x7e, 0x66, 0x42, 0x42, 0x66, 0x7e, 0x7e, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x1c, 0x0c, 0x34, 0x48, 0x48, 0x30, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x10, 0x38, 0x10, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x3c, 0x24, 0x3c, 0x20, 0x60, 0x60, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x3e, 0x22, 0x3e, 0x22, 0x66, 0x66, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x40, 0x70, 0x7c, 0x70, 0x40, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x04, 0x1c, 0x7c, 0x1c, 0x04, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x38, 0x7c, 0x10, 0x10, 0x7c, 0x38, 0x10, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x24, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x3c, 0x54, 0x54, 0x34, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x3c, 0x60, 0x58, 0x44, 0x34, 0x0c, 0x78, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x38, 0x7c, 0x10, 0x7c, 0x38, 0x10, 0x7c, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x38, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x18, 0x7c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x30, 0x7c, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x24, 0x7e, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x7c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x14, 0x14, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x28, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x3c, 0x40, 0x38, 0x04, 0x78, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x48, 0x08, 0x10, 0x20, 0x24, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x28, 0x10, 0x34, 0x58, 0x48, 0x34, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x10, 0x20, 0x20, 0x20, 0x10, 0x0c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x30, 0x08, 0x04, 0x04, 0x04, 0x08, 0x30, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x24, 0x18, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x04, 0x08, 0x08, 0x10, 0x20, 0x20, 0x40, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x4c, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x04, 0x18, 0x20, 0x44, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x04, 0x18, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x14, 0x24, 0x44, 0x7c, 0x04, 0x04, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x7c, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x18, 0x20, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x7c, 0x44, 0x04, 0x08, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x44, 0x3c, 0x04, 0x08, 0x30, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x3c, 0x42, 0x5a, 0x5a, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x78, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x7c, 0x40, 0x70, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x7c, 0x40, 0x70, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x3c, 0x40, 0x4c, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x48, 0x70, 0x48, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x6c, 0x54, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x78, 0x44, 0x78, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x48, 0x34, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x78, 0x44, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x3c, 0x40, 0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6c, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x7c, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x40, 0x20, 0x20, 0x10, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x04, 0x04, 0x34, 0x4c, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x10, 0x3c, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x3c, 0x44, 0x44, 0x3c, 0x04, 0x78, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x20, 0x20, 0x24, 0x28, 0x30, 0x28, 0x24, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x68, 0x54, 0x54, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x78, 0x40, 0x40, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x34, 0x4c, 0x44, 0x3c, 0x04, 0x04, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x3c, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x10, 0x38, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x44, 0x44, 0x54, 0x54, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x78, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x7c, 0x08, 0x10, 0x20, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x10, 0x10, 0x20, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x30, 0x08, 0x08, 0x04, 0x08, 0x08, 0x30, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x24, 0x48, 0x12, 0x24, 0x48, 0x12, 0x24, 0x48, 0x12, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x7f, 0x7f, 0x7f, 0x7f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x38, 0x44, 0x40, 0x44, 0x38, 0x10, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x18, 0x24, 0x20, 0x78, 0x20, 0x20, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x28, 0x7c, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x3c, 0x60, 0x58, 0x44, 0x34, 0x0c, 0x78, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x3c, 0x4a, 0x52, 0x52, 0x4a, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x30, 0x08, 0x38, 0x48, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x14, 0x28, 0x50, 0x28, 0x14, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x3c, 0x5a, 0x5a, 0x56, 0x42, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x30, 0x48, 0x48, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x7c, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x40, 0x20, 0x60, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x20, 0x60, 0x20, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x7a, 0x40, 0x40, 0x00, },
|
||||||
|
{ 0x00, 0x3c, 0x54, 0x54, 0x34, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x20, 0x60, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x50, 0x28, 0x14, 0x28, 0x50, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x48, 0x08, 0x10, 0x2c, 0x2c, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x44, 0x48, 0x08, 0x10, 0x24, 0x28, 0x4c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x64, 0x28, 0x68, 0x10, 0x2c, 0x2c, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x00, 0x10, 0x20, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x00, 0x38, 0x44, 0x7c, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x38, 0x44, 0x7c, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x38, 0x44, 0x7c, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x50, 0x38, 0x44, 0x7c, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x38, 0x44, 0x7c, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x00, 0x38, 0x44, 0x7c, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x3c, 0x50, 0x50, 0x78, 0x50, 0x50, 0x5c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x40, 0x40, 0x44, 0x38, 0x08, 0x10, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x00, 0x7c, 0x40, 0x78, 0x40, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x7c, 0x40, 0x78, 0x40, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x7c, 0x40, 0x78, 0x40, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x7c, 0x40, 0x78, 0x40, 0x7c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x30, 0x00, 0x38, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x18, 0x00, 0x38, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x28, 0x38, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x38, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x78, 0x44, 0x44, 0x64, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x14, 0x28, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x50, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x4c, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x00, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x28, 0x00, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x44, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x10, 0x18, 0x14, 0x18, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x78, 0x44, 0x58, 0x44, 0x44, 0x44, 0x58, 0x40, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x50, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x2c, 0x52, 0x7c, 0x50, 0x2e, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x08, 0x10, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x38, 0x44, 0x7c, 0x40, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x30, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x18, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x08, 0x3c, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x50, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x38, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x50, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x10, 0x00, 0x7c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x38, 0x4c, 0x54, 0x64, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x60, 0x00, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x10, 0x28, 0x00, 0x44, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x44, 0x44, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x0c, 0x00, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x78, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x30, 0x10, 0x18, 0x14, 0x18, 0x10, 0x38, 0x00, 0x00, 0x00, },
|
||||||
|
{ 0x00, 0x28, 0x00, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x78, 0x00, 0x00, },
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue