render: introduce blend mode

Allow callers to pick the blend mode when rendering a rect. The
"none" mode can be used to disable blending and clear rects.
This commit is contained in:
Simon Ser 2023-05-02 21:32:51 +02:00
parent 6b7d1d732a
commit a93fc8afd6
3 changed files with 34 additions and 2 deletions

View file

@ -177,6 +177,16 @@ struct wlr_render_pass *wlr_renderer_begin_buffer_pass(
*/
bool wlr_render_pass_submit(struct wlr_render_pass *render_pass);
/**
* Blend modes.
*/
enum wlr_render_blend_mode {
/* Pre-multiplied alpha (default) */
WLR_RENDER_BLEND_MODE_PREMULTIPLIED,
/* Blending is disabled */
WLR_RENDER_BLEND_MODE_NONE,
};
struct wlr_render_texture_options {
/* Source texture */
struct wlr_texture *texture;
@ -215,6 +225,8 @@ struct wlr_render_rect_options {
struct wlr_render_color color;
/* Clip region, leave NULL to disable clipping */
const pixman_region32_t *clip;
/* Blend mode */
enum wlr_render_blend_mode blend_mode;
};
/**