Fixed it! Now it works fine

This commit is contained in:
Casey 2024-10-02 07:22:53 +03:00
parent 1e364fe3ea
commit d511cc407e
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 4 additions and 4 deletions

View File

@ -257,7 +257,7 @@ int main(int argc, char **argv) {
for (int oy = 0; oy < 3; oy++) {
for (int ox = 0; ox < 2; ox++) {
unsigned char pix = quantized_image->pixels[ox + (x + (y * 3 + oy)) * 2];
unsigned char pix = quantized_image->pixels[ox + (x + (y * 3 + oy) * args.width) * 2];
float brightness = get_color_brightness(palette[pix]);
if (brightness >= brightest_diff) {
brightest_i = pix;
@ -275,7 +275,7 @@ int main(int argc, char **argv) {
for (int oy = 0; oy < 3; oy++) {
for (int ox = 0; ox < 2; ox++) {
if (ox == 1 && oy == 2) continue;
unsigned char pix = quantized_image->pixels[ox + (x + (y * 3 + oy)) * 2];
unsigned char pix = quantized_image->pixels[ox + (x + (y * 3 + oy) * args.width) * 2];
float diff_bg = get_color_difference(palette[darkest_i], palette[pix]);
float diff_fg = get_color_difference(palette[brightest_i], palette[pix]);
if (diff_fg < diff_bg) {
@ -285,10 +285,10 @@ int main(int argc, char **argv) {
}
{
unsigned char pix = quantized_image->pixels[1 + (x + (y * 3 + 2)) * 2];
unsigned char pix = quantized_image->pixels[1 + (x + (y * 3 + 2) * args.width) * 2];
float diff_bg = get_color_difference(palette[darkest_i], palette[pix]);
float diff_fg = get_color_difference(palette[brightest_i], palette[pix]);
if (diff_fg > diff_bg) {
if (diff_fg < diff_bg) {
bitmap ^= 31;
unsigned char tmp = darkest_i;
darkest_i = brightest_i;