hcra/server/imgproc.py
Samuel Sloniker 8ea09771e8
Big refactor (#20)
* First step of server redesign

Only thing left is to re-add disconnect handling

* Convert client to use img

Removing the tiling feature allowed me to switch the client to use img
instead of canvas.

* Rename "canvas" to "img"

"canvas" isn't a good variable name for an <img> element

* Handle disconnects (again)

I had removed disconnect handling when I started the partial rewrite.
This commit re-adds it.

* Remove obsolete code

* Change dependency to websocket-server in requirements.txt

* Fix Chrome click bug

This should fix the Chrome click bug.
2021-07-19 12:09:42 -07:00

19 lines
364 B
Python

import json
import threading
import os
import subprocess
def get_img():
bmp_path = backend.get_img()
subprocess.run(['convert', bmp_path, '-define', 'webp:lossless=true', 'img.webp',])
os.unlink(bmp_path)
return 'img.webp'
def touch(x, y, w, is_long):
x = round(800 * x / w)
y = round(800 * y / w)
backend.touch(x, y, is_long)