2023-03-31 19:11:10 +00:00
|
|
|
#pragma once
|
2016-12-13 18:02:12 +00:00
|
|
|
|
|
|
|
#include "gskroundedrect.h"
|
|
|
|
|
|
|
|
#include <cairo.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2023-05-14 21:13:23 +00:00
|
|
|
#define OPPOSITE_CORNER(corner) ((corner) ^ 2)
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER (GSK_CORNER_TOP_LEFT) == GSK_CORNER_BOTTOM_RIGHT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER (GSK_CORNER_TOP_RIGHT) == GSK_CORNER_BOTTOM_LEFT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER (GSK_CORNER_BOTTOM_LEFT) == GSK_CORNER_TOP_RIGHT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER (GSK_CORNER_BOTTOM_RIGHT) == GSK_CORNER_TOP_LEFT);
|
|
|
|
|
|
|
|
#define OPPOSITE_CORNER_X(corner) ((corner) ^ 1)
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER_X (GSK_CORNER_TOP_LEFT) == GSK_CORNER_TOP_RIGHT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER_X (GSK_CORNER_TOP_RIGHT) == GSK_CORNER_TOP_LEFT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER_X (GSK_CORNER_BOTTOM_LEFT) == GSK_CORNER_BOTTOM_RIGHT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER_X (GSK_CORNER_BOTTOM_RIGHT) == GSK_CORNER_BOTTOM_LEFT);
|
|
|
|
|
|
|
|
#define OPPOSITE_CORNER_Y(corner) ((corner) ^ 3)
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER_Y (GSK_CORNER_TOP_LEFT) == GSK_CORNER_BOTTOM_LEFT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER_Y (GSK_CORNER_TOP_RIGHT) == GSK_CORNER_BOTTOM_RIGHT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER_Y (GSK_CORNER_BOTTOM_LEFT) == GSK_CORNER_TOP_LEFT);
|
|
|
|
G_STATIC_ASSERT (OPPOSITE_CORNER_Y (GSK_CORNER_BOTTOM_RIGHT) == GSK_CORNER_TOP_RIGHT);
|
|
|
|
|
2020-12-12 13:45:11 +00:00
|
|
|
#define GSK_ROUNDED_RECT_INIT_FROM_RECT(_r) \
|
|
|
|
(GskRoundedRect) { .bounds = _r, \
|
|
|
|
.corner = { \
|
|
|
|
GRAPHENE_SIZE_INIT(0, 0),\
|
|
|
|
GRAPHENE_SIZE_INIT(0, 0),\
|
|
|
|
GRAPHENE_SIZE_INIT(0, 0),\
|
|
|
|
GRAPHENE_SIZE_INIT(0, 0),\
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
2021-03-07 19:35:44 +00:00
|
|
|
void gsk_rounded_rect_scale_affine (GskRoundedRect *dest,
|
|
|
|
const GskRoundedRect *src,
|
|
|
|
float scale_x,
|
|
|
|
float scale_y,
|
|
|
|
float dx,
|
|
|
|
float dy);
|
|
|
|
|
2021-09-14 16:21:34 +00:00
|
|
|
gboolean gsk_rounded_rect_is_circular (const GskRoundedRect *self) G_GNUC_PURE;
|
2016-12-23 20:36:17 +00:00
|
|
|
|
2016-12-13 18:02:12 +00:00
|
|
|
void gsk_rounded_rect_path (const GskRoundedRect *self,
|
|
|
|
cairo_t *cr);
|
2016-12-24 03:58:51 +00:00
|
|
|
void gsk_rounded_rect_to_float (const GskRoundedRect *self,
|
2023-05-10 14:40:22 +00:00
|
|
|
const graphene_point_t *offset,
|
2016-12-24 03:58:51 +00:00
|
|
|
float rect[12]);
|
2016-12-13 18:02:12 +00:00
|
|
|
|
2018-03-27 22:34:23 +00:00
|
|
|
gboolean gsk_rounded_rect_equal (gconstpointer rect1,
|
2020-01-24 12:17:09 +00:00
|
|
|
gconstpointer rect2) G_GNUC_PURE;
|
2021-09-14 16:21:34 +00:00
|
|
|
char * gsk_rounded_rect_to_string (const GskRoundedRect *self) G_GNUC_MALLOC;
|
2019-02-28 08:44:08 +00:00
|
|
|
|
2023-07-12 09:04:25 +00:00
|
|
|
void gsk_rounded_rect_get_largest_cover (const GskRoundedRect *self,
|
|
|
|
const graphene_rect_t *rect,
|
|
|
|
graphene_rect_t *result);
|
|
|
|
|
2023-05-01 13:52:46 +00:00
|
|
|
typedef enum {
|
|
|
|
GSK_INTERSECTION_EMPTY,
|
|
|
|
GSK_INTERSECTION_NONEMPTY,
|
|
|
|
GSK_INTERSECTION_NOT_REPRESENTABLE
|
|
|
|
} GskRoundedRectIntersection;
|
|
|
|
|
|
|
|
GskRoundedRectIntersection gsk_rounded_rect_intersect_with_rect (const GskRoundedRect *self,
|
|
|
|
const graphene_rect_t *rect,
|
|
|
|
GskRoundedRect *result) G_GNUC_PURE;
|
2023-05-14 21:13:23 +00:00
|
|
|
GskRoundedRectIntersection gsk_rounded_rect_intersection (const GskRoundedRect *a,
|
|
|
|
const GskRoundedRect *b,
|
|
|
|
GskRoundedRect *result);
|
2023-05-01 13:52:46 +00:00
|
|
|
|
2018-03-27 22:34:23 +00:00
|
|
|
|
2016-12-13 18:02:12 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|