summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-25 20:29:35 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-25 20:29:35 +0100
commite40b57498dd2871a64759d180a6a37327a6bf543 (patch)
treec6be7869876586a732daed884488926de7df23d4
parent833166c3bf25513e977d85b050e3c985bb7465b5 (diff)
Render point grid as background 🌐
-rw-r--r--tests/render.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/render.py b/tests/render.py
index 98b45972..1c2cf7c4 100644
--- a/tests/render.py
+++ b/tests/render.py
@@ -2,6 +2,7 @@ import sys
import os
import pathlib
import math
+import numpy
from PIL import Image, ImageDraw, ImageFont
@@ -102,6 +103,13 @@ class BoxRenderer:
self.draw = ImageDraw.Draw(self.img)
self.cursor = (0, 0)
+ pixels = numpy.array(self.img)
+ for i in range(0, int(height)):
+ for j in range(0 if i % 2 == 0 else 1, int(width), 2):
+ pixels[4*i:4*(i+1), 4*j:4*(j+1)] = (200, 200, 200, 255)
+
+ self.img = Image.fromarray(pixels)
+
self.colors = [
(176, 264, 158),
(274, 173, 207),
@@ -167,7 +175,7 @@ class BoxRenderer:
def pix(points):
- return int(2 * points)
+ return int(4 * points)
def overlap(a, b):
return (a[0] < b[2] and b[0] < a[2]) and (a[1] < b[3] and b[1] < a[3])