mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-28 17:19:17 +01:00
[ansi-print] Fix color calculation
Still something's wrong.
This commit is contained in:
1 parent
1abec5cd0d
commit
a4db80ca0a
1 file changed
+2
-2
+2
-2
@@ -196,10 +196,10 @@ struct biimage_t
|
||||
color_t bgc = color_t::from_ansi (bg);
|
||||
color_t fgc = color_t::from_ansi (fg);
|
||||
color_diff_t diff = fgc.diff (bgc);
|
||||
int dd = diff.dot (diff);
|
||||
int dd = sqrt (diff.dot (diff));
|
||||
for (unsigned int y = 0; y < height; y++)
|
||||
for (unsigned int x = 0; x < width; x++) {
|
||||
int d = diff.dot (image (x, y).diff (bgc));
|
||||
int d = sqrt (diff.dot (image (x, y).diff (bgc)));
|
||||
(*this)(x, y) = d < 0 ? 0 : d > dd ? 255 : lround (d * 255. / dd);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user