forked from Decentrala/website
		
	add mesh
This commit is contained in:
		@@ -7,6 +7,7 @@ from PIL import Image, ImageDraw, ImageFont
 | 
				
			|||||||
import csv
 | 
					import csv
 | 
				
			||||||
import datetime as dt
 | 
					import datetime as dt
 | 
				
			||||||
from dateutil import relativedelta
 | 
					from dateutil import relativedelta
 | 
				
			||||||
 | 
					from cairosvg import svg2png
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CURRENT_TIME = dt.date.today()
 | 
					CURRENT_TIME = dt.date.today()
 | 
				
			||||||
NEXT_MONTH = CURRENT_TIME + relativedelta.relativedelta(months=1, day=1)
 | 
					NEXT_MONTH = CURRENT_TIME + relativedelta.relativedelta(months=1, day=1)
 | 
				
			||||||
@@ -93,7 +94,7 @@ def drawPoster(events, bg, fg, month:int):
 | 
				
			|||||||
        r = 50
 | 
					        r = 50
 | 
				
			||||||
        draw.ellipse((x - r, y - r, x + r, y+r), fill=fg, outline=(0, 0, 0), width=0)
 | 
					        draw.ellipse((x - r, y - r, x + r, y+r), fill=fg, outline=(0, 0, 0), width=0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    LCX = 3100 # logo center x
 | 
					    LCX = 415 # logo center x
 | 
				
			||||||
    LCY = 4350 # logo center y
 | 
					    LCY = 4350 # logo center y
 | 
				
			||||||
    d = 190 # delta
 | 
					    d = 190 # delta
 | 
				
			||||||
    drawCircle(LCX - d, LCY)
 | 
					    drawCircle(LCX - d, LCY)
 | 
				
			||||||
@@ -106,6 +107,20 @@ def drawPoster(events, bg, fg, month:int):
 | 
				
			|||||||
    draw.line([(LCX, LCY), (LCX, LCY + d), (LCX + d, LCY), (LCX, LCY - d)], fill=fg, width=20, joint=None)
 | 
					    draw.line([(LCX, LCY), (LCX, LCY + d), (LCX + d, LCY), (LCX, LCY - d)], fill=fg, width=20, joint=None)
 | 
				
			||||||
    draw.text((LCX - 1.7*d, LCY + 1.5*d), "dmz.rs", font=fontIosevka, fill=fg)
 | 
					    draw.text((LCX - 1.7*d, LCY + 1.5*d), "dmz.rs", font=fontIosevka, fill=fg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if bg == (255,255,255):
 | 
				
			||||||
 | 
					        mesh_svg = svg2png(url='site/img/mesh-light.svg')
 | 
				
			||||||
 | 
					    if bg == (0,0,0):
 | 
				
			||||||
 | 
					        mesh_svg = svg2png(url='site/img/mesh-dark.svg')
 | 
				
			||||||
 | 
					    mesh_svg_bytes = io.BytesIO(mesh_svg)
 | 
				
			||||||
 | 
					    mesh_img = Image.open(mesh_svg_bytes)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mesh_img = mesh_img.resize((W,H))
 | 
				
			||||||
 | 
					    mesh_img.thumbnail((W,H), Image.Resampling.LANCZOS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mesh_w, mesh_h = mesh_img.size
 | 
				
			||||||
 | 
					    mesh_position = (W - mesh_w, H - mesh_h)
 | 
				
			||||||
 | 
					    img.paste(mesh_img, mesh_position, mesh_img)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return img
 | 
					    return img
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user