If uneven rows, make last one default background

For this to work, I had to turn the character upside-down, to be able to
have a foreground color in the first pixel row, and background color in
the second pixel row. So it's now an "unicode upper half block".
This commit is contained in:
Bob Polis 2024-01-30 13:04:26 +01:00
parent 4ac6eb96d8
commit 447b41fc3e

View File

@ -22,9 +22,13 @@ void write_image(std::ostream& os, FILE* in) {
} }
for (int x = 0; x < info.width; ++x) { for (int x = 0; x < info.width; ++x) {
if (info.depth == 3) { // assume RGB, 1 byte per sample if (info.depth == 3) { // assume RGB, 1 byte per sample
os << sc::io::truecolorb(t1[x][0], t1[x][1], t1[x][2]); os << sc::io::truecolorf(t1[x][0], t1[x][1], t1[x][2]);
os << sc::io::truecolorf(t2[x][0], t2[x][1], t2[x][2]); if (y < info.height - 1) {
os << u8"\u2584"; // unicode lower half block os << sc::io::truecolorb(t2[x][0], t2[x][1], t2[x][2]);
} else {
os << sc::io::defaultb;
}
os << u8"\u2580"; // unicode upper half block
} }
} }
os << sc::io::reset << '\n'; os << sc::io::reset << '\n';