Revert "Improve shade character appearance"

This reverts commit c883a024ba2a58533fb5bea021fe6b3d2dfb11a2.

To maximize compatibility with the appearance in the standard.
This commit is contained in:
MithicSpirit 2023-05-09 22:06:05 -04:00
parent c883a024ba
commit c247fe2336
No known key found for this signature in database
GPG Key ID: FEA8F724F2800E40

View File

@ -613,20 +613,22 @@ def inner_corner(buf: BufType, width: int, height: int, which: str = 'tl', level
draw_vline(buf, width, y1, y2, width // 2 + (xd * hgap), level) draw_vline(buf, width, y1, y2, width // 2 + (xd * hgap), level)
@supersampled()
def shade(buf: BufType, width: int, height: int, light: bool = False, invert: bool = False) -> None: def shade(buf: BufType, width: int, height: int, light: bool = False, invert: bool = False) -> None:
x_size = width / 4 square_sz = max(1, width // 12)
y_size = height / 8 number_of_rows = height // square_sz
pattern_segments = 4 if light else 2 number_of_cols = width // square_sz
for y in range(height): nums = range(square_sz)
y_segment = y / y_size
offset = y * width for r in range(number_of_rows):
for x in range(width): for c in range(number_of_cols):
segment = x/x_size + y_segment if invert ^ ((r % 2 != c % 2) or (light and r % 2 == 1)):
section = int(segment) % pattern_segments continue
enabled = section == 1 for yr in nums:
if invert ^ enabled: y = r * square_sz + yr
buf[offset + x] = 255 offset = width * y
for xc in nums:
x = c * square_sz + xc
buf[offset + x] = 255
def quad(buf: BufType, width: int, height: int, x: int = 0, y: int = 0) -> None: def quad(buf: BufType, width: int, height: int, x: int = 0, y: int = 0) -> None: