2017-09-23 10:26:01 +02:00
|
|
|
#ifndef WLR_TYPES_WLR_BOX_H
|
|
|
|
#define WLR_TYPES_WLR_BOX_H
|
|
|
|
|
2017-08-29 18:08:49 +02:00
|
|
|
#include <stdbool.h>
|
2018-01-26 22:11:09 +01:00
|
|
|
#include <wayland-server.h>
|
2017-08-29 18:08:49 +02:00
|
|
|
|
|
|
|
struct wlr_box {
|
|
|
|
int x, y;
|
|
|
|
int width, height;
|
|
|
|
};
|
|
|
|
|
2017-12-31 12:49:06 +01:00
|
|
|
void wlr_box_closest_point(const struct wlr_box *box, double x, double y,
|
|
|
|
double *dest_x, double *dest_y);
|
2017-08-29 18:08:49 +02:00
|
|
|
|
2017-12-31 12:49:06 +01:00
|
|
|
bool wlr_box_intersection(const struct wlr_box *box_a,
|
|
|
|
const struct wlr_box *box_b, struct wlr_box *dest);
|
2017-08-29 18:08:49 +02:00
|
|
|
|
2017-12-31 12:49:06 +01:00
|
|
|
bool wlr_box_contains_point(const struct wlr_box *box, double x, double y);
|
2017-08-29 18:08:49 +02:00
|
|
|
|
2017-12-31 12:49:06 +01:00
|
|
|
bool wlr_box_empty(const struct wlr_box *box);
|
2017-08-29 18:08:49 +02:00
|
|
|
|
2018-01-26 22:11:09 +01:00
|
|
|
/**
|
|
|
|
* Transforms a box inside a `width` x `height` box.
|
|
|
|
*/
|
2017-12-31 12:49:06 +01:00
|
|
|
void wlr_box_transform(const struct wlr_box *box,
|
2018-01-26 22:11:09 +01:00
|
|
|
enum wl_output_transform transform, int width, int height,
|
|
|
|
struct wlr_box *dest);
|
2017-12-01 09:15:33 +01:00
|
|
|
|
2018-01-27 10:43:17 +01:00
|
|
|
/**
|
2018-03-26 21:31:08 +02:00
|
|
|
* Creates the smallest box that contains the box rotated about its center.
|
2018-01-27 10:43:17 +01:00
|
|
|
*/
|
|
|
|
void wlr_box_rotated_bounds(const struct wlr_box *box, float rotation,
|
|
|
|
struct wlr_box *dest);
|
|
|
|
|
2017-08-29 18:08:49 +02:00
|
|
|
#endif
|