add webshot module

This commit is contained in:
Ace
2023-11-21 20:16:10 +01:00
parent e093a13477
commit f0cb8528b8
6 changed files with 277 additions and 45 deletions

View File

@@ -1,5 +1,3 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Inkycal custom-functions for ease-of-use
@@ -11,7 +9,7 @@ import time
import traceback
import requests
from PIL import Image, ImageDraw, ImageFont
from PIL import ImageFont
logs = logging.getLogger(__name__)
logs.setLevel(level=logging.INFO)
@@ -279,6 +277,7 @@ def internet_available():
from PIL import Image, ImageDraw
def draw_dotted_line(draw, start, end, colour, thickness):
"""Draws a dotted line between start and end points using dots."""
delta_x = end[0] - start[0]
@@ -292,7 +291,8 @@ def draw_dotted_line(draw, start, end, colour, thickness):
# Drawing a circle at each dot position to create a dotted effect
draw.ellipse([(dot_position[0] - thickness, dot_position[1] - thickness),
(dot_position[0] + thickness, dot_position[1] + thickness)],
fill=colour)
fill=colour)
def draw_dashed_line(draw, start, end, colour, thickness):
"""Draws a dashed line between start and end points."""
@@ -309,6 +309,7 @@ def draw_dashed_line(draw, start, end, colour, thickness):
segment_start[1] + (step_size * delta_y / distance))
draw.line((segment_start, segment_end), fill=colour, width=thickness)
def draw_border(image, xy, size, radius=5, thickness=1, shrinkage=(0.1, 0.1), style='solid'):
"""
Draws a border at given coordinates with specified styles (solid, dotted, dashed).