Felix Pankratz 3 years ago
parent daa9099997
commit 611fb2f9ae

@ -6,6 +6,7 @@ import random
import threading
import time
import socket
import colorsys
from utils import circle_fill
from utils import random_color
#from pixelflut import surface_to_pixelflut
@ -20,6 +21,8 @@ hitmap = list()
DRAW_MAP = None
start_hue = random.uniform(0, 1)
SERVER_IP = '192.168.178.75'
#SERVER_IP = '127.0.0.1'
SERVER_PORT = 1234
@ -35,6 +38,8 @@ def surface_to_pixelflut():
pixels = data.hex()
x, y = 0, 0
#to_send = list()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
# for chunk in chunker(pixels, 65536):
pxstr = ''
for hexpx in chunker(pixels, 8):
if x > 1919:
@ -45,11 +50,10 @@ def surface_to_pixelflut():
continue
pxstr += f'PX {x} {y} {hexpx[:6]}\n'
#to_send.append(pxstr)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((SERVER_IP, SERVER_PORT))
print('!! socket opened !!')
#for px in to_send:
# s.sendall(px.encode())
print('!! socket opened !!')
s.connect((SERVER_IP, SERVER_PORT))
s.sendall(pxstr.encode())
#print(f'sent {pxstr}')
print('!! transmission to pixelflut finished !!')
@ -185,6 +189,9 @@ def main():
# start_x = random.uniform(0.2, 0.8)
# start_y = random.uniform(0.2, 0.8)
start_r = 0.01
r, g, b = colorsys.hsv_to_rgb(start_hue, 1.0, 1.0)
#r, g, b = random_color()
ctx.set_source_rgb(r, g, b)
# start_angle = random.randint(0, 360)
# branches.append(Branch(b, ctx, start_x, start_y, start_r, start_angle))
branches.append(Branch(0, ctx, 0.5, 0.4, start_r, 180))
@ -206,7 +213,8 @@ def main():
for x in range(8):
if subs == None:
return
r, g, b = random_color()
r, g, b = colorsys.hsv_to_rgb(start_hue + x * 0.05, 1.0, 1.0)
#r, g, b = random_color()
ctx.set_source_rgb(r, g, b)
subs = grow_subs(ctx, subs, branches)

Loading…
Cancel
Save