vectors draw lib, update: add fast render & Refactor code
Project description
vectors-draw-lib or pyvdl
request
matplotlib
Pillow
numpy
cv2
Docs
install:
pip install pyvdl matplotlib opencv-python numpy
init:
import pyvdl as vl
print(f'install pyvdl: {vl.__version__}')
create_obj:
class example(vl.obj):
def __init__(self):
self.color = (255, 255, 255)
def render(self, x, y):
return self.abs_(x, y) - 20 < 0
create_animation:
class p(vl.animation):
def __init__(self):
self.size = (500, 500)
self.form = lambda x : x
self.t = 5
self.obj_ = example()
render:
# obj
obj = example()
r = vl.render(obj)
vl.show(r) # show render-obj: r, only works on pykernel
vl.save("test.png", r) # save render-obj: r as "test.png"
# animation
animate = p()
animate.render()
animate.video("animation.avi") # filename.avi
Fast-mode:
# create
def rend(x, y):
i = x if x > 0 else -x
j = y if y > 0 else -y
return (i+j)//2
r = vl.fastRender(f, 250, 250)() # syntax: vl.fastRender(func, width, heigth, x=0, y=0)()
r = vl.toRgb(r)
vl.show(r) # show render-obj: r, only works on pykernel
vl.save("test.png", r) # save render-obj: r as "test.png"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyvdl-0.0.5.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pyvdl-0.0.5-py3-none-any.whl
(5.9 kB
view details)
File details
Details for the file pyvdl-0.0.5.tar.gz.
File metadata
- Download URL: pyvdl-0.0.5.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
745401f68a29aa02f97da6fba83edbbfbb6dbbc68ff9a3cefe841dabf1bf4e39
|
|
| MD5 |
eefbd5f73be68ce058b0cd8e68379493
|
|
| BLAKE2b-256 |
15c08fdb2a8c0a136fa8f36ee70e6b3ce16363cb6eebb4caa252c1fc3e0c4367
|
File details
Details for the file pyvdl-0.0.5-py3-none-any.whl.
File metadata
- Download URL: pyvdl-0.0.5-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17ee3d887ba9284dbe713f0f5cf1757ba856de6d05f74c85b52bb72fc548b29e
|
|
| MD5 |
798466b9fc8fd2eda6aa475dcd8f89cb
|
|
| BLAKE2b-256 |
386128f7bbc87c025144a842f14f72f5cfc6d359e5959aabc3917a7eeae3283b
|