adjusted block/color to changes on master

This commit is contained in:
Jan Kuhlmann 2025-01-15 11:19:31 +01:00
parent 95b2f7aad0
commit cf7b07a881

View File

@ -874,18 +874,20 @@ namespace graphs
for (size_t x = 0; x < options.width; x++) { for (size_t x = 0; x < options.width; x++) {
const size_t index = x + y * options.width; const size_t index = x + y * options.width;
const auto& frag = texture[index]; const auto& frag = texture[index];
// draw Fragment // begin color draw(
cout << colors[frag.color.col_4]; cout << outputcolor(frag.color.col_4);
// draw character
switch (options.character_set) { switch (options.character_set) {
case type_braille: case type_braille:
cout << dots[frag.data]; cout << dots[frag.data];
break; break;
case type_block: case type_block_quadrant:
cout << blocks[frag.data]; cout << blocks_quadrant[frag.data];
break; break;
default: break; default: break;
} }
cout << colors[0]; // reset color (TODO: could be optimized to only reset when color changes)
cout << outputcolor(color_type::color_default);
} }
cout << '\n'; cout << '\n';
} }
@ -924,7 +926,7 @@ namespace graphs
char_width = 2; char_width = 2;
char_height = 4; char_height = 4;
break; break;
case type_block: case type_block_quadrant:
char_width = 2; char_width = 2;
char_height = 2; char_height = 2;
break; break;
@ -940,12 +942,13 @@ namespace graphs
intermediate.texture[index].color = color; // TODO: mix color here intermediate.texture[index].color = color; // TODO: mix color here
uint8_t value = 0; uint8_t value = 0;
// TODO: put this in separate function to reuse in other plot funcs
switch (options.character_set) { switch (options.character_set) {
case type_braille: case type_braille:
value = dotvalues[x_sub][y_sub]; value = dotvalues[x_sub][y_sub];
break; break;
case type_block: case type_block_quadrant:
value = blockvalues[x_sub][y_sub]; value = 1 << (x_sub + y_sub * char_width);
break; break;
default: break; default: break;
} }