One can only hope
This commit is contained in:
parent
094308ce0b
commit
a665f9498d
|
@ -84,7 +84,7 @@ 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_pal *image_quantize(struct image *original, const 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);
|
int 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);
|
void get_size_keep_aspect(int w, int h, int dw, int dh, int *ow, int *oh);
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ int main(int argc, char **argv) {
|
||||||
// Oh boy...
|
// Oh boy...
|
||||||
int min_diff = 0xffffff;
|
int min_diff = 0xffffff;
|
||||||
char closest_sym = 0x00, closest_color = 0xae;
|
char closest_sym = 0x00, closest_color = 0xae;
|
||||||
for (int sym = 0x01; sym <= 0xff; sym++) {
|
for (int sym = 0x01; sym <= 0xFF; sym++) {
|
||||||
if (sym == '\t' || sym == '\n' || sym == '\r' || sym == '\x0e') {
|
if (sym == '\t' || sym == '\n' || sym == '\r' || sym == '\x0e') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -276,9 +276,6 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (closest_sym != 0) {
|
|
||||||
printf("HIT! %d\n", closest_sym);
|
|
||||||
}
|
|
||||||
characters[x + y * args.width].character = closest_sym;
|
characters[x + y * args.width].character = closest_sym;
|
||||||
characters[x + y * args.width].bg = closest_color & 0xF;
|
characters[x + y * args.width].bg = closest_color & 0xF;
|
||||||
characters[x + y * args.width].fg = closest_color >> 4;
|
characters[x + y * args.width].fg = closest_color >> 4;
|
||||||
|
@ -584,7 +581,7 @@ struct image_pal *image_quantize(struct image *original, const union color *colo
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
float get_color_difference(union color a, union color b) {
|
int get_color_difference(union color a, union color b) {
|
||||||
int dr = a.rgba.r - b.rgba.r,
|
int dr = a.rgba.r - b.rgba.r,
|
||||||
dg = a.rgba.g - b.rgba.g,
|
dg = a.rgba.g - b.rgba.g,
|
||||||
db = a.rgba.b - b.rgba.b;
|
db = a.rgba.b - b.rgba.b;
|
||||||
|
|
Loading…
Reference in New Issue