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 #ifdef HB_EXPERIMENTAL_API 37 typedef void (*hb_draw_move_to_func_t) (hb_position_t to_x, hb_position_t to_y, void *user_data); 38 typedef void (*hb_draw_line_to_func_t) (hb_position_t to_x, hb_position_t to_y, void *user_data); 39 typedef void (*hb_draw_quadratic_to_func_t) (hb_position_t control_x, hb_position_t control_y, 40 hb_position_t to_x, hb_position_t to_y, 41 void *user_data); 42 typedef void (*hb_draw_cubic_to_func_t) (hb_position_t control1_x, hb_position_t control1_y, 43 hb_position_t control2_x, hb_position_t control2_y, 44 hb_position_t to_x, hb_position_t to_y, 45 void *user_data); 46 typedef void (*hb_draw_close_path_func_t) (void *user_data); 47 48 /** 49 * hb_draw_funcs_t: 50 * 51 * Glyph draw callbacks. 52 * 53 * _move_to, _line_to and _cubic_to calls are nessecary to be defined but we 54 * translate _quadratic_to calls to _cubic_to if the callback isn't defined. 55 * 56 * Since: EXPERIMENTAL 57 **/ 58 typedef struct hb_draw_funcs_t hb_draw_funcs_t; 59 60 HB_EXTERN void 61 hb_draw_funcs_set_move_to_func (hb_draw_funcs_t *funcs, 62 hb_draw_move_to_func_t move_to); 63 64 HB_EXTERN void 65 hb_draw_funcs_set_line_to_func (hb_draw_funcs_t *funcs, 66 hb_draw_line_to_func_t line_to); 67 68 HB_EXTERN void 69 hb_draw_funcs_set_quadratic_to_func (hb_draw_funcs_t *funcs, 70 hb_draw_quadratic_to_func_t quadratic_to); 71 72 HB_EXTERN void 73 hb_draw_funcs_set_cubic_to_func (hb_draw_funcs_t *funcs, 74 hb_draw_cubic_to_func_t cubic_to); 75 76 HB_EXTERN void 77 hb_draw_funcs_set_close_path_func (hb_draw_funcs_t *funcs, 78 hb_draw_close_path_func_t close_path); 79 80 HB_EXTERN hb_draw_funcs_t * 81 hb_draw_funcs_create (void); 82 83 HB_EXTERN hb_draw_funcs_t * 84 hb_draw_funcs_reference (hb_draw_funcs_t *funcs); 85 86 HB_EXTERN void 87 hb_draw_funcs_destroy (hb_draw_funcs_t *funcs); 88 89 HB_EXTERN void 90 hb_draw_funcs_make_immutable (hb_draw_funcs_t *funcs); 91 92 HB_EXTERN hb_bool_t 93 hb_draw_funcs_is_immutable (hb_draw_funcs_t *funcs); 94 #endif 95 96 HB_END_DECLS 97 98 #endif /* HB_DRAW_H */ 99