Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/harfbuzz/src/hb-draw.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* | |
| 2 * Copyright © 2019-2020 Ebrahim Byagowi | |
| 3 * | |
| 4 * This is part of HarfBuzz, a text shaping library. | |
| 5 * | |
| 6 * Permission is hereby granted, without written agreement and without | |
| 7 * license or royalty fees, to use, copy, modify, and distribute this | |
| 8 * software and its documentation for any purpose, provided that the | |
| 9 * above copyright notice and the following two paragraphs appear in | |
| 10 * all copies of this software. | |
| 11 * | |
| 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | |
| 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | |
| 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | |
| 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | |
| 16 * DAMAGE. | |
| 17 * | |
| 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | |
| 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | |
| 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | |
| 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
| 23 */ | |
| 24 | |
| 25 #if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) | |
| 26 #error "Include <hb.h> instead." | |
| 27 #endif | |
| 28 | |
| 29 #ifndef HB_DRAW_H | |
| 30 #define HB_DRAW_H | |
| 31 | |
| 32 #include "hb.h" | |
| 33 | |
| 34 HB_BEGIN_DECLS | |
| 35 | |
| 36 | |
| 37 /** | |
| 38 * hb_draw_state_t | |
| 39 * @path_open: Whether there is an open path | |
| 40 * @path_start_x: X component of the start of current path | |
| 41 * @path_start_y: Y component of the start of current path | |
| 42 * @current_x: X component of current point | |
| 43 * @current_y: Y component of current point | |
| 44 * | |
| 45 * Current drawing state. | |
| 46 * | |
| 47 * Since: 4.0.0 | |
| 48 **/ | |
| 49 typedef struct hb_draw_state_t { | |
| 50 hb_bool_t path_open; | |
| 51 | |
| 52 float path_start_x; | |
| 53 float path_start_y; | |
| 54 | |
| 55 float current_x; | |
| 56 float current_y; | |
| 57 | |
| 58 /*< private >*/ | |
| 59 hb_var_num_t reserved1; | |
| 60 hb_var_num_t reserved2; | |
| 61 hb_var_num_t reserved3; | |
| 62 hb_var_num_t reserved4; | |
| 63 hb_var_num_t reserved5; | |
| 64 hb_var_num_t reserved6; | |
| 65 hb_var_num_t reserved7; | |
| 66 } hb_draw_state_t; | |
| 67 | |
| 68 /** | |
| 69 * HB_DRAW_STATE_DEFAULT: | |
| 70 * | |
| 71 * The default #hb_draw_state_t at the start of glyph drawing. | |
| 72 */ | |
| 73 #define HB_DRAW_STATE_DEFAULT {0, 0.f, 0.f, 0.f, 0.f, {0.}, {0.}, {0.}} | |
| 74 | |
| 75 | |
| 76 /** | |
| 77 * hb_draw_funcs_t: | |
| 78 * | |
| 79 * Glyph draw callbacks. | |
| 80 * | |
| 81 * #hb_draw_move_to_func_t, #hb_draw_line_to_func_t and | |
| 82 * #hb_draw_cubic_to_func_t calls are necessary to be defined but we translate | |
| 83 * #hb_draw_quadratic_to_func_t calls to #hb_draw_cubic_to_func_t if the | |
| 84 * callback isn't defined. | |
| 85 * | |
| 86 * Since: 4.0.0 | |
| 87 **/ | |
| 88 | |
| 89 typedef struct hb_draw_funcs_t hb_draw_funcs_t; | |
| 90 | |
| 91 | |
| 92 /** | |
| 93 * hb_draw_move_to_func_t: | |
| 94 * @dfuncs: draw functions object | |
| 95 * @draw_data: The data accompanying the draw functions | |
| 96 * @st: current draw state | |
| 97 * @to_x: X component of target point | |
| 98 * @to_y: Y component of target point | |
| 99 * @user_data: User data pointer passed by the caller | |
| 100 * | |
| 101 * A virtual method for the #hb_draw_funcs_t to perform a "move-to" draw | |
| 102 * operation. | |
| 103 * | |
| 104 * Since: 4.0.0 | |
| 105 * | |
| 106 **/ | |
| 107 typedef void (*hb_draw_move_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 108 hb_draw_state_t *st, | |
| 109 float to_x, float to_y, | |
| 110 void *user_data); | |
| 111 | |
| 112 /** | |
| 113 * hb_draw_line_to_func_t: | |
| 114 * @dfuncs: draw functions object | |
| 115 * @draw_data: The data accompanying the draw functions | |
| 116 * @st: current draw state | |
| 117 * @to_x: X component of target point | |
| 118 * @to_y: Y component of target point | |
| 119 * @user_data: User data pointer passed by the caller | |
| 120 * | |
| 121 * A virtual method for the #hb_draw_funcs_t to perform a "line-to" draw | |
| 122 * operation. | |
| 123 * | |
| 124 * Since: 4.0.0 | |
| 125 * | |
| 126 **/ | |
| 127 typedef void (*hb_draw_line_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 128 hb_draw_state_t *st, | |
| 129 float to_x, float to_y, | |
| 130 void *user_data); | |
| 131 | |
| 132 /** | |
| 133 * hb_draw_quadratic_to_func_t: | |
| 134 * @dfuncs: draw functions object | |
| 135 * @draw_data: The data accompanying the draw functions | |
| 136 * @st: current draw state | |
| 137 * @control_x: X component of control point | |
| 138 * @control_y: Y component of control point | |
| 139 * @to_x: X component of target point | |
| 140 * @to_y: Y component of target point | |
| 141 * @user_data: User data pointer passed by the caller | |
| 142 * | |
| 143 * A virtual method for the #hb_draw_funcs_t to perform a "quadratic-to" draw | |
| 144 * operation. | |
| 145 * | |
| 146 * Since: 4.0.0 | |
| 147 * | |
| 148 **/ | |
| 149 typedef void (*hb_draw_quadratic_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 150 hb_draw_state_t *st, | |
| 151 float control_x, float control_y, | |
| 152 float to_x, float to_y, | |
| 153 void *user_data); | |
| 154 | |
| 155 /** | |
| 156 * hb_draw_cubic_to_func_t: | |
| 157 * @dfuncs: draw functions object | |
| 158 * @draw_data: The data accompanying the draw functions | |
| 159 * @st: current draw state | |
| 160 * @control1_x: X component of first control point | |
| 161 * @control1_y: Y component of first control point | |
| 162 * @control2_x: X component of second control point | |
| 163 * @control2_y: Y component of second control point | |
| 164 * @to_x: X component of target point | |
| 165 * @to_y: Y component of target point | |
| 166 * @user_data: User data pointer passed by the caller | |
| 167 * | |
| 168 * A virtual method for the #hb_draw_funcs_t to perform a "cubic-to" draw | |
| 169 * operation. | |
| 170 * | |
| 171 * Since: 4.0.0 | |
| 172 * | |
| 173 **/ | |
| 174 typedef void (*hb_draw_cubic_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 175 hb_draw_state_t *st, | |
| 176 float control1_x, float control1_y, | |
| 177 float control2_x, float control2_y, | |
| 178 float to_x, float to_y, | |
| 179 void *user_data); | |
| 180 | |
| 181 /** | |
| 182 * hb_draw_close_path_func_t: | |
| 183 * @dfuncs: draw functions object | |
| 184 * @draw_data: The data accompanying the draw functions | |
| 185 * @st: current draw state | |
| 186 * @user_data: User data pointer passed by the caller | |
| 187 * | |
| 188 * A virtual method for the #hb_draw_funcs_t to perform a "close-path" draw | |
| 189 * operation. | |
| 190 * | |
| 191 * Since: 4.0.0 | |
| 192 * | |
| 193 **/ | |
| 194 typedef void (*hb_draw_close_path_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 195 hb_draw_state_t *st, | |
| 196 void *user_data); | |
| 197 | |
| 198 /** | |
| 199 * hb_draw_funcs_set_move_to_func: | |
| 200 * @dfuncs: draw functions object | |
| 201 * @func: (closure user_data) (destroy destroy) (scope notified): move-to callback | |
| 202 * @user_data: Data to pass to @func | |
| 203 * @destroy: (nullable): The function to call when @user_data is not needed anymore | |
| 204 * | |
| 205 * Sets move-to callback to the draw functions object. | |
| 206 * | |
| 207 * Since: 4.0.0 | |
| 208 **/ | |
| 209 HB_EXTERN void | |
| 210 hb_draw_funcs_set_move_to_func (hb_draw_funcs_t *dfuncs, | |
| 211 hb_draw_move_to_func_t func, | |
| 212 void *user_data, hb_destroy_func_t destroy); | |
| 213 | |
| 214 /** | |
| 215 * hb_draw_funcs_set_line_to_func: | |
| 216 * @dfuncs: draw functions object | |
| 217 * @func: (closure user_data) (destroy destroy) (scope notified): line-to callback | |
| 218 * @user_data: Data to pass to @func | |
| 219 * @destroy: (nullable): The function to call when @user_data is not needed anymore | |
| 220 * | |
| 221 * Sets line-to callback to the draw functions object. | |
| 222 * | |
| 223 * Since: 4.0.0 | |
| 224 **/ | |
| 225 HB_EXTERN void | |
| 226 hb_draw_funcs_set_line_to_func (hb_draw_funcs_t *dfuncs, | |
| 227 hb_draw_line_to_func_t func, | |
| 228 void *user_data, hb_destroy_func_t destroy); | |
| 229 | |
| 230 /** | |
| 231 * hb_draw_funcs_set_quadratic_to_func: | |
| 232 * @dfuncs: draw functions object | |
| 233 * @func: (closure user_data) (destroy destroy) (scope notified): quadratic-to callback | |
| 234 * @user_data: Data to pass to @func | |
| 235 * @destroy: (nullable): The function to call when @user_data is not needed anymore | |
| 236 * | |
| 237 * Sets quadratic-to callback to the draw functions object. | |
| 238 * | |
| 239 * Since: 4.0.0 | |
| 240 **/ | |
| 241 HB_EXTERN void | |
| 242 hb_draw_funcs_set_quadratic_to_func (hb_draw_funcs_t *dfuncs, | |
| 243 hb_draw_quadratic_to_func_t func, | |
| 244 void *user_data, hb_destroy_func_t destroy); | |
| 245 | |
| 246 /** | |
| 247 * hb_draw_funcs_set_cubic_to_func: | |
| 248 * @dfuncs: draw functions | |
| 249 * @func: (closure user_data) (destroy destroy) (scope notified): cubic-to callback | |
| 250 * @user_data: Data to pass to @func | |
| 251 * @destroy: (nullable): The function to call when @user_data is not needed anymore | |
| 252 * | |
| 253 * Sets cubic-to callback to the draw functions object. | |
| 254 * | |
| 255 * Since: 4.0.0 | |
| 256 **/ | |
| 257 HB_EXTERN void | |
| 258 hb_draw_funcs_set_cubic_to_func (hb_draw_funcs_t *dfuncs, | |
| 259 hb_draw_cubic_to_func_t func, | |
| 260 void *user_data, hb_destroy_func_t destroy); | |
| 261 | |
| 262 /** | |
| 263 * hb_draw_funcs_set_close_path_func: | |
| 264 * @dfuncs: draw functions object | |
| 265 * @func: (closure user_data) (destroy destroy) (scope notified): close-path callback | |
| 266 * @user_data: Data to pass to @func | |
| 267 * @destroy: (nullable): The function to call when @user_data is not needed anymore | |
| 268 * | |
| 269 * Sets close-path callback to the draw functions object. | |
| 270 * | |
| 271 * Since: 4.0.0 | |
| 272 **/ | |
| 273 HB_EXTERN void | |
| 274 hb_draw_funcs_set_close_path_func (hb_draw_funcs_t *dfuncs, | |
| 275 hb_draw_close_path_func_t func, | |
| 276 void *user_data, hb_destroy_func_t destroy); | |
| 277 | |
| 278 | |
| 279 HB_EXTERN hb_draw_funcs_t * | |
| 280 hb_draw_funcs_create (void); | |
| 281 | |
| 282 HB_EXTERN hb_draw_funcs_t * | |
| 283 hb_draw_funcs_reference (hb_draw_funcs_t *dfuncs); | |
| 284 | |
| 285 HB_EXTERN void | |
| 286 hb_draw_funcs_destroy (hb_draw_funcs_t *dfuncs); | |
| 287 | |
| 288 HB_EXTERN void | |
| 289 hb_draw_funcs_make_immutable (hb_draw_funcs_t *dfuncs); | |
| 290 | |
| 291 HB_EXTERN hb_bool_t | |
| 292 hb_draw_funcs_is_immutable (hb_draw_funcs_t *dfuncs); | |
| 293 | |
| 294 | |
| 295 HB_EXTERN void | |
| 296 hb_draw_move_to (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 297 hb_draw_state_t *st, | |
| 298 float to_x, float to_y); | |
| 299 | |
| 300 HB_EXTERN void | |
| 301 hb_draw_line_to (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 302 hb_draw_state_t *st, | |
| 303 float to_x, float to_y); | |
| 304 | |
| 305 HB_EXTERN void | |
| 306 hb_draw_quadratic_to (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 307 hb_draw_state_t *st, | |
| 308 float control_x, float control_y, | |
| 309 float to_x, float to_y); | |
| 310 | |
| 311 HB_EXTERN void | |
| 312 hb_draw_cubic_to (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 313 hb_draw_state_t *st, | |
| 314 float control1_x, float control1_y, | |
| 315 float control2_x, float control2_y, | |
| 316 float to_x, float to_y); | |
| 317 | |
| 318 HB_EXTERN void | |
| 319 hb_draw_close_path (hb_draw_funcs_t *dfuncs, void *draw_data, | |
| 320 hb_draw_state_t *st); | |
| 321 | |
| 322 | |
| 323 HB_END_DECLS | |
| 324 | |
| 325 #endif /* HB_DRAW_H */ |
