![]() |
|
|||
File indexing completed on 2025-02-22 10:40:42
0001 /* 0002 * Copyright © 2019-2020 Ebrahim Byagowi 0003 * 0004 * This is part of HarfBuzz, a text shaping library. 0005 * 0006 * Permission is hereby granted, without written agreement and without 0007 * license or royalty fees, to use, copy, modify, and distribute this 0008 * software and its documentation for any purpose, provided that the 0009 * above copyright notice and the following two paragraphs appear in 0010 * all copies of this software. 0011 * 0012 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 0013 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 0014 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 0015 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 0016 * DAMAGE. 0017 * 0018 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 0019 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 0020 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 0021 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 0022 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 0023 */ 0024 0025 #if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) 0026 #error "Include <hb.h> instead." 0027 #endif 0028 0029 #ifndef HB_DRAW_H 0030 #define HB_DRAW_H 0031 0032 #include "hb.h" 0033 0034 HB_BEGIN_DECLS 0035 0036 0037 /** 0038 * hb_draw_state_t 0039 * @path_open: Whether there is an open path 0040 * @path_start_x: X component of the start of current path 0041 * @path_start_y: Y component of the start of current path 0042 * @current_x: X component of current point 0043 * @current_y: Y component of current point 0044 * 0045 * Current drawing state. 0046 * 0047 * Since: 4.0.0 0048 **/ 0049 typedef struct hb_draw_state_t { 0050 hb_bool_t path_open; 0051 0052 float path_start_x; 0053 float path_start_y; 0054 0055 float current_x; 0056 float current_y; 0057 0058 /*< private >*/ 0059 hb_var_num_t reserved1; 0060 hb_var_num_t reserved2; 0061 hb_var_num_t reserved3; 0062 hb_var_num_t reserved4; 0063 hb_var_num_t reserved5; 0064 hb_var_num_t reserved6; 0065 hb_var_num_t reserved7; 0066 } hb_draw_state_t; 0067 0068 /** 0069 * HB_DRAW_STATE_DEFAULT: 0070 * 0071 * The default #hb_draw_state_t at the start of glyph drawing. 0072 */ 0073 #define HB_DRAW_STATE_DEFAULT {0, 0.f, 0.f, 0.f, 0.f, {0.}, {0.}, {0.}} 0074 0075 0076 /** 0077 * hb_draw_funcs_t: 0078 * 0079 * Glyph draw callbacks. 0080 * 0081 * #hb_draw_move_to_func_t, #hb_draw_line_to_func_t and 0082 * #hb_draw_cubic_to_func_t calls are necessary to be defined but we translate 0083 * #hb_draw_quadratic_to_func_t calls to #hb_draw_cubic_to_func_t if the 0084 * callback isn't defined. 0085 * 0086 * Since: 4.0.0 0087 **/ 0088 0089 typedef struct hb_draw_funcs_t hb_draw_funcs_t; 0090 0091 0092 /** 0093 * hb_draw_move_to_func_t: 0094 * @dfuncs: draw functions object 0095 * @draw_data: The data accompanying the draw functions in hb_font_draw_glyph() 0096 * @st: current draw state 0097 * @to_x: X component of target point 0098 * @to_y: Y component of target point 0099 * @user_data: User data pointer passed to hb_draw_funcs_set_move_to_func() 0100 * 0101 * A virtual method for the #hb_draw_funcs_t to perform a "move-to" draw 0102 * operation. 0103 * 0104 * Since: 4.0.0 0105 * 0106 **/ 0107 typedef void (*hb_draw_move_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, 0108 hb_draw_state_t *st, 0109 float to_x, float to_y, 0110 void *user_data); 0111 0112 /** 0113 * hb_draw_line_to_func_t: 0114 * @dfuncs: draw functions object 0115 * @draw_data: The data accompanying the draw functions in hb_font_draw_glyph() 0116 * @st: current draw state 0117 * @to_x: X component of target point 0118 * @to_y: Y component of target point 0119 * @user_data: User data pointer passed to hb_draw_funcs_set_line_to_func() 0120 * 0121 * A virtual method for the #hb_draw_funcs_t to perform a "line-to" draw 0122 * operation. 0123 * 0124 * Since: 4.0.0 0125 * 0126 **/ 0127 typedef void (*hb_draw_line_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, 0128 hb_draw_state_t *st, 0129 float to_x, float to_y, 0130 void *user_data); 0131 0132 /** 0133 * hb_draw_quadratic_to_func_t: 0134 * @dfuncs: draw functions object 0135 * @draw_data: The data accompanying the draw functions in hb_font_draw_glyph() 0136 * @st: current draw state 0137 * @control_x: X component of control point 0138 * @control_y: Y component of control point 0139 * @to_x: X component of target point 0140 * @to_y: Y component of target point 0141 * @user_data: User data pointer passed to hb_draw_funcs_set_quadratic_to_func() 0142 * 0143 * A virtual method for the #hb_draw_funcs_t to perform a "quadratic-to" draw 0144 * operation. 0145 * 0146 * Since: 4.0.0 0147 * 0148 **/ 0149 typedef void (*hb_draw_quadratic_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, 0150 hb_draw_state_t *st, 0151 float control_x, float control_y, 0152 float to_x, float to_y, 0153 void *user_data); 0154 0155 /** 0156 * hb_draw_cubic_to_func_t: 0157 * @dfuncs: draw functions object 0158 * @draw_data: The data accompanying the draw functions in hb_font_draw_glyph() 0159 * @st: current draw state 0160 * @control1_x: X component of first control point 0161 * @control1_y: Y component of first control point 0162 * @control2_x: X component of second control point 0163 * @control2_y: Y component of second control point 0164 * @to_x: X component of target point 0165 * @to_y: Y component of target point 0166 * @user_data: User data pointer passed to hb_draw_funcs_set_cubic_to_func() 0167 * 0168 * A virtual method for the #hb_draw_funcs_t to perform a "cubic-to" draw 0169 * operation. 0170 * 0171 * Since: 4.0.0 0172 * 0173 **/ 0174 typedef void (*hb_draw_cubic_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, 0175 hb_draw_state_t *st, 0176 float control1_x, float control1_y, 0177 float control2_x, float control2_y, 0178 float to_x, float to_y, 0179 void *user_data); 0180 0181 /** 0182 * hb_draw_close_path_func_t: 0183 * @dfuncs: draw functions object 0184 * @draw_data: The data accompanying the draw functions in hb_font_draw_glyph() 0185 * @st: current draw state 0186 * @user_data: User data pointer passed to hb_draw_funcs_set_close_path_func() 0187 * 0188 * A virtual method for the #hb_draw_funcs_t to perform a "close-path" draw 0189 * operation. 0190 * 0191 * Since: 4.0.0 0192 * 0193 **/ 0194 typedef void (*hb_draw_close_path_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data, 0195 hb_draw_state_t *st, 0196 void *user_data); 0197 0198 /** 0199 * hb_draw_funcs_set_move_to_func: 0200 * @dfuncs: draw functions object 0201 * @func: (closure user_data) (destroy destroy) (scope notified): move-to callback 0202 * @user_data: Data to pass to @func 0203 * @destroy: (nullable): The function to call when @user_data is not needed anymore 0204 * 0205 * Sets move-to callback to the draw functions object. 0206 * 0207 * Since: 4.0.0 0208 **/ 0209 HB_EXTERN void 0210 hb_draw_funcs_set_move_to_func (hb_draw_funcs_t *dfuncs, 0211 hb_draw_move_to_func_t func, 0212 void *user_data, hb_destroy_func_t destroy); 0213 0214 /** 0215 * hb_draw_funcs_set_line_to_func: 0216 * @dfuncs: draw functions object 0217 * @func: (closure user_data) (destroy destroy) (scope notified): line-to callback 0218 * @user_data: Data to pass to @func 0219 * @destroy: (nullable): The function to call when @user_data is not needed anymore 0220 * 0221 * Sets line-to callback to the draw functions object. 0222 * 0223 * Since: 4.0.0 0224 **/ 0225 HB_EXTERN void 0226 hb_draw_funcs_set_line_to_func (hb_draw_funcs_t *dfuncs, 0227 hb_draw_line_to_func_t func, 0228 void *user_data, hb_destroy_func_t destroy); 0229 0230 /** 0231 * hb_draw_funcs_set_quadratic_to_func: 0232 * @dfuncs: draw functions object 0233 * @func: (closure user_data) (destroy destroy) (scope notified): quadratic-to callback 0234 * @user_data: Data to pass to @func 0235 * @destroy: (nullable): The function to call when @user_data is not needed anymore 0236 * 0237 * Sets quadratic-to callback to the draw functions object. 0238 * 0239 * Since: 4.0.0 0240 **/ 0241 HB_EXTERN void 0242 hb_draw_funcs_set_quadratic_to_func (hb_draw_funcs_t *dfuncs, 0243 hb_draw_quadratic_to_func_t func, 0244 void *user_data, hb_destroy_func_t destroy); 0245 0246 /** 0247 * hb_draw_funcs_set_cubic_to_func: 0248 * @dfuncs: draw functions 0249 * @func: (closure user_data) (destroy destroy) (scope notified): cubic-to callback 0250 * @user_data: Data to pass to @func 0251 * @destroy: (nullable): The function to call when @user_data is not needed anymore 0252 * 0253 * Sets cubic-to callback to the draw functions object. 0254 * 0255 * Since: 4.0.0 0256 **/ 0257 HB_EXTERN void 0258 hb_draw_funcs_set_cubic_to_func (hb_draw_funcs_t *dfuncs, 0259 hb_draw_cubic_to_func_t func, 0260 void *user_data, hb_destroy_func_t destroy); 0261 0262 /** 0263 * hb_draw_funcs_set_close_path_func: 0264 * @dfuncs: draw functions object 0265 * @func: (closure user_data) (destroy destroy) (scope notified): close-path callback 0266 * @user_data: Data to pass to @func 0267 * @destroy: (nullable): The function to call when @user_data is not needed anymore 0268 * 0269 * Sets close-path callback to the draw functions object. 0270 * 0271 * Since: 4.0.0 0272 **/ 0273 HB_EXTERN void 0274 hb_draw_funcs_set_close_path_func (hb_draw_funcs_t *dfuncs, 0275 hb_draw_close_path_func_t func, 0276 void *user_data, hb_destroy_func_t destroy); 0277 0278 0279 HB_EXTERN hb_draw_funcs_t * 0280 hb_draw_funcs_create (void); 0281 0282 HB_EXTERN hb_draw_funcs_t * 0283 hb_draw_funcs_get_empty (void); 0284 0285 HB_EXTERN hb_draw_funcs_t * 0286 hb_draw_funcs_reference (hb_draw_funcs_t *dfuncs); 0287 0288 HB_EXTERN void 0289 hb_draw_funcs_destroy (hb_draw_funcs_t *dfuncs); 0290 0291 HB_EXTERN hb_bool_t 0292 hb_draw_funcs_set_user_data (hb_draw_funcs_t *dfuncs, 0293 hb_user_data_key_t *key, 0294 void * data, 0295 hb_destroy_func_t destroy, 0296 hb_bool_t replace); 0297 0298 0299 HB_EXTERN void * 0300 hb_draw_funcs_get_user_data (const hb_draw_funcs_t *dfuncs, 0301 hb_user_data_key_t *key); 0302 0303 HB_EXTERN void 0304 hb_draw_funcs_make_immutable (hb_draw_funcs_t *dfuncs); 0305 0306 HB_EXTERN hb_bool_t 0307 hb_draw_funcs_is_immutable (hb_draw_funcs_t *dfuncs); 0308 0309 0310 HB_EXTERN void 0311 hb_draw_move_to (hb_draw_funcs_t *dfuncs, void *draw_data, 0312 hb_draw_state_t *st, 0313 float to_x, float to_y); 0314 0315 HB_EXTERN void 0316 hb_draw_line_to (hb_draw_funcs_t *dfuncs, void *draw_data, 0317 hb_draw_state_t *st, 0318 float to_x, float to_y); 0319 0320 HB_EXTERN void 0321 hb_draw_quadratic_to (hb_draw_funcs_t *dfuncs, void *draw_data, 0322 hb_draw_state_t *st, 0323 float control_x, float control_y, 0324 float to_x, float to_y); 0325 0326 HB_EXTERN void 0327 hb_draw_cubic_to (hb_draw_funcs_t *dfuncs, void *draw_data, 0328 hb_draw_state_t *st, 0329 float control1_x, float control1_y, 0330 float control2_x, float control2_y, 0331 float to_x, float to_y); 0332 0333 HB_EXTERN void 0334 hb_draw_close_path (hb_draw_funcs_t *dfuncs, void *draw_data, 0335 hb_draw_state_t *st); 0336 0337 0338 HB_END_DECLS 0339 0340 #endif /* HB_DRAW_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |