-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathdd055
More file actions
34 lines (27 loc) · 1.35 KB
/
dd055
File metadata and controls
34 lines (27 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
im = Image.new('RGB', (600, 250), (128, 128, 128))
draw = ImageDraw.Draw(im)
draw.arc((25, 50, 175, 200), start=30, end=270, fill=(255, 255, 0))
draw.chord((225, 50, 375, 200), start=30, end=270, fill=(255, 255, 0), outline=(0, 0, 0))
draw.pieslice((425, 50, 575, 200), start=30, end=270, fill=(255, 255, 0), outline=(0, 0, 0))
!wget https://1.bp.blogspot.com/!wget h-mydFVP9S3nA/XkZdIlKHS6I/AAAAAAABXUE/L72vQ9kOY2M6B-WR8fE5XHiPzjiSc1r3wCNcBGAsYHQ/s1600/nigaoe_john_fleming.png
class AImage(AShape):
color: any
def __init__(self, width=100, height=None, cx=None, cy=None, image='nigaoe_john_fleming.png'):
AShape.__init__(self, width, height, cx, cy)
if image.startswith('http'):
# URLから直接読み込む
self.pic = Image.open(io.BytesIO(requests.get(image).content))
else:
self.pic = Image.open(image)
def render(self, canvas: ACanvas, frame: int):
ox, oy, w, h = self.bounds()
pic = self.pic.resize((int(w), int(h)))
canvas.image.paste(pic, (int(ox), int(oy)), pic)
IPython.display.Image(test_shape(AImage(image='nigaoe_john_fleming.png')))
studio = AStudio()
shape = RollingPolygon(width=250, N=8)
studio.append(shape)
studio.append(AImage(width=250, image='nigaoe_john_fleming.png'))
for i in range(60):
studio.render()
IPython.display.Image(studio.create_anime())