From 8ebd1143be2fcc544660ff7735607915c3619eb4 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Wed, 26 Mar 2025 15:25:28 -0400 Subject: [PATCH] Implement hatched fill areas --- lib/xmet/spc.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/xmet/spc.py b/lib/xmet/spc.py index 3fe8ab7..4022479 100644 --- a/lib/xmet/spc.py +++ b/lib/xmet/spc.py @@ -517,11 +517,18 @@ class SPCOutlookMap(EquirectMap): def __init__(self): super().__init__(*MAP_SCREEN_DIMENSIONS, MAP_BOUNDS) + self.hatched_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 8, 8) + + cr = cairo.Context(self.hatched_surface) + cr.move_to(0, 0) + cr.line_to(7, 7) + cr.stroke() + def draw_logo(self, cr: cairo.Context, path: str): cr.save() width = self.LOGO_WIDTH - height = self.LOGO_HEIGHT + height = width * self.LOGO_RATIO margin = self.LOGO_MARGIN x = margin @@ -574,7 +581,16 @@ class SPCOutlookMap(EquirectMap): r, g, b = self.__probability_colors__[probability.probability] - if not probability.sig: + if probability.sig: + cr.set_source_surface(self.hatched_surface, 0, 0) + + source = cr.get_source() + source.set_extend(cairo.EXTEND_REPEAT) + + self.draw_polygon(cr, probability.poly) + + cr.fill() + else: cr.set_source_rgba(r, g, b, 0.35) self.draw_polygon(cr, probability.poly) cr.fill()