Initial commit of py/hexagram/icons.py

This commit is contained in:
XANTRONIX Development 2024-01-03 20:04:55 -05:00
parent 2f0334b8c5
commit d410fa3eda

30
py/hexagram/icons.py Normal file
View file

@ -0,0 +1,30 @@
import cairo
import gi
gi.require_version('Rsvg', '2.0')
from gi.repository import Rsvg
def to_surface(path: str, width: float, height: float, style: str) -> cairo.Surface:
surface = cairo.RecordingSurface(cairo.CONTENT_ALPHA,
cairo.Rectangle(0, 0, width, height))
cr = cairo.Context(surface)
rect = Rsvg.Rectangle()
rect.x = 0
rect.y = 0
rect.width = width
rect.height = height
svg = Rsvg.Handle.new_from_file(path)
svg.set_stylesheet(bytes(style, 'utf8'))
svg.render_layer(cr, None, rect)
return surface
class ISO7000():
__icons__ = dict()
def __init__(self):
pass