PNGRendor 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PNGRendor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: use this to render pngs and other
|
|
5
|
+
Author: egor203983
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Description-Content-Type: text/plain
|
|
9
|
+
Requires-Dist: pygame
|
|
10
|
+
Dynamic: author
|
|
11
|
+
Dynamic: classifier
|
|
12
|
+
Dynamic: description
|
|
13
|
+
Dynamic: description-content-type
|
|
14
|
+
Dynamic: requires-dist
|
|
15
|
+
Dynamic: summary
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
example:
|
|
19
|
+
import PNGRendor
|
|
20
|
+
PNG = inprintator(path)
|
|
21
|
+
PNG.renderPNG(sx, sy, x, y, angle)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
rendor.py,sha256=gzXjSueiXCWNxFoAmmhOW7urDlBKprNqXa9GVxxs9p4,873
|
|
2
|
+
pngrendor-0.1.0.dist-info/METADATA,sha256=cibMZUy5kcDs1VdnbnE9gV8RkSr7B6OPSveuPNyXh8w,512
|
|
3
|
+
pngrendor-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
4
|
+
pngrendor-0.1.0.dist-info/top_level.txt,sha256=yRzvUECCfEj5G9TwuiWdX8N2N7WQINHba6vrrNp2I4M,7
|
|
5
|
+
pngrendor-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rendor
|
rendor.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import pygame
|
|
2
|
+
|
|
3
|
+
screen = pygame.display.get_surface()
|
|
4
|
+
class inprintator:
|
|
5
|
+
def __init__(self, path):
|
|
6
|
+
self.img = pygame.image.load(path).convert_alpha()
|
|
7
|
+
def renderPNG(self, sx, sy, x, y, angle):
|
|
8
|
+
imgs = pygame.transform.scale(self.img, (sx, sy))
|
|
9
|
+
imgsr = pygame.transform.rotate(imgs, angle)
|
|
10
|
+
nw, nh = imgsr.get_size()
|
|
11
|
+
corectx = x - (nw - sx) / 2
|
|
12
|
+
corecty = y - (nh - sy) / 2
|
|
13
|
+
screen.blit(imgsr, (corectx, corecty))
|
|
14
|
+
def renFramedPNG(self, framnmb, cols, rows, sx, sy, x, y):
|
|
15
|
+
nw, nh = self.img.get_size()
|
|
16
|
+
fnw = nw // cols
|
|
17
|
+
fnh = nh // rows
|
|
18
|
+
col = framnmb % cols
|
|
19
|
+
row = framnmb // cols
|
|
20
|
+
framosurfaco = self.img.subsurface((col * fnw, row * fnh, fnw, fnh))
|
|
21
|
+
imgs = pygame.transform.scale(framosurfaco, (sx, sy))
|
|
22
|
+
screen.blit(imgs, (x, y))
|