labwc/include/common/scaled-rect-buffer.h
tokyo4j d7b5eb037a Add scaled_rect_buffer
This will be used for menus, OSD and titlebar corners in the future.
2024-11-22 18:29:09 +09:00

40 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_SCALED_RECT_BUFFER_H
#define LABWC_SCALED_RECT_BUFFER_H
#include <stdint.h>
#include <wlr/types/wlr_output_layout.h>
#include "common/corner.h"
struct wlr_scene_tree;
struct wlr_scene_buffer;
struct scaled_scene_buffer;
#define EDGES_ALL (WLR_DIRECTION_UP| WLR_DIRECTION_DOWN \
| WLR_DIRECTION_LEFT | WLR_DIRECTION_RIGHT)
struct scaled_rect_buffer {
struct wlr_scene_buffer *scene_buffer;
struct scaled_scene_buffer *scaled_buffer;
int width;
int height;
int border_width;
int corner_radius;
uint32_t rounded_corners; /* bitmap of lab_corner */
uint32_t stroked_edges; /* bitmap of wlr_direction */
float fill_color[4];
float border_color[4];
};
/**
* Create an auto scaling rounded-rect buffer, providing a wlr_scene_buffer
* node for display. It gets destroyed automatically when the backing
* scaled_scene_buffer is being destroyed which in turn happens automatically
* when the backing wlr_scene_buffer (or one of its parents) is being destroyed.
*/
struct scaled_rect_buffer *scaled_rect_buffer_create(
struct wlr_scene_tree *parent, int width, int height, int border_width,
int corner_radius, uint32_t rounded_corners, uint32_t stroked_edges,
float fill_color[4], float border_color[4]);
#endif /* LABWC_SCALED_RECT_BUFFER_H */