/usr/include/graphene-1.0/graphene-rect.h is in libgraphene-1.0-dev 1.8.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | /* graphene-rect.h: Rectangular type
*
* Copyright 2014 Emmanuele Bassi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef __GRAPHENE_RECT_H__
#define __GRAPHENE_RECT_H__
#if !defined(GRAPHENE_H_INSIDE) && !defined(GRAPHENE_COMPILATION)
#error "Only graphene.h can be included directly."
#endif
#include "graphene-types.h"
#include "graphene-point.h"
#include "graphene-size.h"
#include "graphene-vec2.h"
GRAPHENE_BEGIN_DECLS
/**
* GRAPHENE_RECT_INIT:
* @_x: the X coordinate of the origin
* @_y: the Y coordinate of the origin
* @_w: the width
* @_h: the height
*
* Initializes a #graphene_rect_t when declaring it.
*
* Since: 1.0
*/
#define GRAPHENE_RECT_INIT(_x,_y,_w,_h) \
(graphene_rect_t) { .origin = { .x = (_x), .y = (_y) }, .size = { .width = (_w), .height = (_h) } }
/**
* graphene_rect_t:
* @origin: the coordinates of the origin of the rectangle
* @size: the size of the rectangle
*
* The location and size of a rectangle region.
*
* The width and height of a #graphene_rect_t can be negative; for instance,
* a #graphene_rect_t with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is
* equivalent to a #graphene_rect_t with an origin of [ 10, 10 ] and a size
* of [ -10, -10 ].
*
* Application code can normalize rectangles using graphene_rect_normalize();
* this function will ensure that the width and height of a rectangle are
* positive values. All functions taking a #graphene_rect_t as an argument
* will internally operate on a normalized copy; all functions returning a
* #graphene_rect_t will always return a normalized rectangle.
*
* Since: 1.0
*/
struct _graphene_rect_t
{
graphene_point_t origin;
graphene_size_t size;
};
GRAPHENE_AVAILABLE_IN_1_0
graphene_rect_t * graphene_rect_alloc (void);
GRAPHENE_AVAILABLE_IN_1_0
void graphene_rect_free (graphene_rect_t *r);
GRAPHENE_AVAILABLE_IN_1_0
graphene_rect_t * graphene_rect_init (graphene_rect_t *r,
float x,
float y,
float width,
float height);
GRAPHENE_AVAILABLE_IN_1_0
graphene_rect_t * graphene_rect_init_from_rect (graphene_rect_t *r,
const graphene_rect_t *src);
GRAPHENE_AVAILABLE_IN_1_0
bool graphene_rect_equal (const graphene_rect_t *a,
const graphene_rect_t *b);
GRAPHENE_AVAILABLE_IN_1_0
graphene_rect_t * graphene_rect_normalize (graphene_rect_t *r);
GRAPHENE_AVAILABLE_IN_1_4
void graphene_rect_normalize_r (const graphene_rect_t *r,
graphene_rect_t *res);
GRAPHENE_AVAILABLE_IN_1_0
void graphene_rect_get_center (const graphene_rect_t *r,
graphene_point_t *p);
GRAPHENE_AVAILABLE_IN_1_0
void graphene_rect_get_top_left (const graphene_rect_t *r,
graphene_point_t *p);
GRAPHENE_AVAILABLE_IN_1_0
void graphene_rect_get_top_right (const graphene_rect_t *r,
graphene_point_t *p);
GRAPHENE_AVAILABLE_IN_1_0
void graphene_rect_get_bottom_right (const graphene_rect_t *r,
graphene_point_t *p);
GRAPHENE_AVAILABLE_IN_1_0
void graphene_rect_get_bottom_left (const graphene_rect_t *r,
graphene_point_t *p);
GRAPHENE_AVAILABLE_IN_1_4
void graphene_rect_get_vertices (const graphene_rect_t *r,
graphene_vec2_t vertices[]);
GRAPHENE_AVAILABLE_IN_1_0
float graphene_rect_get_x (const graphene_rect_t *r);
GRAPHENE_AVAILABLE_IN_1_0
float graphene_rect_get_y (const graphene_rect_t *r);
GRAPHENE_AVAILABLE_IN_1_0
float graphene_rect_get_width (const graphene_rect_t *r);
GRAPHENE_AVAILABLE_IN_1_0
float graphene_rect_get_height (const graphene_rect_t *r);
GRAPHENE_AVAILABLE_IN_1_0
void graphene_rect_union (const graphene_rect_t *a,
const graphene_rect_t *b,
graphene_rect_t *res);
GRAPHENE_AVAILABLE_IN_1_0
bool graphene_rect_intersection (const graphene_rect_t *a,
const graphene_rect_t *b,
graphene_rect_t *res);
GRAPHENE_AVAILABLE_IN_1_0
bool graphene_rect_contains_point (const graphene_rect_t *r,
const graphene_point_t *p);
GRAPHENE_AVAILABLE_IN_1_0
bool graphene_rect_contains_rect (const graphene_rect_t *a,
const graphene_rect_t *b);
GRAPHENE_AVAILABLE_IN_1_0
graphene_rect_t * graphene_rect_offset (graphene_rect_t *r,
float d_x,
float d_y);
GRAPHENE_AVAILABLE_IN_1_4
void graphene_rect_offset_r (const graphene_rect_t *r,
float d_x,
float d_y,
graphene_rect_t *res);
GRAPHENE_AVAILABLE_IN_1_0
graphene_rect_t * graphene_rect_inset (graphene_rect_t *r,
float d_x,
float d_y);
GRAPHENE_AVAILABLE_IN_1_4
void graphene_rect_inset_r (const graphene_rect_t *r,
float d_x,
float d_y,
graphene_rect_t *res);
GRAPHENE_DEPRECATED_IN_1_4_FOR (graphene_rect_round)
graphene_rect_t * graphene_rect_round_to_pixel (graphene_rect_t *r);
GRAPHENE_AVAILABLE_IN_1_4
void graphene_rect_round (const graphene_rect_t *r,
graphene_rect_t *res);
GRAPHENE_AVAILABLE_IN_1_0
void graphene_rect_interpolate (const graphene_rect_t *a,
const graphene_rect_t *b,
double factor,
graphene_rect_t *res);
GRAPHENE_AVAILABLE_IN_1_4
void graphene_rect_expand (const graphene_rect_t *r,
const graphene_point_t *p,
graphene_rect_t *res);
GRAPHENE_AVAILABLE_IN_1_4
const graphene_rect_t * graphene_rect_zero (void);
GRAPHENE_END_DECLS
#endif /* __GRAPHENE_RECT_H__ */
|