2016-12-13 18:02:12 +00:00
|
|
|
/* GSK - The GTK Scene Kit
|
|
|
|
*
|
|
|
|
* Copyright 2016 Endless
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GSK_ROUNDED_RECT_H__
|
|
|
|
#define __GSK_ROUNDED_RECT_H__
|
|
|
|
|
2019-11-27 13:33:43 +00:00
|
|
|
#if !defined (__GSK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
2016-12-13 18:02:12 +00:00
|
|
|
#error "Only <gsk/gsk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gsk/gsktypes.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GSK_ROUNDED_RECT_INIT:
|
|
|
|
* @_x: the X coordinate of the origin
|
|
|
|
* @_y: the Y coordinate of the origin
|
|
|
|
* @_w: the width
|
|
|
|
* @_h: the height
|
|
|
|
*
|
2021-05-20 03:40:54 +00:00
|
|
|
* Initializes a `GskRoundedRect` when declaring it.
|
2018-01-27 11:11:49 +00:00
|
|
|
* All corner sizes will be initialized to 0.
|
2016-12-13 18:02:12 +00:00
|
|
|
*/
|
2018-01-27 11:11:49 +00:00
|
|
|
#define GSK_ROUNDED_RECT_INIT(_x,_y,_w,_h) (GskRoundedRect) { .bounds = GRAPHENE_RECT_INIT(_x,_y,_w,_h), \
|
|
|
|
.corner = { \
|
|
|
|
GRAPHENE_SIZE_INIT(0, 0),\
|
|
|
|
GRAPHENE_SIZE_INIT(0, 0),\
|
|
|
|
GRAPHENE_SIZE_INIT(0, 0),\
|
|
|
|
GRAPHENE_SIZE_INIT(0, 0),\
|
|
|
|
}}
|
2016-12-13 18:02:12 +00:00
|
|
|
|
|
|
|
typedef struct _GskRoundedRect GskRoundedRect;
|
|
|
|
|
|
|
|
struct _GskRoundedRect
|
|
|
|
{
|
|
|
|
graphene_rect_t bounds;
|
|
|
|
|
|
|
|
graphene_size_t corner[4];
|
|
|
|
};
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-13 18:02:12 +00:00
|
|
|
GskRoundedRect * gsk_rounded_rect_init (GskRoundedRect *self,
|
2017-03-27 19:13:15 +00:00
|
|
|
const graphene_rect_t *bounds,
|
2016-12-13 18:02:12 +00:00
|
|
|
const graphene_size_t *top_left,
|
|
|
|
const graphene_size_t *top_right,
|
|
|
|
const graphene_size_t *bottom_right,
|
|
|
|
const graphene_size_t *bottom_left);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-13 18:02:12 +00:00
|
|
|
GskRoundedRect * gsk_rounded_rect_init_copy (GskRoundedRect *self,
|
|
|
|
const GskRoundedRect *src);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-13 18:02:12 +00:00
|
|
|
GskRoundedRect * gsk_rounded_rect_init_from_rect (GskRoundedRect *self,
|
|
|
|
const graphene_rect_t *bounds,
|
|
|
|
float radius);
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-13 18:02:12 +00:00
|
|
|
GskRoundedRect * gsk_rounded_rect_normalize (GskRoundedRect *self);
|
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-13 18:02:12 +00:00
|
|
|
GskRoundedRect * gsk_rounded_rect_offset (GskRoundedRect *self,
|
|
|
|
float dx,
|
|
|
|
float dy);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-18 16:10:45 +00:00
|
|
|
GskRoundedRect * gsk_rounded_rect_shrink (GskRoundedRect *self,
|
|
|
|
float top,
|
|
|
|
float right,
|
|
|
|
float bottom,
|
|
|
|
float left);
|
2016-12-13 18:02:12 +00:00
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-01-24 12:17:09 +00:00
|
|
|
gboolean gsk_rounded_rect_is_rectilinear (const GskRoundedRect *self) G_GNUC_PURE;
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-19 03:39:33 +00:00
|
|
|
gboolean gsk_rounded_rect_contains_point (const GskRoundedRect *self,
|
2020-01-24 12:17:09 +00:00
|
|
|
const graphene_point_t *point) G_GNUC_PURE;
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-19 03:39:33 +00:00
|
|
|
gboolean gsk_rounded_rect_contains_rect (const GskRoundedRect *self,
|
2020-01-24 12:17:09 +00:00
|
|
|
const graphene_rect_t *rect) G_GNUC_PURE;
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2016-12-19 03:39:33 +00:00
|
|
|
gboolean gsk_rounded_rect_intersects_rect (const GskRoundedRect *self,
|
2020-01-24 12:17:09 +00:00
|
|
|
const graphene_rect_t *rect) G_GNUC_PURE;
|
2016-12-13 18:02:12 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GSK_ROUNDED_RECT_H__ */
|