Implement hatched fill areas

This commit is contained in:
XANTRONIX 2025-03-26 15:25:28 -04:00
parent eebb897f89
commit 8ebd1143be

View file

@ -517,11 +517,18 @@ class SPCOutlookMap(EquirectMap):
def __init__(self): def __init__(self):
super().__init__(*MAP_SCREEN_DIMENSIONS, MAP_BOUNDS) 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): def draw_logo(self, cr: cairo.Context, path: str):
cr.save() cr.save()
width = self.LOGO_WIDTH width = self.LOGO_WIDTH
height = self.LOGO_HEIGHT height = width * self.LOGO_RATIO
margin = self.LOGO_MARGIN margin = self.LOGO_MARGIN
x = margin x = margin
@ -574,7 +581,16 @@ class SPCOutlookMap(EquirectMap):
r, g, b = self.__probability_colors__[probability.probability] 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) cr.set_source_rgba(r, g, b, 0.35)
self.draw_polygon(cr, probability.poly) self.draw_polygon(cr, probability.poly)
cr.fill() cr.fill()