1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.
This commit is contained in:
parent
c3b032a45a
commit
0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions
19
tools/parity/measure.py
Normal file
19
tools/parity/measure.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"""Bounding boxes of near-white and near-black ink inside boxes, original vs ours.
|
||||
usage: measure.py ORIG_PNG OURS_BMP"""
|
||||
import sys
|
||||
from PIL import Image
|
||||
a = Image.open(sys.argv[1]).convert('RGB')
|
||||
if a.width == 1600: a = a.reduce(2)
|
||||
o = Image.open(sys.argv[2]).convert('RGB')
|
||||
def box(img, region, pred):
|
||||
x0, y0, x1, y1 = region; px = img.load()
|
||||
pts = [(x, y) for y in range(y0, y1) for x in range(x0, x1) if pred(px[x, y])]
|
||||
if not pts: return None
|
||||
xs = [p[0] for p in pts]; ys = [p[1] for p in pts]
|
||||
return (min(xs), min(ys), max(xs), max(ys), len(pts))
|
||||
white = lambda c: min(c) > 235
|
||||
dark = lambda c: max(c) < 40
|
||||
for name, r in [('Start Game', (290, 380, 520, 420)), ('Help', (205, 485, 300, 522)), ('High Scores', (330, 500, 490, 535)),
|
||||
('Options', (500, 485, 640, 522)), ('Save&Quit', (640, 445, 780, 480)), ('Copyright', (180, 578, 640, 600))]:
|
||||
print(f'{name:12s} white orig {box(a, r, white)} ours {box(o, r, white)}')
|
||||
print(f'{"":12s} dark orig {box(a, r, dark)} ours {box(o, r, dark)}')
|
||||
Loading…
Add table
Add a link
Reference in a new issue