scenefx
scenefx copied to clipboard
feat: add gradients to scene_rect
Relatively rough for now... Will likely need to clean up rect rendering as a follow-up, so much shared logic between the rounded vs non rounded vs gradient vs solid color
should probably add an assertion for gradient count
an idea... we could treat all rects as having a gradient but only with one color in it if it is solid color
an idea... we could treat all rects as having a gradient but only with one color in it if it is solid color
Yeah I was just thinking that!! :D
bug with blending and conic gradient:
/* Add a bottom rect to demonstrate optimized blur */
float bottom_rect_color[16] = { 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1 };
struct wlr_scene_rect *bottom_rect = wlr_scene_rect_create(server.layers.bottom_layer,
200, 200, bottom_rect_color);
wlr_scene_rect_set_gradient(
bottom_rect,
(struct gradient) {
.degree = 0.0,
.range = (struct wlr_box) {
.x = 0,
.y = 0,
.width = 200,
.height = 200,
},
.origin = { 0.5, 0.5 },
.is_linear = false,
.should_blend = true,
.count = 3,
.colors = bottom_rect_color,
}
);