merge: 样张 v3.2——墙顶面色统一观感修复+E 格立面三档对比(55/80/100)
This commit is contained in:
commit
3a28fe07af
1 file changed
+26
-4
@@ -560,11 +560,13 @@ def draw_hero_on_board(board, ox, oy, cell, hx, hy, records, digit=None):
|
|||||||
records.append(("hero", hx, hy, fx, fy, digit))
|
records.append(("hero", hx, hy, fx, fy, digit))
|
||||||
|
|
||||||
|
|
||||||
|
FACADE_FRAC = 0.55 # E 格立面占比(v3.2 档位候选:0.55/0.80/1.00 三档对比,用户挑档)
|
||||||
|
|
||||||
def draw_facade(board, x0, y0, cell):
|
def draw_facade(board, x0, y0, cell):
|
||||||
"""v3.1 高墙立面(用户方案:地面格南邻墙 → 南部承接墙面展示,E 格)。
|
"""v3.1 高墙立面(用户方案:地面格南邻墙 → 南部承接墙面展示,E 格)。
|
||||||
南 45% 画墙身:横层理暗砖+口沿高光顶线(与墙顶分界);程序化示意,终稿=E 瓦片素材(词表扩展)。"""
|
南部画墙身:横层理暗砖+檐口阴线;程序化示意,终稿=E 瓦片素材(词表扩展)。"""
|
||||||
d = ImageDraw.Draw(board)
|
d = ImageDraw.Draw(board)
|
||||||
fy0 = y0 + int(cell * 0.45) # 立面占南 55%(高墙感档,目检候选)
|
fy0 = y0 + int(cell * (1.0 - FACADE_FRAC))
|
||||||
# 立面基色=墙顶瓦片实测色(E 与南侧墙顶须读作同一堵墙——采样 center 瓦片顶面区)
|
# 立面基色=墙顶瓦片实测色(E 与南侧墙顶须读作同一堵墙——采样 center 瓦片顶面区)
|
||||||
top = WALLS["center"].convert("RGB").crop((4, 4, 28, 14))
|
top = WALLS["center"].convert("RGB").crop((4, 4, 28, 14))
|
||||||
px = list(top.getdata())
|
px = list(top.getdata())
|
||||||
@@ -572,7 +574,7 @@ def draw_facade(board, x0, y0, cell):
|
|||||||
face = _gd_darkened(wall_top_rgb, 0.16) # 北立面=受光面,略暗于顶面 16% 分层
|
face = _gd_darkened(wall_top_rgb, 0.16) # 北立面=受光面,略暗于顶面 16% 分层
|
||||||
d.rectangle([x0, fy0, x0 + cell, y0 + cell], fill=face)
|
d.rectangle([x0, fy0, x0 + cell, y0 + cell], fill=face)
|
||||||
for i in range(3): # 横层理(横条纹,禁竖条纹栅栏感——§3.2 高墙条)
|
for i in range(3): # 横层理(横条纹,禁竖条纹栅栏感——§3.2 高墙条)
|
||||||
ly = fy0 + int((i + 1) * (cell - int(cell * 0.45)) / 4.0)
|
ly = fy0 + int((i + 1) * (cell * FACADE_FRAC) / 4.0)
|
||||||
d.line([(x0 + 2, ly), (x0 + cell - 2, ly)], fill=_gd_darkened(face, 0.30), width=1)
|
d.line([(x0 + 2, ly), (x0 + cell - 2, ly)], fill=_gd_darkened(face, 0.30), width=1)
|
||||||
for i in range(2): # 层理错缝竖短线(砖缝)
|
for i in range(2): # 层理错缝竖短线(砖缝)
|
||||||
for j in range(3):
|
for j in range(3):
|
||||||
@@ -588,6 +590,23 @@ def is_facade_cell(gmap, x, y):
|
|||||||
return (0 <= y + 1 < gmap.h) and gmap.grid[y][x] != "W" and gmap.grid[y + 1][x] == "W"
|
return (0 <= y + 1 < gmap.h) and gmap.grid[y][x] != "W" and gmap.grid[y + 1][x] == "W"
|
||||||
|
|
||||||
|
|
||||||
|
def lift_south_lip(tile):
|
||||||
|
"""v3.2:南向墙格(南邻地)瓦片底部 ~40% 立面暗条提亮——(56,45,39) 极暗拉低整格观感,
|
||||||
|
用户指「墙顶面应同色」:顶面本同色(147≈145),观感差系暗条过暗。背光面仍暗于顶面,但不死黑。
|
||||||
|
程序化示意,终稿归瓦片重产(§8.5)。"""
|
||||||
|
im = tile.convert("RGB")
|
||||||
|
w, h = im.size
|
||||||
|
y0 = int(h * 0.60)
|
||||||
|
band = im.crop((0, y0, w, h))
|
||||||
|
lut = [min(255, int(i * 1.75 + 18)) for i in range(256)]
|
||||||
|
band = band.point(lut * 3)
|
||||||
|
out = im.copy()
|
||||||
|
out.paste(band, (0, y0))
|
||||||
|
if tile.mode == "RGBA":
|
||||||
|
out.putalpha(tile.split()[3])
|
||||||
|
return out.convert("RGBA")
|
||||||
|
|
||||||
|
|
||||||
def render_board(gmap, cell, overlays=None, scale_note=""):
|
def render_board(gmap, cell, overlays=None, scale_note=""):
|
||||||
"""按方案甲查表拼装渲染样张板。返回 (img, placement, glow_layer)。"""
|
"""按方案甲查表拼装渲染样张板。返回 (img, placement, glow_layer)。"""
|
||||||
wpx, hpx = gmap.w * cell, gmap.h * cell
|
wpx, hpx = gmap.w * cell, gmap.h * cell
|
||||||
@@ -604,7 +623,10 @@ def render_board(gmap, cell, overlays=None, scale_note=""):
|
|||||||
t = WALLS[kind]
|
t = WALLS[kind]
|
||||||
if flip:
|
if flip:
|
||||||
t = t.transpose(Image.FLIP_LEFT_RIGHT)
|
t = t.transpose(Image.FLIP_LEFT_RIGHT)
|
||||||
board.paste(t.resize((cell, cell), Image.NEAREST), (x * cell, y * cell))
|
t = t.resize((cell, cell), Image.NEAREST)
|
||||||
|
if overlays and not is_wall(gmap, x, y + 1): # v3.2 南向墙格立面提亮
|
||||||
|
t = lift_south_lip(t)
|
||||||
|
board.paste(t, (x * cell, y * cell))
|
||||||
placement[(x, y)] = (kind, flip)
|
placement[(x, y)] = (kind, flip)
|
||||||
else:
|
else:
|
||||||
vi = floor_variant(x, y)
|
vi = floor_variant(x, y)
|
||||||
|
|||||||
Reference in new issue
Block a user