aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2021-08-13 15:20:48 -0500
committerSimon Ser <contact@emersion.fr>2021-09-02 19:05:02 +0200
commitb7cd06e8fa1d51c36f81040ca818cccfb9e5f56e (patch)
treeee521029524f144fa493aa1d6534eee482b06750 /include
parent526652a554e941f4c86f3be5affe953ded84dacd (diff)
scene: add RECT node type
RECT is a solid-colored rectangle, useful for simple borders or other decoration. This can be rendered directly using the wlr_renderer, without needing to create a surface.
Diffstat (limited to 'include')
-rw-r--r--include/wlr/types/wlr_scene.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h
index 6e0aebf8..4b3c1aaf 100644
--- a/include/wlr/types/wlr_scene.h
+++ b/include/wlr/types/wlr_scene.h
@@ -28,6 +28,7 @@ struct wlr_output;
enum wlr_scene_node_type {
WLR_SCENE_NODE_ROOT,
WLR_SCENE_NODE_SURFACE,
+ WLR_SCENE_NODE_RECT,
};
struct wlr_scene_node_state {
@@ -67,6 +68,13 @@ struct wlr_scene_surface {
struct wl_listener surface_destroy;
};
+/** A scene-graph node displaying a solid-colored rectangle */
+struct wlr_scene_rect {
+ struct wlr_scene_node node;
+ int width, height;
+ float color[4];
+};
+
typedef void (*wlr_scene_node_iterator_func_t)(struct wlr_scene_node *node,
int sx, int sy, void *data);
@@ -134,4 +142,20 @@ void wlr_scene_render_output(struct wlr_scene *scene, struct wlr_output *output,
struct wlr_scene_surface *wlr_scene_surface_create(struct wlr_scene_node *parent,
struct wlr_surface *surface);
+/**
+ * Add a node displaying a solid-colored rectangle to the scene-graph.
+ */
+struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_node *parent,
+ int width, int height, const float color[static 4]);
+
+/**
+ * Change the width and height of an existing rectangle node.
+ */
+void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, int width, int height);
+
+/**
+ * Change the color of an existing rectangle node.
+ */
+void wlr_scene_rect_set_color(struct wlr_scene_rect *rect, const float color[static 4]);
+
#endif