scenefx icon indicating copy to clipboard operation
scenefx copied to clipboard

feat: add gradients to scene_rect

Open WillPower3309 opened this issue 9 months ago • 4 comments

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

WillPower3309 avatar Feb 10 '25 23:02 WillPower3309

should probably add an assertion for gradient count

WillPower3309 avatar Feb 10 '25 23:02 WillPower3309

an idea... we could treat all rects as having a gradient but only with one color in it if it is solid color

WillPower3309 avatar Feb 10 '25 23:02 WillPower3309

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

ErikReider avatar Feb 10 '25 23:02 ErikReider

bug with blending and conic gradient: 2025-11-03_00-11-1762146921

	/* 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,
		}
	);

WillPower3309 avatar Nov 03 '25 05:11 WillPower3309