Distribute extra pixels among all eight-blocks rather than adding them all to the last block
Makes one block stand out less, every block is now at most a pixel in size different from every other block. Fixes #3097
This commit is contained in:
parent
c830097511
commit
ef596f6a8b
@ -4,6 +4,13 @@ Changelog
|
|||||||
|kitty| is a feature full, cross-platform, *fast*, GPU based terminal emulator.
|
|kitty| is a feature full, cross-platform, *fast*, GPU based terminal emulator.
|
||||||
To update |kitty|, :doc:`follow the instructions <binary>`.
|
To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||||
|
|
||||||
|
0.19.3 [future]
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Distribute extra pixels among all eight-blocks rather than adding them
|
||||||
|
all to the last block (:iss:`3097`)
|
||||||
|
|
||||||
|
|
||||||
0.19.2 [2020-11-13]
|
0.19.2 [2020-11-13]
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
|||||||
@ -663,17 +663,32 @@ def smooth_mosaic(
|
|||||||
buf[offset + x] = 255
|
buf[offset + x] = 255
|
||||||
|
|
||||||
|
|
||||||
|
def eight_range(size: int, which: int) -> range:
|
||||||
|
thickness = max(1, size // 8)
|
||||||
|
block = thickness * 8
|
||||||
|
if block == size:
|
||||||
|
return range(thickness * which, thickness * (which + 1))
|
||||||
|
if block > size:
|
||||||
|
start = min(which * thickness, size - thickness)
|
||||||
|
return range(start, start + thickness)
|
||||||
|
extra = size - block
|
||||||
|
thicknesses = list(repeat(thickness, 8))
|
||||||
|
for i in (3, 4, 2, 5, 6, 1, 7, 0):
|
||||||
|
if not extra:
|
||||||
|
break
|
||||||
|
extra -= 1
|
||||||
|
thicknesses[i] += 1
|
||||||
|
pos = sum(thicknesses[:which])
|
||||||
|
return range(pos, pos + thicknesses[which])
|
||||||
|
|
||||||
|
|
||||||
def eight_bar(buf: BufType, width: int, height: int, level: int = 1, which: int = 0, horizontal: bool = False) -> None:
|
def eight_bar(buf: BufType, width: int, height: int, level: int = 1, which: int = 0, horizontal: bool = False) -> None:
|
||||||
if horizontal:
|
if horizontal:
|
||||||
x_range = range(0, width)
|
x_range = range(0, width)
|
||||||
thickness = max(1, height // 8)
|
y_range = eight_range(height, which)
|
||||||
y_start = min(which * thickness, height - 2)
|
|
||||||
y_range = range(y_start, height if which == 7 else min(y_start + thickness, height))
|
|
||||||
else:
|
else:
|
||||||
y_range = range(0, height)
|
y_range = range(0, height)
|
||||||
thickness = max(1, width // 8)
|
x_range = eight_range(width, which)
|
||||||
x_start = min(which * thickness, width - 2)
|
|
||||||
x_range = range(x_start, width if which == 7 else min(x_start + thickness, width))
|
|
||||||
for y in y_range:
|
for y in y_range:
|
||||||
offset = y * width
|
offset = y * width
|
||||||
for x in x_range:
|
for x in x_range:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user