summaryrefslogtreecommitdiff
path: root/include/scenefx/render
diff options
context:
space:
mode:
authorame <[email protected]>2024-10-09 17:04:13 -0500
committerame <[email protected]>2024-10-09 17:04:13 -0500
commitb2dd727499800306b89dad2275e600781ef3739f (patch)
tree57dc10dbe85f46ccc573f4eee2497be5ebc4ef6c /include/scenefx/render
parentf05626176636c49ba27c3ba2b69658f50c9b5730 (diff)
add gradient rect support
Diffstat (limited to 'include/scenefx/render')
-rw-r--r--include/scenefx/render/pass.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/include/scenefx/render/pass.h b/include/scenefx/render/pass.h
index d005c37..0f1d27c 100644
--- a/include/scenefx/render/pass.h
+++ b/include/scenefx/render/pass.h
@@ -27,6 +27,20 @@ struct fx_gles_render_pass *fx_renderer_begin_buffer_pass(struct wlr_renderer *w
struct wlr_buffer *wlr_buffer, struct wlr_output *output,
const struct wlr_buffer_pass_options *options);
+struct fx_gradient {
+ float degree;
+ /* The full area the gradient fit too, for borders use the window size */
+ struct wlr_box range;
+ /* The center of the gradient, {0.5, 0.5} for normal*/
+ float origin[2];
+ /* 1 = Linear, 2 = Conic */
+ int linear;
+ /* Whether or not to blend the colors */
+ int blend;
+ int count;
+ float *colors;
+};
+
struct fx_render_texture_options {
struct wlr_render_texture_options base;
const struct wlr_box *clip_box; // Used to clip csd. Ignored if NULL
@@ -42,6 +56,11 @@ struct fx_render_rect_options {
// TODO: Add effects here in the future
};
+struct fx_render_rect_grad_options {
+ struct wlr_render_rect_options base;
+ struct fx_gradient gradient;
+};
+
struct fx_render_box_shadow_options {
struct wlr_box shadow_box;
struct wlr_box clip_box;
@@ -58,6 +77,13 @@ struct fx_render_rounded_rect_options {
enum corner_location corner_location;
};
+struct fx_render_rounded_rect_grad_options {
+ struct wlr_render_rect_options base;
+ struct fx_gradient gradient;
+ int corner_radius;
+ enum corner_location corner_location;
+};
+
struct fx_render_rounded_border_corner_options {
struct wlr_render_rect_options base;
int corner_radius;
@@ -65,6 +91,14 @@ struct fx_render_rounded_border_corner_options {
enum corner_location corner_location;
};
+struct fx_render_rounded_grad_border_corner_options {
+ struct wlr_render_rect_options base;
+ struct fx_gradient gradient;
+ int corner_radius;
+ int border_thickness;
+ enum corner_location corner_location;
+};
+
struct fx_render_blur_pass_options {
struct fx_render_texture_options tex_options;
pixman_region32_t *opaque_region;
@@ -87,6 +121,12 @@ void fx_render_pass_add_rect(struct fx_gles_render_pass *render_pass,
const struct fx_render_rect_options *options);
/**
+ * Render a rectangle with a gradient.
+ */
+void fx_render_pass_add_rect_grad(struct fx_gles_render_pass *render_pass,
+ const struct fx_render_rect_grad_options *options);
+
+/**
* Render a rounded rectangle.
*/
void fx_render_pass_add_rounded_rect(struct fx_gles_render_pass *render_pass,
@@ -95,10 +135,23 @@ void fx_render_pass_add_rounded_rect(struct fx_gles_render_pass *render_pass,
/**
* Render a border corner.
*/
+void fx_render_pass_add_rounded_rect_grad(struct fx_gles_render_pass *render_pass,
+ const struct fx_render_rounded_rect_grad_options *options);
+
+
+/**
+ * Render a border corner.
+ */
void fx_render_pass_add_rounded_border_corner(struct fx_gles_render_pass *render_pass,
const struct fx_render_rounded_border_corner_options *options);
/**
+ * Render a border corner.
+ */
+void fx_render_pass_add_rounded_grad_border_corner(struct fx_gles_render_pass *render_pass,
+ const struct fx_render_rounded_grad_border_corner_options *options);
+
+/**
* Render a box shadow.
*/
void fx_render_pass_add_box_shadow(struct fx_gles_render_pass *pass,