Skip to content

feat: add gradients to scene_rect#102

Draft
WillPower3309 wants to merge 5 commits into
mainfrom
scene_grad
Draft

feat: add gradients to scene_rect#102
WillPower3309 wants to merge 5 commits into
mainfrom
scene_grad

Conversation

@WillPower3309
Copy link
Copy Markdown
Member

@WillPower3309 WillPower3309 commented Feb 10, 2025

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 WillPower3309 marked this pull request as draft February 10, 2025 23:40
@WillPower3309
Copy link
Copy Markdown
Member Author

should probably add an assertion for gradient count

@WillPower3309
Copy link
Copy Markdown
Member Author

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

@ErikReider
Copy link
Copy Markdown
Member

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

@WillPower3309
Copy link
Copy Markdown
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants