2018-07-13 14:40:56 +02:00
|
|
|
/*
|
|
|
|
* This is a stable interface of wlroots. Future changes will be limited to:
|
|
|
|
*
|
|
|
|
* - New functions
|
|
|
|
* - New struct members
|
|
|
|
* - New enum members
|
|
|
|
*
|
|
|
|
* Note that wlroots does not make an ABI compatibility promise - in the future,
|
|
|
|
* the layout and size of structs used by wlroots may change, requiring code
|
|
|
|
* depending on this header to be recompiled (but not edited).
|
|
|
|
*
|
2021-07-03 10:34:30 +02:00
|
|
|
* Breaking changes are announced in the release notes and follow a 1-year
|
|
|
|
* deprecation schedule.
|
2018-07-13 14:40:56 +02:00
|
|
|
*/
|
|
|
|
|
2018-01-25 19:15:20 +01:00
|
|
|
#ifndef WLR_UTIL_REGION_H
|
|
|
|
#define WLR_UTIL_REGION_H
|
2018-08-10 18:19:16 +02:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
2018-01-25 19:15:20 +01:00
|
|
|
#include <pixman.h>
|
2019-07-27 10:53:54 +02:00
|
|
|
#include <wayland-server-protocol.h>
|
2018-01-25 19:15:20 +01:00
|
|
|
|
2018-01-25 21:54:51 +01:00
|
|
|
/**
|
|
|
|
* Scales a region, ie. multiplies all its coordinates by `scale`.
|
|
|
|
*
|
|
|
|
* The resulting coordinates are rounded up or down so that the new region is
|
|
|
|
* at least as big as the original one.
|
|
|
|
*/
|
2018-01-25 19:15:20 +01:00
|
|
|
void wlr_region_scale(pixman_region32_t *dst, pixman_region32_t *src,
|
|
|
|
float scale);
|
|
|
|
|
2020-06-08 17:21:10 +02:00
|
|
|
void wlr_region_scale_xy(pixman_region32_t *dst, pixman_region32_t *src,
|
|
|
|
float scale_x, float scale_y);
|
|
|
|
|
2018-01-26 22:11:09 +01:00
|
|
|
/**
|
|
|
|
* Applies a transform to a region inside a box of size `width` x `height`.
|
|
|
|
*/
|
|
|
|
void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src,
|
|
|
|
enum wl_output_transform transform, int width, int height);
|
|
|
|
|
2018-01-30 12:01:10 +01:00
|
|
|
/**
|
|
|
|
* Expands the region of `distance`. If `distance` is negative, it shrinks the
|
|
|
|
* region.
|
|
|
|
*/
|
|
|
|
void wlr_region_expand(pixman_region32_t *dst, pixman_region32_t *src,
|
|
|
|
int distance);
|
|
|
|
|
2018-03-26 21:31:08 +02:00
|
|
|
/*
|
|
|
|
* Builds the smallest possible region that contains the region rotated about
|
|
|
|
* the point (ox, oy).
|
|
|
|
*/
|
|
|
|
void wlr_region_rotated_bounds(pixman_region32_t *dst, pixman_region32_t *src,
|
|
|
|
float rotation, int ox, int oy);
|
|
|
|
|
2018-08-10 18:19:16 +02:00
|
|
|
bool wlr_region_confine(pixman_region32_t *region, double x1, double y1, double x2,
|
|
|
|
double y2, double *x2_out, double *y2_out);
|
|
|
|
|
2018-01-25 19:15:20 +01:00
|
|
|
#endif
|