mirror of
https://github.com/labwc/labwc.git
synced 2026-04-10 08:21:07 -04:00
graphic-helpers: add border_rect
This commit is contained in:
parent
f2b020b239
commit
44beeffbd7
2 changed files with 120 additions and 58 deletions
|
|
@ -9,29 +9,49 @@ struct wlr_scene_tree;
|
|||
struct wlr_scene_rect;
|
||||
struct wlr_fbox;
|
||||
|
||||
struct multi_rect {
|
||||
struct border_rect {
|
||||
struct wlr_scene_tree *tree;
|
||||
int line_width; /* read-only */
|
||||
int border_width; /* read-only */
|
||||
|
||||
/* Private */
|
||||
struct wlr_scene_rect *top[3];
|
||||
struct wlr_scene_rect *bottom[3];
|
||||
struct wlr_scene_rect *left[3];
|
||||
struct wlr_scene_rect *right[3];
|
||||
struct wlr_scene_rect *top;
|
||||
struct wlr_scene_rect *bottom;
|
||||
struct wlr_scene_rect *left;
|
||||
struct wlr_scene_rect *right;
|
||||
struct wlr_scene_rect *bg;
|
||||
|
||||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
struct multi_rect {
|
||||
struct wlr_scene_tree *tree;
|
||||
|
||||
/* Private */
|
||||
struct border_rect *border_rects[3];
|
||||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new rectangular with a single border (border_rect).
|
||||
*
|
||||
* bg_color can take NULL, in which case no background is rendered.
|
||||
*
|
||||
* A border_rect can be positioned by positioning border_rect->tree->node.
|
||||
*
|
||||
* It can be destroyed by destroying its tree node (or one of its parent nodes).
|
||||
* Once the tree node has been destroyed the struct will be free'd automatically.
|
||||
*/
|
||||
struct border_rect *border_rect_create(struct wlr_scene_tree *parent,
|
||||
float border_color[4], float bg_color[4], int border_width);
|
||||
|
||||
void border_rect_set_size(struct border_rect *rect, int width, int height);
|
||||
|
||||
/**
|
||||
* Create a new multi_rect.
|
||||
* A multi_rect consists of 3 nested rectangular outlines.
|
||||
* Each of the rectangular outlines is using the same @line_width
|
||||
* but its own color based on the @colors argument.
|
||||
*
|
||||
* The multi-rect can be positioned by positioning multi_rect->tree->node.
|
||||
*
|
||||
* It can be destroyed by destroying its tree node (or one of its
|
||||
* parent nodes). Once the tree node has been destroyed the struct
|
||||
* will be free'd automatically.
|
||||
* A multi_rect consists of 3 nested border_rects without a background.
|
||||
* Each of the border_rect is using the same @line_width but its own color
|
||||
* based on the @colors argument.
|
||||
*/
|
||||
struct multi_rect *multi_rect_create(struct wlr_scene_tree *parent,
|
||||
float *colors[3], int line_width);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue