From da424486efaabc02e70a58d7bae17f451d00f707 Mon Sep 17 00:00:00 2001 From: poire-z Date: Sun, 8 Oct 2023 17:51:33 +0200 Subject: [PATCH] FrameContainer: allow for hatched background or overlay Bump base for BlitBuffer:hatchRect(). base bump also includes: - Update to HarfBuzz 8.2.1 - tests and ci updates --- base | 2 +- .../ui/widget/container/framecontainer.lua | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/base b/base index 4733fa06a..f56d882d4 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 4733fa06a48beb30d5e70b31358e9e537d87eca4 +Subproject commit f56d882d4baf784fe061c9eedd3f74540bfcd490 diff --git a/frontend/ui/widget/container/framecontainer.lua b/frontend/ui/widget/container/framecontainer.lua index 4f57ab6e5..7a3da23c8 100644 --- a/frontend/ui/widget/container/framecontainer.lua +++ b/frontend/ui/widget/container/framecontainer.lua @@ -43,6 +43,11 @@ local FrameContainer = WidgetContainer:extend{ focusable = false, focus_border_size = Size.border.window * 2, focus_border_color = Blitbuffer.COLOR_BLACK, + -- paint hatched background if provided + stripe_color = nil, + stripe_width = nil, + stripe_over = nil, -- draw stripes *after* content is drawn + stripe_over_alpha = 1, } function FrameContainer:getSize() @@ -107,6 +112,12 @@ function FrameContainer:paintTo(bb, x, y) container_width, container_height, self.background, self.radius) end + if self.stripe_width and self.stripe_color and not self.stripe_over then + -- (No support for radius when hatched/stripe) + bb:hatchRect(x, y, + container_width, container_height, + self.stripe_width, self.stripe_color) + end if self.inner_bordersize > 0 then --- @warning This doesn't actually support radius, it'll always be a square. bb:paintInnerBorder(x + self.margin, y + self.margin, @@ -125,6 +136,14 @@ function FrameContainer:paintTo(bb, x, y) x + self.margin + self.bordersize + self._padding_left + shift_x, y + self.margin + self.bordersize + self._padding_top) end + if self.stripe_width and self.stripe_color and self.stripe_over then + -- (No support for radius when hatched/stripe) + -- We don't want to draw the stripes over any border + local pad = self.margin + math.max(self.bordersize, self.inner_bordersize) + bb:hatchRect(x + pad, y + pad, + container_width - pad * 2, container_height - pad * 2, + self.stripe_width, self.stripe_color, self.stripe_over_alpha) + end if self.invert then bb:invertRect(x + self.bordersize, y + self.bordersize, container_width - 2*self.bordersize,