2024-05-04 06:26:27 +09:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
|
#ifndef LABWC_BOX_H
|
|
|
|
|
#define LABWC_BOX_H
|
|
|
|
|
|
|
|
|
|
#include <wlr/util/box.h>
|
|
|
|
|
|
2024-10-05 09:45:48 -04:00
|
|
|
bool box_contains(struct wlr_box *box_super, struct wlr_box *box_sub);
|
2024-05-04 06:26:27 +09:00
|
|
|
|
2024-10-05 09:45:48 -04:00
|
|
|
bool box_intersects(struct wlr_box *box_a, struct wlr_box *box_b);
|
2024-05-04 06:26:27 +09:00
|
|
|
|
|
|
|
|
/* Returns the bounding box of 2 boxes */
|
2024-10-05 09:45:48 -04:00
|
|
|
void box_union(struct wlr_box *box_dest, struct wlr_box *box_a,
|
|
|
|
|
struct wlr_box *box_b);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Fits and centers a content box (width & height) within a bounding box
|
|
|
|
|
* (max_width & max_height). The content box is downscaled if necessary
|
|
|
|
|
* (preserving aspect ratio) but not upscaled.
|
|
|
|
|
*
|
|
|
|
|
* The returned x & y coordinates are the centered content position
|
|
|
|
|
* relative to the top-left corner of the bounding box.
|
|
|
|
|
*/
|
|
|
|
|
struct wlr_box box_fit_within(int width, int height, int max_width,
|
|
|
|
|
int max_height);
|
2024-05-04 06:26:27 +09:00
|
|
|
|
|
|
|
|
#endif /* LABWC_BOX_H */
|