summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/render/fx_renderer/fx_renderer.h7
-rw-r--r--include/render/fx_renderer/shaders.h67
-rw-r--r--include/scenefx/render/pass.h53
3 files changed, 127 insertions, 0 deletions
diff --git a/include/render/fx_renderer/fx_renderer.h b/include/render/fx_renderer/fx_renderer.h
index 526a640..bb8d205 100644
--- a/include/render/fx_renderer/fx_renderer.h
+++ b/include/render/fx_renderer/fx_renderer.h
@@ -161,16 +161,23 @@ struct fx_renderer {
struct {
struct quad_shader quad;
+ struct quad_grad_shader quad_grad;
struct quad_round_shader quad_round;
struct quad_round_shader quad_round_tl;
struct quad_round_shader quad_round_tr;
struct quad_round_shader quad_round_bl;
struct quad_round_shader quad_round_br;
+ struct quad_grad_round_shader quad_grad_round;
+ struct quad_grad_round_shader quad_grad_round_tl;
+ struct quad_grad_round_shader quad_grad_round_tr;
+ struct quad_grad_round_shader quad_grad_round_bl;
+ struct quad_grad_round_shader quad_grad_round_br;
struct tex_shader tex_rgba;
struct tex_shader tex_rgbx;
struct tex_shader tex_ext;
struct box_shadow_shader box_shadow;
struct rounded_border_corner_shader rounded_border_corner;
+ struct rounded_grad_border_corner_shader rounded_grad_border_corner;
struct blur_shader blur1;
struct blur_shader blur2;
struct blur_effects_shader blur_effects;
diff --git a/include/render/fx_renderer/shaders.h b/include/render/fx_renderer/shaders.h
index df91762..11baa3d 100644
--- a/include/render/fx_renderer/shaders.h
+++ b/include/render/fx_renderer/shaders.h
@@ -37,6 +37,24 @@ struct quad_shader {
bool link_quad_program(struct quad_shader *shader);
+struct quad_grad_shader {
+ int max_len;
+
+ GLuint program;
+ GLint proj;
+ GLint colors;
+ GLint size;
+ GLint degree;
+ GLint grad_box;
+ GLint pos_attrib;
+ GLint linear;
+ GLint origin;
+ GLint count;
+ GLint blend;
+};
+
+bool link_quad_grad_program(struct quad_grad_shader *shader, int max_len);
+
struct quad_round_shader {
GLuint program;
GLint proj;
@@ -49,6 +67,29 @@ struct quad_round_shader {
bool link_quad_round_program(struct quad_round_shader *shader, enum fx_rounded_quad_shader_source source);
+struct quad_grad_round_shader {
+ GLuint program;
+ GLint proj;
+ GLint color;
+ GLint pos_attrib;
+ GLint size;
+ GLint position;
+ GLint radius;
+
+ GLint colors;
+ GLint grad_size;
+ GLint degree;
+ GLint grad_box;
+ GLint linear;
+ GLint origin;
+ GLint count;
+ GLint blend;
+
+ int max_len;
+};
+
+bool link_quad_grad_round_program(struct quad_grad_round_shader *shader, enum fx_rounded_quad_shader_source source, int max_len);
+
struct tex_shader {
GLuint program;
GLint proj;
@@ -84,6 +125,32 @@ struct rounded_border_corner_shader {
bool link_rounded_border_corner_program(struct rounded_border_corner_shader *shader);
+struct rounded_grad_border_corner_shader {
+ int max_len;
+ GLuint program;
+ GLint proj;
+ GLint is_top_left;
+ GLint is_top_right;
+ GLint is_bottom_left;
+ GLint is_bottom_right;
+ GLint position;
+ GLint radius;
+ GLint half_size;
+ GLint half_thickness;
+
+ GLint colors;
+ GLint size;
+ GLint degree;
+ GLint grad_box;
+ GLint pos_attrib;
+ GLint linear;
+ GLint origin;
+ GLint count;
+ GLint blend;
+};
+
+bool link_rounded_grad_border_corner_program(struct rounded_grad_border_corner_shader *shader, int max_len);
+
struct box_shadow_shader {
GLuint program;
GLint proj;
diff --git a/include/scenefx/render/pass.h b/include/scenefx/render/pass.h
index 9e92f90..0e87833 100644
--- a/include/scenefx/render/pass.h
+++ b/include/scenefx/render/pass.h
@@ -26,6 +26,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
@@ -41,6 +55,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 box;
struct wlr_box window_box;
@@ -59,6 +78,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;
@@ -66,6 +92,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;
@@ -88,6 +122,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,
@@ -96,10 +136,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,