From d410fa3edaa84acb931d02a8767eeb4ef628167e Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 3 Jan 2024 20:04:55 -0500 Subject: [PATCH] Initial commit of py/hexagram/icons.py --- py/hexagram/icons.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 py/hexagram/icons.py diff --git a/py/hexagram/icons.py b/py/hexagram/icons.py new file mode 100644 index 0000000..139d532 --- /dev/null +++ b/py/hexagram/icons.py @@ -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