![]() |
|
|||
Warning, file /include/harfbuzz/hb-paint.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright © 2022 Matthias Clasen 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_PAINT_H 0030 #define HB_PAINT_H 0031 0032 #include "hb-common.h" 0033 0034 HB_BEGIN_DECLS 0035 0036 0037 /** 0038 * hb_paint_funcs_t: 0039 * 0040 * Glyph paint callbacks. 0041 * 0042 * The callbacks assume that the caller maintains a stack 0043 * of current transforms, clips and intermediate surfaces, 0044 * as evidenced by the pairs of push/pop callbacks. The 0045 * push/pop calls will be properly nested, so it is fine 0046 * to store the different kinds of object on a single stack. 0047 * 0048 * Not all callbacks are required for all kinds of glyphs. 0049 * For rendering COLRv0 or non-color outline glyphs, the 0050 * gradient callbacks are not needed, and the composite 0051 * callback only needs to handle simple alpha compositing 0052 * (#HB_PAINT_COMPOSITE_MODE_SRC_OVER). 0053 * 0054 * The paint-image callback is only needed for glyphs 0055 * with image blobs in the CBDT, sbix or SVG tables. 0056 * 0057 * The custom-palette-color callback is only necessary if 0058 * you want to override colors from the font palette with 0059 * custom colors. 0060 * 0061 * Since: 7.0.0 0062 **/ 0063 typedef struct hb_paint_funcs_t hb_paint_funcs_t; 0064 0065 HB_EXTERN hb_paint_funcs_t * 0066 hb_paint_funcs_create (void); 0067 0068 HB_EXTERN hb_paint_funcs_t * 0069 hb_paint_funcs_get_empty (void); 0070 0071 HB_EXTERN hb_paint_funcs_t * 0072 hb_paint_funcs_reference (hb_paint_funcs_t *funcs); 0073 0074 HB_EXTERN void 0075 hb_paint_funcs_destroy (hb_paint_funcs_t *funcs); 0076 0077 HB_EXTERN hb_bool_t 0078 hb_paint_funcs_set_user_data (hb_paint_funcs_t *funcs, 0079 hb_user_data_key_t *key, 0080 void * data, 0081 hb_destroy_func_t destroy, 0082 hb_bool_t replace); 0083 0084 0085 HB_EXTERN void * 0086 hb_paint_funcs_get_user_data (const hb_paint_funcs_t *funcs, 0087 hb_user_data_key_t *key); 0088 0089 HB_EXTERN void 0090 hb_paint_funcs_make_immutable (hb_paint_funcs_t *funcs); 0091 0092 HB_EXTERN hb_bool_t 0093 hb_paint_funcs_is_immutable (hb_paint_funcs_t *funcs); 0094 0095 /** 0096 * hb_paint_push_transform_func_t: 0097 * @funcs: paint functions object 0098 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0099 * @xx: xx component of the transform matrix 0100 * @yx: yx component of the transform matrix 0101 * @xy: xy component of the transform matrix 0102 * @yy: yy component of the transform matrix 0103 * @dx: dx component of the transform matrix 0104 * @dy: dy component of the transform matrix 0105 * @user_data: User data pointer passed to hb_paint_funcs_set_push_transform_func() 0106 * 0107 * A virtual method for the #hb_paint_funcs_t to apply 0108 * a transform to subsequent paint calls. 0109 * 0110 * This transform is applied after the current transform, 0111 * and remains in effect until a matching call to 0112 * the #hb_paint_funcs_pop_transform_func_t vfunc. 0113 * 0114 * Since: 7.0.0 0115 */ 0116 typedef void (*hb_paint_push_transform_func_t) (hb_paint_funcs_t *funcs, 0117 void *paint_data, 0118 float xx, float yx, 0119 float xy, float yy, 0120 float dx, float dy, 0121 void *user_data); 0122 0123 /** 0124 * hb_paint_pop_transform_func_t: 0125 * @funcs: paint functions object 0126 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0127 * @user_data: User data pointer passed to hb_paint_funcs_set_pop_transform_func() 0128 * 0129 * A virtual method for the #hb_paint_funcs_t to undo 0130 * the effect of a prior call to the #hb_paint_funcs_push_transform_func_t 0131 * vfunc. 0132 * 0133 * Since: 7.0.0 0134 */ 0135 typedef void (*hb_paint_pop_transform_func_t) (hb_paint_funcs_t *funcs, 0136 void *paint_data, 0137 void *user_data); 0138 0139 /** 0140 * hb_paint_color_glyph_func_t: 0141 * @funcs: paint functions object 0142 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0143 * @glyph: the glyph ID 0144 * @font: the font 0145 * @user_data: User data pointer passed to hb_paint_funcs_set_color_glyph_func() 0146 * 0147 * A virtual method for the #hb_paint_funcs_t to render a color glyph by glyph index. 0148 * 0149 * Return value: `true` if the glyph was painted, `false` otherwise. 0150 * 0151 * Since: 8.2.0 0152 */ 0153 typedef hb_bool_t (*hb_paint_color_glyph_func_t) (hb_paint_funcs_t *funcs, 0154 void *paint_data, 0155 hb_codepoint_t glyph, 0156 hb_font_t *font, 0157 void *user_data); 0158 0159 /** 0160 * hb_paint_push_clip_glyph_func_t: 0161 * @funcs: paint functions object 0162 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0163 * @glyph: the glyph ID 0164 * @font: the font 0165 * @user_data: User data pointer passed to hb_paint_funcs_set_push_clip_glyph_func() 0166 * 0167 * A virtual method for the #hb_paint_funcs_t to clip 0168 * subsequent paint calls to the outline of a glyph. 0169 * 0170 * The coordinates of the glyph outline are expected in the 0171 * current @font scale (ie. the results of calling 0172 * hb_font_draw_glyph() with @font). The outline is 0173 * transformed by the current transform. 0174 * 0175 * This clip is applied in addition to the current clip, 0176 * and remains in effect until a matching call to 0177 * the #hb_paint_funcs_pop_clip_func_t vfunc. 0178 * 0179 * Since: 7.0.0 0180 */ 0181 typedef void (*hb_paint_push_clip_glyph_func_t) (hb_paint_funcs_t *funcs, 0182 void *paint_data, 0183 hb_codepoint_t glyph, 0184 hb_font_t *font, 0185 void *user_data); 0186 0187 /** 0188 * hb_paint_push_clip_rectangle_func_t: 0189 * @funcs: paint functions object 0190 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0191 * @xmin: min X for the rectangle 0192 * @ymin: min Y for the rectangle 0193 * @xmax: max X for the rectangle 0194 * @ymax: max Y for the rectangle 0195 * @user_data: User data pointer passed to hb_paint_funcs_set_push_clip_rectangle_func() 0196 * 0197 * A virtual method for the #hb_paint_funcs_t to clip 0198 * subsequent paint calls to a rectangle. 0199 * 0200 * The coordinates of the rectangle are interpreted according 0201 * to the current transform. 0202 * 0203 * This clip is applied in addition to the current clip, 0204 * and remains in effect until a matching call to 0205 * the #hb_paint_funcs_pop_clip_func_t vfunc. 0206 * 0207 * Since: 7.0.0 0208 */ 0209 typedef void (*hb_paint_push_clip_rectangle_func_t) (hb_paint_funcs_t *funcs, 0210 void *paint_data, 0211 float xmin, float ymin, 0212 float xmax, float ymax, 0213 void *user_data); 0214 0215 /** 0216 * hb_paint_pop_clip_func_t: 0217 * @funcs: paint functions object 0218 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0219 * @user_data: User data pointer passed to hb_paint_funcs_set_pop_clip_func() 0220 * 0221 * A virtual method for the #hb_paint_funcs_t to undo 0222 * the effect of a prior call to the #hb_paint_funcs_push_clip_glyph_func_t 0223 * or #hb_paint_funcs_push_clip_rectangle_func_t vfuncs. 0224 * 0225 * Since: 7.0.0 0226 */ 0227 typedef void (*hb_paint_pop_clip_func_t) (hb_paint_funcs_t *funcs, 0228 void *paint_data, 0229 void *user_data); 0230 0231 /** 0232 * hb_paint_color_func_t: 0233 * @funcs: paint functions object 0234 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0235 * @is_foreground: whether the color is the foreground 0236 * @color: The color to use, unpremultiplied 0237 * @user_data: User data pointer passed to hb_paint_funcs_set_color_func() 0238 * 0239 * A virtual method for the #hb_paint_funcs_t to paint a 0240 * color everywhere within the current clip. 0241 * 0242 * Since: 7.0.0 0243 */ 0244 typedef void (*hb_paint_color_func_t) (hb_paint_funcs_t *funcs, 0245 void *paint_data, 0246 hb_bool_t is_foreground, 0247 hb_color_t color, 0248 void *user_data); 0249 0250 /** 0251 * HB_PAINT_IMAGE_FORMAT_PNG: 0252 * 0253 * Tag identifying PNG images in #hb_paint_image_func_t callbacks. 0254 * 0255 * Since: 7.0.0 0256 */ 0257 #define HB_PAINT_IMAGE_FORMAT_PNG HB_TAG('p','n','g',' ') 0258 0259 /** 0260 * HB_PAINT_IMAGE_FORMAT_SVG: 0261 * 0262 * Tag identifying SVG images in #hb_paint_image_func_t callbacks. 0263 * 0264 * Since: 7.0.0 0265 */ 0266 #define HB_PAINT_IMAGE_FORMAT_SVG HB_TAG('s','v','g',' ') 0267 0268 /** 0269 * HB_PAINT_IMAGE_FORMAT_BGRA: 0270 * 0271 * Tag identifying raw pixel-data images in #hb_paint_image_func_t callbacks. 0272 * The data is in BGRA pre-multiplied sRGBA color-space format. 0273 * 0274 * Since: 7.0.0 0275 */ 0276 #define HB_PAINT_IMAGE_FORMAT_BGRA HB_TAG('B','G','R','A') 0277 0278 /** 0279 * hb_paint_image_func_t: 0280 * @funcs: paint functions object 0281 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0282 * @image: the image data 0283 * @width: width of the raster image in pixels, or 0 0284 * @height: height of the raster image in pixels, or 0 0285 * @format: the image format as a tag 0286 * @slant: Deprecated. Always set to 0.0. 0287 * @extents: (nullable): glyph extents for desired rendering 0288 * @user_data: User data pointer passed to hb_paint_funcs_set_image_func() 0289 * 0290 * A virtual method for the #hb_paint_funcs_t to paint a glyph image. 0291 * 0292 * This method is called for glyphs with image blobs in the CBDT, 0293 * sbix or SVG tables. The @format identifies the kind of data that 0294 * is contained in @image. Possible values include #HB_PAINT_IMAGE_FORMAT_PNG, 0295 * #HB_PAINT_IMAGE_FORMAT_SVG and #HB_PAINT_IMAGE_FORMAT_BGRA. 0296 * 0297 * The image dimensions and glyph extents are provided if available, 0298 * and should be used to size and position the image. 0299 * 0300 * Return value: Whether the operation was successful. 0301 * 0302 * Since: 7.0.0 0303 */ 0304 typedef hb_bool_t (*hb_paint_image_func_t) (hb_paint_funcs_t *funcs, 0305 void *paint_data, 0306 hb_blob_t *image, 0307 unsigned int width, 0308 unsigned int height, 0309 hb_tag_t format, 0310 float slant, 0311 hb_glyph_extents_t *extents, 0312 void *user_data); 0313 0314 /** 0315 * hb_color_stop_t: 0316 * @offset: the offset of the color stop 0317 * @is_foreground: whether the color is the foreground 0318 * @color: the color, unpremultiplied 0319 * 0320 * Information about a color stop on a color line. 0321 * 0322 * Color lines typically have offsets ranging between 0 and 1, 0323 * but that is not required. 0324 * 0325 * Note: despite @color being unpremultiplied here, interpolation in 0326 * gradients shall happen in premultiplied space. See the OpenType spec 0327 * [COLR](https://learn.microsoft.com/en-us/typography/opentype/spec/colr) 0328 * section for details. 0329 * 0330 * Since: 7.0.0 0331 */ 0332 typedef struct { 0333 float offset; 0334 hb_bool_t is_foreground; 0335 hb_color_t color; 0336 } hb_color_stop_t; 0337 0338 /** 0339 * hb_paint_extend_t: 0340 * @HB_PAINT_EXTEND_PAD: Outside the defined interval, 0341 * the color of the closest color stop is used. 0342 * @HB_PAINT_EXTEND_REPEAT: The color line is repeated over 0343 * repeated multiples of the defined interval 0344 * @HB_PAINT_EXTEND_REFLECT: The color line is repeated over 0345 * repeated intervals, as for the repeat mode. 0346 * However, in each repeated interval, the ordering of 0347 * color stops is the reverse of the adjacent interval. 0348 * 0349 * The values of this enumeration determine how color values 0350 * outside the minimum and maximum defined offset on a #hb_color_line_t 0351 * are determined. 0352 * 0353 * See the OpenType spec [COLR](https://learn.microsoft.com/en-us/typography/opentype/spec/colr) 0354 * section for details. 0355 * 0356 * Since: 7.0.0 0357 */ 0358 typedef enum { 0359 HB_PAINT_EXTEND_PAD, 0360 HB_PAINT_EXTEND_REPEAT, 0361 HB_PAINT_EXTEND_REFLECT 0362 } hb_paint_extend_t; 0363 0364 typedef struct hb_color_line_t hb_color_line_t; 0365 0366 /** 0367 * hb_color_line_get_color_stops_func_t: 0368 * @color_line: a #hb_color_line_t object 0369 * @color_line_data: the data accompanying @color_line 0370 * @start: the index of the first color stop to return 0371 * @count: (inout) (optional): Input = the maximum number of feature tags to return; 0372 * Output = the actual number of feature tags returned (may be zero) 0373 * @color_stops: (out) (array length=count) (optional): Array of #hb_color_stop_t to populate 0374 * @user_data: the data accompanying this method 0375 * 0376 * A virtual method for the #hb_color_line_t to fetch color stops. 0377 * 0378 * Return value: the total number of color stops in @color_line 0379 * 0380 * Since: 7.0.0 0381 */ 0382 typedef unsigned int (*hb_color_line_get_color_stops_func_t) (hb_color_line_t *color_line, 0383 void *color_line_data, 0384 unsigned int start, 0385 unsigned int *count, 0386 hb_color_stop_t *color_stops, 0387 void *user_data); 0388 0389 /** 0390 * hb_color_line_get_extend_func_t: 0391 * @color_line: a #hb_color_line_t object 0392 * @color_line_data: the data accompanying @color_line 0393 * @user_data: the data accompanying this method 0394 * 0395 * A virtual method for the @hb_color_line_t to fetches the extend mode. 0396 * 0397 * Return value: the extend mode of @color_line 0398 * 0399 * Since: 7.0.0 0400 */ 0401 typedef hb_paint_extend_t (*hb_color_line_get_extend_func_t) (hb_color_line_t *color_line, 0402 void *color_line_data, 0403 void *user_data); 0404 0405 /** 0406 * hb_color_line_t: 0407 * 0408 * A struct containing color information for a gradient. 0409 * 0410 * Since: 7.0.0 0411 */ 0412 struct hb_color_line_t { 0413 void *data; 0414 0415 hb_color_line_get_color_stops_func_t get_color_stops; 0416 void *get_color_stops_user_data; 0417 0418 hb_color_line_get_extend_func_t get_extend; 0419 void *get_extend_user_data; 0420 0421 void *reserved0; 0422 void *reserved1; 0423 void *reserved2; 0424 void *reserved3; 0425 void *reserved5; 0426 void *reserved6; 0427 void *reserved7; 0428 void *reserved8; 0429 }; 0430 0431 HB_EXTERN unsigned int 0432 hb_color_line_get_color_stops (hb_color_line_t *color_line, 0433 unsigned int start, 0434 unsigned int *count, 0435 hb_color_stop_t *color_stops); 0436 0437 HB_EXTERN hb_paint_extend_t 0438 hb_color_line_get_extend (hb_color_line_t *color_line); 0439 0440 /** 0441 * hb_paint_linear_gradient_func_t: 0442 * @funcs: paint functions object 0443 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0444 * @color_line: Color information for the gradient 0445 * @x0: X coordinate of the first point 0446 * @y0: Y coordinate of the first point 0447 * @x1: X coordinate of the second point 0448 * @y1: Y coordinate of the second point 0449 * @x2: X coordinate of the third point 0450 * @y2: Y coordinate of the third point 0451 * @user_data: User data pointer passed to hb_paint_funcs_set_linear_gradient_func() 0452 * 0453 * A virtual method for the #hb_paint_funcs_t to paint a linear 0454 * gradient everywhere within the current clip. 0455 * 0456 * The @color_line object contains information about the colors of the gradients. 0457 * It is only valid for the duration of the callback, you cannot keep it around. 0458 * 0459 * The coordinates of the points are interpreted according 0460 * to the current transform. 0461 * 0462 * See the OpenType spec [COLR](https://learn.microsoft.com/en-us/typography/opentype/spec/colr) 0463 * section for details on how the points define the direction 0464 * of the gradient, and how to interpret the @color_line. 0465 * 0466 * Since: 7.0.0 0467 */ 0468 typedef void (*hb_paint_linear_gradient_func_t) (hb_paint_funcs_t *funcs, 0469 void *paint_data, 0470 hb_color_line_t *color_line, 0471 float x0, float y0, 0472 float x1, float y1, 0473 float x2, float y2, 0474 void *user_data); 0475 0476 /** 0477 * hb_paint_radial_gradient_func_t: 0478 * @funcs: paint functions object 0479 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0480 * @color_line: Color information for the gradient 0481 * @x0: X coordinate of the first circle's center 0482 * @y0: Y coordinate of the first circle's center 0483 * @r0: radius of the first circle 0484 * @x1: X coordinate of the second circle's center 0485 * @y1: Y coordinate of the second circle's center 0486 * @r1: radius of the second circle 0487 * @user_data: User data pointer passed to hb_paint_funcs_set_radial_gradient_func() 0488 * 0489 * A virtual method for the #hb_paint_funcs_t to paint a radial 0490 * gradient everywhere within the current clip. 0491 * 0492 * The @color_line object contains information about the colors of the gradients. 0493 * It is only valid for the duration of the callback, you cannot keep it around. 0494 * 0495 * The coordinates of the points are interpreted according 0496 * to the current transform. 0497 * 0498 * See the OpenType spec [COLR](https://learn.microsoft.com/en-us/typography/opentype/spec/colr) 0499 * section for details on how the points define the direction 0500 * of the gradient, and how to interpret the @color_line. 0501 * 0502 * Since: 7.0.0 0503 */ 0504 typedef void (*hb_paint_radial_gradient_func_t) (hb_paint_funcs_t *funcs, 0505 void *paint_data, 0506 hb_color_line_t *color_line, 0507 float x0, float y0, float r0, 0508 float x1, float y1, float r1, 0509 void *user_data); 0510 0511 /** 0512 * hb_paint_sweep_gradient_func_t: 0513 * @funcs: paint functions object 0514 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0515 * @color_line: Color information for the gradient 0516 * @x0: X coordinate of the circle's center 0517 * @y0: Y coordinate of the circle's center 0518 * @start_angle: the start angle, in radians 0519 * @end_angle: the end angle, in radians 0520 * @user_data: User data pointer passed to hb_paint_funcs_set_sweep_gradient_func() 0521 * 0522 * A virtual method for the #hb_paint_funcs_t to paint a sweep 0523 * gradient everywhere within the current clip. 0524 * 0525 * The @color_line object contains information about the colors of the gradients. 0526 * It is only valid for the duration of the callback, you cannot keep it around. 0527 * 0528 * The coordinates of the points are interpreted according 0529 * to the current transform. 0530 * 0531 * See the OpenType spec [COLR](https://learn.microsoft.com/en-us/typography/opentype/spec/colr) 0532 * section for details on how the points define the direction 0533 * of the gradient, and how to interpret the @color_line. 0534 * 0535 * Since: 7.0.0 0536 */ 0537 typedef void (*hb_paint_sweep_gradient_func_t) (hb_paint_funcs_t *funcs, 0538 void *paint_data, 0539 hb_color_line_t *color_line, 0540 float x0, float y0, 0541 float start_angle, 0542 float end_angle, 0543 void *user_data); 0544 0545 /** 0546 * hb_paint_composite_mode_t: 0547 * @HB_PAINT_COMPOSITE_MODE_CLEAR: clear destination layer (bounded) 0548 * @HB_PAINT_COMPOSITE_MODE_SRC: replace destination layer (bounded) 0549 * @HB_PAINT_COMPOSITE_MODE_SRC_OVER: draw source layer on top of destination layer 0550 * (bounded) 0551 * @HB_PAINT_COMPOSITE_MODE_SRC_IN: draw source where there was destination content 0552 * (unbounded) 0553 * @HB_PAINT_COMPOSITE_MODE_SRC_OUT: draw source where there was no destination 0554 * content (unbounded) 0555 * @HB_PAINT_COMPOSITE_MODE_SRC_ATOP: draw source on top of destination content and 0556 * only there 0557 * @HB_PAINT_COMPOSITE_MODE_DEST: ignore the source 0558 * @HB_PAINT_COMPOSITE_MODE_DEST_OVER: draw destination on top of source 0559 * @HB_PAINT_COMPOSITE_MODE_DEST_IN: leave destination only where there was 0560 * source content (unbounded) 0561 * @HB_PAINT_COMPOSITE_MODE_DEST_OUT: leave destination only where there was no 0562 * source content 0563 * @HB_PAINT_COMPOSITE_MODE_DEST_ATOP: leave destination on top of source content 0564 * and only there (unbounded) 0565 * @HB_PAINT_COMPOSITE_MODE_XOR: source and destination are shown where there is only 0566 * one of them 0567 * @HB_PAINT_COMPOSITE_MODE_PLUS: source and destination layers are accumulated 0568 * @HB_PAINT_COMPOSITE_MODE_MULTIPLY: source and destination layers are multiplied. 0569 * This causes the result to be at least as dark as the darker inputs. 0570 * @HB_PAINT_COMPOSITE_MODE_SCREEN: source and destination are complemented and 0571 * multiplied. This causes the result to be at least as light as the lighter 0572 * inputs. 0573 * @HB_PAINT_COMPOSITE_MODE_OVERLAY: multiplies or screens, depending on the 0574 * lightness of the destination color. 0575 * @HB_PAINT_COMPOSITE_MODE_DARKEN: replaces the destination with the source if it 0576 * is darker, otherwise keeps the source. 0577 * @HB_PAINT_COMPOSITE_MODE_LIGHTEN: replaces the destination with the source if it 0578 * is lighter, otherwise keeps the source. 0579 * @HB_PAINT_COMPOSITE_MODE_COLOR_DODGE: brightens the destination color to reflect 0580 * the source color. 0581 * @HB_PAINT_COMPOSITE_MODE_COLOR_BURN: darkens the destination color to reflect 0582 * the source color. 0583 * @HB_PAINT_COMPOSITE_MODE_HARD_LIGHT: Multiplies or screens, dependent on source 0584 * color. 0585 * @HB_PAINT_COMPOSITE_MODE_SOFT_LIGHT: Darkens or lightens, dependent on source 0586 * color. 0587 * @HB_PAINT_COMPOSITE_MODE_DIFFERENCE: Takes the difference of the source and 0588 * destination color. 0589 * @HB_PAINT_COMPOSITE_MODE_EXCLUSION: Produces an effect similar to difference, but 0590 * with lower contrast. 0591 * @HB_PAINT_COMPOSITE_MODE_HSL_HUE: Creates a color with the hue of the source 0592 * and the saturation and luminosity of the target. 0593 * @HB_PAINT_COMPOSITE_MODE_HSL_SATURATION: Creates a color with the saturation 0594 * of the source and the hue and luminosity of the target. Painting with 0595 * this mode onto a gray area produces no change. 0596 * @HB_PAINT_COMPOSITE_MODE_HSL_COLOR: Creates a color with the hue and saturation 0597 * of the source and the luminosity of the target. This preserves the gray 0598 * levels of the target and is useful for coloring monochrome images or 0599 * tinting color images. 0600 * @HB_PAINT_COMPOSITE_MODE_HSL_LUMINOSITY: Creates a color with the luminosity of 0601 * the source and the hue and saturation of the target. This produces an 0602 * inverse effect to @HB_PAINT_COMPOSITE_MODE_HSL_COLOR. 0603 * 0604 * The values of this enumeration describe the compositing modes 0605 * that can be used when combining temporary redirected drawing 0606 * with the backdrop. 0607 * 0608 * See the OpenType spec [COLR](https://learn.microsoft.com/en-us/typography/opentype/spec/colr) 0609 * section for details. 0610 * 0611 * Since: 7.0.0 0612 */ 0613 typedef enum { 0614 HB_PAINT_COMPOSITE_MODE_CLEAR, 0615 HB_PAINT_COMPOSITE_MODE_SRC, 0616 HB_PAINT_COMPOSITE_MODE_DEST, 0617 HB_PAINT_COMPOSITE_MODE_SRC_OVER, 0618 HB_PAINT_COMPOSITE_MODE_DEST_OVER, 0619 HB_PAINT_COMPOSITE_MODE_SRC_IN, 0620 HB_PAINT_COMPOSITE_MODE_DEST_IN, 0621 HB_PAINT_COMPOSITE_MODE_SRC_OUT, 0622 HB_PAINT_COMPOSITE_MODE_DEST_OUT, 0623 HB_PAINT_COMPOSITE_MODE_SRC_ATOP, 0624 HB_PAINT_COMPOSITE_MODE_DEST_ATOP, 0625 HB_PAINT_COMPOSITE_MODE_XOR, 0626 HB_PAINT_COMPOSITE_MODE_PLUS, 0627 HB_PAINT_COMPOSITE_MODE_SCREEN, 0628 HB_PAINT_COMPOSITE_MODE_OVERLAY, 0629 HB_PAINT_COMPOSITE_MODE_DARKEN, 0630 HB_PAINT_COMPOSITE_MODE_LIGHTEN, 0631 HB_PAINT_COMPOSITE_MODE_COLOR_DODGE, 0632 HB_PAINT_COMPOSITE_MODE_COLOR_BURN, 0633 HB_PAINT_COMPOSITE_MODE_HARD_LIGHT, 0634 HB_PAINT_COMPOSITE_MODE_SOFT_LIGHT, 0635 HB_PAINT_COMPOSITE_MODE_DIFFERENCE, 0636 HB_PAINT_COMPOSITE_MODE_EXCLUSION, 0637 HB_PAINT_COMPOSITE_MODE_MULTIPLY, 0638 HB_PAINT_COMPOSITE_MODE_HSL_HUE, 0639 HB_PAINT_COMPOSITE_MODE_HSL_SATURATION, 0640 HB_PAINT_COMPOSITE_MODE_HSL_COLOR, 0641 HB_PAINT_COMPOSITE_MODE_HSL_LUMINOSITY 0642 } hb_paint_composite_mode_t; 0643 0644 /** 0645 * hb_paint_push_group_func_t: 0646 * @funcs: paint functions object 0647 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0648 * @user_data: User data pointer passed to hb_paint_funcs_set_push_group_func() 0649 * 0650 * A virtual method for the #hb_paint_funcs_t to use 0651 * an intermediate surface for subsequent paint calls. 0652 * 0653 * The drawing will be redirected to an intermediate surface 0654 * until a matching call to the #hb_paint_funcs_pop_group_func_t 0655 * vfunc. 0656 * 0657 * Since: 7.0.0 0658 */ 0659 typedef void (*hb_paint_push_group_func_t) (hb_paint_funcs_t *funcs, 0660 void *paint_data, 0661 void *user_data); 0662 0663 /** 0664 * hb_paint_pop_group_func_t: 0665 * @funcs: paint functions object 0666 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0667 * @mode: the compositing mode to use 0668 * @user_data: User data pointer passed to hb_paint_funcs_set_pop_group_func() 0669 * 0670 * A virtual method for the #hb_paint_funcs_t to undo 0671 * the effect of a prior call to the #hb_paint_funcs_push_group_func_t 0672 * vfunc. 0673 * 0674 * This call stops the redirection to the intermediate surface, 0675 * and then composites it on the previous surface, using the 0676 * compositing mode passed to this call. 0677 * 0678 * Since: 7.0.0 0679 */ 0680 typedef void (*hb_paint_pop_group_func_t) (hb_paint_funcs_t *funcs, 0681 void *paint_data, 0682 hb_paint_composite_mode_t mode, 0683 void *user_data); 0684 0685 /** 0686 * hb_paint_custom_palette_color_func_t: 0687 * @funcs: paint functions object 0688 * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() 0689 * @color_index: the color index 0690 * @color: (out): fetched color 0691 * @user_data: User data pointer passed to hb_paint_funcs_set_pop_group_func() 0692 * 0693 * A virtual method for the #hb_paint_funcs_t to fetch a color from the custom 0694 * color palette. 0695 * 0696 * Custom palette colors override the colors from the fonts selected color 0697 * palette. It is not necessary to override all palette entries; for entries 0698 * that should be taken from the font palette, return `false`. 0699 * 0700 * This function might get called multiple times, but the custom palette is 0701 * expected to remain unchanged for duration of a hb_font_paint_glyph() call. 0702 * 0703 * Return value: `true` if found, `false` otherwise 0704 * 0705 * Since: 7.0.0 0706 */ 0707 typedef hb_bool_t (*hb_paint_custom_palette_color_func_t) (hb_paint_funcs_t *funcs, 0708 void *paint_data, 0709 unsigned int color_index, 0710 hb_color_t *color, 0711 void *user_data); 0712 0713 0714 /** 0715 * hb_paint_funcs_set_push_transform_func: 0716 * @funcs: A paint functions struct 0717 * @func: (closure user_data) (destroy destroy) (scope notified): The push-transform callback 0718 * @user_data: Data to pass to @func 0719 * @destroy: (nullable): Function to call when @user_data is no longer needed 0720 * 0721 * Sets the push-transform callback on the paint functions struct. 0722 * 0723 * Since: 7.0.0 0724 */ 0725 HB_EXTERN void 0726 hb_paint_funcs_set_push_transform_func (hb_paint_funcs_t *funcs, 0727 hb_paint_push_transform_func_t func, 0728 void *user_data, 0729 hb_destroy_func_t destroy); 0730 0731 /** 0732 * hb_paint_funcs_set_pop_transform_func: 0733 * @funcs: A paint functions struct 0734 * @func: (closure user_data) (destroy destroy) (scope notified): The pop-transform callback 0735 * @user_data: Data to pass to @func 0736 * @destroy: (nullable): Function to call when @user_data is no longer needed 0737 * 0738 * Sets the pop-transform callback on the paint functions struct. 0739 * 0740 * Since: 7.0.0 0741 */ 0742 HB_EXTERN void 0743 hb_paint_funcs_set_pop_transform_func (hb_paint_funcs_t *funcs, 0744 hb_paint_pop_transform_func_t func, 0745 void *user_data, 0746 hb_destroy_func_t destroy); 0747 0748 /** 0749 * hb_paint_funcs_set_color_glyph_func: 0750 * @funcs: A paint functions struct 0751 * @func: (closure user_data) (destroy destroy) (scope notified): The color-glyph callback 0752 * @user_data: Data to pass to @func 0753 * @destroy: (nullable): Function to call when @user_data is no longer needed 0754 * 0755 * Sets the color-glyph callback on the paint functions struct. 0756 * 0757 * Since: 8.2.0 0758 */ 0759 HB_EXTERN void 0760 hb_paint_funcs_set_color_glyph_func (hb_paint_funcs_t *funcs, 0761 hb_paint_color_glyph_func_t func, 0762 void *user_data, 0763 hb_destroy_func_t destroy); 0764 0765 /** 0766 * hb_paint_funcs_set_push_clip_glyph_func: 0767 * @funcs: A paint functions struct 0768 * @func: (closure user_data) (destroy destroy) (scope notified): The push-clip-glyph callback 0769 * @user_data: Data to pass to @func 0770 * @destroy: (nullable): Function to call when @user_data is no longer needed 0771 * 0772 * Sets the push-clip-glyph callback on the paint functions struct. 0773 * 0774 * Since: 7.0.0 0775 */ 0776 HB_EXTERN void 0777 hb_paint_funcs_set_push_clip_glyph_func (hb_paint_funcs_t *funcs, 0778 hb_paint_push_clip_glyph_func_t func, 0779 void *user_data, 0780 hb_destroy_func_t destroy); 0781 0782 /** 0783 * hb_paint_funcs_set_push_clip_rectangle_func: 0784 * @funcs: A paint functions struct 0785 * @func: (closure user_data) (destroy destroy) (scope notified): The push-clip-rectangle callback 0786 * @user_data: Data to pass to @func 0787 * @destroy: (nullable): Function to call when @user_data is no longer needed 0788 * 0789 * Sets the push-clip-rect callback on the paint functions struct. 0790 * 0791 * Since: 7.0.0 0792 */ 0793 HB_EXTERN void 0794 hb_paint_funcs_set_push_clip_rectangle_func (hb_paint_funcs_t *funcs, 0795 hb_paint_push_clip_rectangle_func_t func, 0796 void *user_data, 0797 hb_destroy_func_t destroy); 0798 0799 /** 0800 * hb_paint_funcs_set_pop_clip_func: 0801 * @funcs: A paint functions struct 0802 * @func: (closure user_data) (destroy destroy) (scope notified): The pop-clip callback 0803 * @user_data: Data to pass to @func 0804 * @destroy: (nullable): Function to call when @user_data is no longer needed 0805 * 0806 * Sets the pop-clip callback on the paint functions struct. 0807 * 0808 * Since: 7.0.0 0809 */ 0810 HB_EXTERN void 0811 hb_paint_funcs_set_pop_clip_func (hb_paint_funcs_t *funcs, 0812 hb_paint_pop_clip_func_t func, 0813 void *user_data, 0814 hb_destroy_func_t destroy); 0815 0816 /** 0817 * hb_paint_funcs_set_color_func: 0818 * @funcs: A paint functions struct 0819 * @func: (closure user_data) (destroy destroy) (scope notified): The paint-color callback 0820 * @user_data: Data to pass to @func 0821 * @destroy: (nullable): Function to call when @user_data is no longer needed 0822 * 0823 * Sets the paint-color callback on the paint functions struct. 0824 * 0825 * Since: 7.0.0 0826 */ 0827 HB_EXTERN void 0828 hb_paint_funcs_set_color_func (hb_paint_funcs_t *funcs, 0829 hb_paint_color_func_t func, 0830 void *user_data, 0831 hb_destroy_func_t destroy); 0832 0833 /** 0834 * hb_paint_funcs_set_image_func: 0835 * @funcs: A paint functions struct 0836 * @func: (closure user_data) (destroy destroy) (scope notified): The paint-image callback 0837 * @user_data: Data to pass to @func 0838 * @destroy: (nullable): Function to call when @user_data is no longer needed 0839 * 0840 * Sets the paint-image callback on the paint functions struct. 0841 * 0842 * Since: 7.0.0 0843 */ 0844 HB_EXTERN void 0845 hb_paint_funcs_set_image_func (hb_paint_funcs_t *funcs, 0846 hb_paint_image_func_t func, 0847 void *user_data, 0848 hb_destroy_func_t destroy); 0849 0850 /** 0851 * hb_paint_funcs_set_linear_gradient_func: 0852 * @funcs: A paint functions struct 0853 * @func: (closure user_data) (destroy destroy) (scope notified): The linear-gradient callback 0854 * @user_data: Data to pass to @func 0855 * @destroy: (nullable): Function to call when @user_data is no longer needed 0856 * 0857 * Sets the linear-gradient callback on the paint functions struct. 0858 * 0859 * Since: 7.0.0 0860 */ 0861 HB_EXTERN void 0862 hb_paint_funcs_set_linear_gradient_func (hb_paint_funcs_t *funcs, 0863 hb_paint_linear_gradient_func_t func, 0864 void *user_data, 0865 hb_destroy_func_t destroy); 0866 0867 /** 0868 * hb_paint_funcs_set_radial_gradient_func: 0869 * @funcs: A paint functions struct 0870 * @func: (closure user_data) (destroy destroy) (scope notified): The radial-gradient callback 0871 * @user_data: Data to pass to @func 0872 * @destroy: (nullable): Function to call when @user_data is no longer needed 0873 * 0874 * Sets the radial-gradient callback on the paint functions struct. 0875 * 0876 * Since: 7.0.0 0877 */ 0878 HB_EXTERN void 0879 hb_paint_funcs_set_radial_gradient_func (hb_paint_funcs_t *funcs, 0880 hb_paint_radial_gradient_func_t func, 0881 void *user_data, 0882 hb_destroy_func_t destroy); 0883 0884 /** 0885 * hb_paint_funcs_set_sweep_gradient_func: 0886 * @funcs: A paint functions struct 0887 * @func: (closure user_data) (destroy destroy) (scope notified): The sweep-gradient callback 0888 * @user_data: Data to pass to @func 0889 * @destroy: (nullable): Function to call when @user_data is no longer needed 0890 * 0891 * Sets the sweep-gradient callback on the paint functions struct. 0892 * 0893 * Since: 7.0.0 0894 */ 0895 HB_EXTERN void 0896 hb_paint_funcs_set_sweep_gradient_func (hb_paint_funcs_t *funcs, 0897 hb_paint_sweep_gradient_func_t func, 0898 void *user_data, 0899 hb_destroy_func_t destroy); 0900 0901 /** 0902 * hb_paint_funcs_set_push_group_func: 0903 * @funcs: A paint functions struct 0904 * @func: (closure user_data) (destroy destroy) (scope notified): The push-group callback 0905 * @user_data: Data to pass to @func 0906 * @destroy: (nullable): Function to call when @user_data is no longer needed 0907 * 0908 * Sets the push-group callback on the paint functions struct. 0909 * 0910 * Since: 7.0.0 0911 */ 0912 HB_EXTERN void 0913 hb_paint_funcs_set_push_group_func (hb_paint_funcs_t *funcs, 0914 hb_paint_push_group_func_t func, 0915 void *user_data, 0916 hb_destroy_func_t destroy); 0917 0918 /** 0919 * hb_paint_funcs_set_pop_group_func: 0920 * @funcs: A paint functions struct 0921 * @func: (closure user_data) (destroy destroy) (scope notified): The pop-group callback 0922 * @user_data: Data to pass to @func 0923 * @destroy: (nullable): Function to call when @user_data is no longer needed 0924 * 0925 * Sets the pop-group callback on the paint functions struct. 0926 * 0927 * Since: 7.0.0 0928 */ 0929 HB_EXTERN void 0930 hb_paint_funcs_set_pop_group_func (hb_paint_funcs_t *funcs, 0931 hb_paint_pop_group_func_t func, 0932 void *user_data, 0933 hb_destroy_func_t destroy); 0934 0935 /** 0936 * hb_paint_funcs_set_custom_palette_color_func: 0937 * @funcs: A paint functions struct 0938 * @func: (closure user_data) (destroy destroy) (scope notified): The custom-palette-color callback 0939 * @user_data: Data to pass to @func 0940 * @destroy: (nullable): Function to call when @user_data is no longer needed 0941 * 0942 * Sets the custom-palette-color callback on the paint functions struct. 0943 * 0944 * Since: 7.0.0 0945 */ 0946 HB_EXTERN void 0947 hb_paint_funcs_set_custom_palette_color_func (hb_paint_funcs_t *funcs, 0948 hb_paint_custom_palette_color_func_t func, 0949 void *user_data, 0950 hb_destroy_func_t destroy); 0951 /* 0952 * Manual API 0953 */ 0954 0955 HB_EXTERN void 0956 hb_paint_push_transform (hb_paint_funcs_t *funcs, void *paint_data, 0957 float xx, float yx, 0958 float xy, float yy, 0959 float dx, float dy); 0960 0961 HB_EXTERN void 0962 hb_paint_push_font_transform (hb_paint_funcs_t *funcs, void *paint_data, 0963 const hb_font_t *font); 0964 0965 HB_EXTERN void 0966 hb_paint_push_inverse_font_transform (hb_paint_funcs_t *funcs, void *paint_data, 0967 const hb_font_t *font); 0968 0969 HB_EXTERN void 0970 hb_paint_pop_transform (hb_paint_funcs_t *funcs, void *paint_data); 0971 0972 HB_EXTERN hb_bool_t 0973 hb_paint_color_glyph (hb_paint_funcs_t *funcs, void *paint_data, 0974 hb_codepoint_t glyph, 0975 hb_font_t *font); 0976 0977 HB_EXTERN void 0978 hb_paint_push_clip_glyph (hb_paint_funcs_t *funcs, void *paint_data, 0979 hb_codepoint_t glyph, 0980 hb_font_t *font); 0981 0982 HB_EXTERN void 0983 hb_paint_push_clip_rectangle (hb_paint_funcs_t *funcs, void *paint_data, 0984 float xmin, float ymin, 0985 float xmax, float ymax); 0986 0987 HB_EXTERN void 0988 hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data); 0989 0990 HB_EXTERN void 0991 hb_paint_color (hb_paint_funcs_t *funcs, void *paint_data, 0992 hb_bool_t is_foreground, 0993 hb_color_t color); 0994 0995 HB_EXTERN void 0996 hb_paint_image (hb_paint_funcs_t *funcs, void *paint_data, 0997 hb_blob_t *image, 0998 unsigned int width, 0999 unsigned int height, 1000 hb_tag_t format, 1001 float slant, 1002 hb_glyph_extents_t *extents); 1003 1004 HB_EXTERN void 1005 hb_paint_linear_gradient (hb_paint_funcs_t *funcs, void *paint_data, 1006 hb_color_line_t *color_line, 1007 float x0, float y0, 1008 float x1, float y1, 1009 float x2, float y2); 1010 1011 HB_EXTERN void 1012 hb_paint_radial_gradient (hb_paint_funcs_t *funcs, void *paint_data, 1013 hb_color_line_t *color_line, 1014 float x0, float y0, 1015 float r0, 1016 float x1, float y1, 1017 float r1); 1018 1019 HB_EXTERN void 1020 hb_paint_sweep_gradient (hb_paint_funcs_t *funcs, void *paint_data, 1021 hb_color_line_t *color_line, 1022 float x0, float y0, 1023 float start_angle, float end_angle); 1024 1025 HB_EXTERN void 1026 hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data); 1027 1028 HB_EXTERN void 1029 hb_paint_pop_group (hb_paint_funcs_t *funcs, void *paint_data, 1030 hb_paint_composite_mode_t mode); 1031 1032 HB_EXTERN hb_bool_t 1033 hb_paint_custom_palette_color (hb_paint_funcs_t *funcs, void *paint_data, 1034 unsigned int color_index, 1035 hb_color_t *color); 1036 1037 HB_END_DECLS 1038 1039 #endif /* HB_PAINT_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |