modules/freetype2/include/ftstroke.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /***************************************************************************/
michael@0 2 /* */
michael@0 3 /* ftstroke.h */
michael@0 4 /* */
michael@0 5 /* FreeType path stroker (specification). */
michael@0 6 /* */
michael@0 7 /* Copyright 2002-2006, 2008, 2009, 2011-2012 by */
michael@0 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
michael@0 9 /* */
michael@0 10 /* This file is part of the FreeType project, and may only be used, */
michael@0 11 /* modified, and distributed under the terms of the FreeType project */
michael@0 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
michael@0 13 /* this file you indicate that you have read the license and */
michael@0 14 /* understand and accept it fully. */
michael@0 15 /* */
michael@0 16 /***************************************************************************/
michael@0 17
michael@0 18
michael@0 19 #ifndef __FT_STROKE_H__
michael@0 20 #define __FT_STROKE_H__
michael@0 21
michael@0 22 #include <ft2build.h>
michael@0 23 #include FT_OUTLINE_H
michael@0 24 #include FT_GLYPH_H
michael@0 25
michael@0 26
michael@0 27 FT_BEGIN_HEADER
michael@0 28
michael@0 29
michael@0 30 /************************************************************************
michael@0 31 *
michael@0 32 * @section:
michael@0 33 * glyph_stroker
michael@0 34 *
michael@0 35 * @title:
michael@0 36 * Glyph Stroker
michael@0 37 *
michael@0 38 * @abstract:
michael@0 39 * Generating bordered and stroked glyphs.
michael@0 40 *
michael@0 41 * @description:
michael@0 42 * This component generates stroked outlines of a given vectorial
michael@0 43 * glyph. It also allows you to retrieve the `outside' and/or the
michael@0 44 * `inside' borders of the stroke.
michael@0 45 *
michael@0 46 * This can be useful to generate `bordered' glyph, i.e., glyphs
michael@0 47 * displayed with a coloured (and anti-aliased) border around their
michael@0 48 * shape.
michael@0 49 */
michael@0 50
michael@0 51
michael@0 52 /**************************************************************
michael@0 53 *
michael@0 54 * @type:
michael@0 55 * FT_Stroker
michael@0 56 *
michael@0 57 * @description:
michael@0 58 * Opaque handler to a path stroker object.
michael@0 59 */
michael@0 60 typedef struct FT_StrokerRec_* FT_Stroker;
michael@0 61
michael@0 62
michael@0 63 /**************************************************************
michael@0 64 *
michael@0 65 * @enum:
michael@0 66 * FT_Stroker_LineJoin
michael@0 67 *
michael@0 68 * @description:
michael@0 69 * These values determine how two joining lines are rendered
michael@0 70 * in a stroker.
michael@0 71 *
michael@0 72 * @values:
michael@0 73 * FT_STROKER_LINEJOIN_ROUND ::
michael@0 74 * Used to render rounded line joins. Circular arcs are used
michael@0 75 * to join two lines smoothly.
michael@0 76 *
michael@0 77 * FT_STROKER_LINEJOIN_BEVEL ::
michael@0 78 * Used to render beveled line joins. The outer corner of
michael@0 79 * the joined lines is filled by enclosing the triangular
michael@0 80 * region of the corner with a straight line between the
michael@0 81 * outer corners of each stroke.
michael@0 82 *
michael@0 83 * FT_STROKER_LINEJOIN_MITER_FIXED ::
michael@0 84 * Used to render mitered line joins, with fixed bevels if the
michael@0 85 * miter limit is exceeded. The outer edges of the strokes
michael@0 86 * for the two segments are extended until they meet at an
michael@0 87 * angle. If the segments meet at too sharp an angle (such
michael@0 88 * that the miter would extend from the intersection of the
michael@0 89 * segments a distance greater than the product of the miter
michael@0 90 * limit value and the border radius), then a bevel join (see
michael@0 91 * above) is used instead. This prevents long spikes being
michael@0 92 * created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter
michael@0 93 * line join as used in PostScript and PDF.
michael@0 94 *
michael@0 95 * FT_STROKER_LINEJOIN_MITER_VARIABLE ::
michael@0 96 * FT_STROKER_LINEJOIN_MITER ::
michael@0 97 * Used to render mitered line joins, with variable bevels if
michael@0 98 * the miter limit is exceeded. The intersection of the
michael@0 99 * strokes is clipped at a line perpendicular to the bisector
michael@0 100 * of the angle between the strokes, at the distance from the
michael@0 101 * intersection of the segments equal to the product of the
michael@0 102 * miter limit value and the border radius. This prevents
michael@0 103 * long spikes being created.
michael@0 104 * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line
michael@0 105 * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias
michael@0 106 * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for
michael@0 107 * backwards compatibility.
michael@0 108 */
michael@0 109 typedef enum FT_Stroker_LineJoin_
michael@0 110 {
michael@0 111 FT_STROKER_LINEJOIN_ROUND = 0,
michael@0 112 FT_STROKER_LINEJOIN_BEVEL = 1,
michael@0 113 FT_STROKER_LINEJOIN_MITER_VARIABLE = 2,
michael@0 114 FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE,
michael@0 115 FT_STROKER_LINEJOIN_MITER_FIXED = 3
michael@0 116
michael@0 117 } FT_Stroker_LineJoin;
michael@0 118
michael@0 119
michael@0 120 /**************************************************************
michael@0 121 *
michael@0 122 * @enum:
michael@0 123 * FT_Stroker_LineCap
michael@0 124 *
michael@0 125 * @description:
michael@0 126 * These values determine how the end of opened sub-paths are
michael@0 127 * rendered in a stroke.
michael@0 128 *
michael@0 129 * @values:
michael@0 130 * FT_STROKER_LINECAP_BUTT ::
michael@0 131 * The end of lines is rendered as a full stop on the last
michael@0 132 * point itself.
michael@0 133 *
michael@0 134 * FT_STROKER_LINECAP_ROUND ::
michael@0 135 * The end of lines is rendered as a half-circle around the
michael@0 136 * last point.
michael@0 137 *
michael@0 138 * FT_STROKER_LINECAP_SQUARE ::
michael@0 139 * The end of lines is rendered as a square around the
michael@0 140 * last point.
michael@0 141 */
michael@0 142 typedef enum FT_Stroker_LineCap_
michael@0 143 {
michael@0 144 FT_STROKER_LINECAP_BUTT = 0,
michael@0 145 FT_STROKER_LINECAP_ROUND,
michael@0 146 FT_STROKER_LINECAP_SQUARE
michael@0 147
michael@0 148 } FT_Stroker_LineCap;
michael@0 149
michael@0 150
michael@0 151 /**************************************************************
michael@0 152 *
michael@0 153 * @enum:
michael@0 154 * FT_StrokerBorder
michael@0 155 *
michael@0 156 * @description:
michael@0 157 * These values are used to select a given stroke border
michael@0 158 * in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
michael@0 159 *
michael@0 160 * @values:
michael@0 161 * FT_STROKER_BORDER_LEFT ::
michael@0 162 * Select the left border, relative to the drawing direction.
michael@0 163 *
michael@0 164 * FT_STROKER_BORDER_RIGHT ::
michael@0 165 * Select the right border, relative to the drawing direction.
michael@0 166 *
michael@0 167 * @note:
michael@0 168 * Applications are generally interested in the `inside' and `outside'
michael@0 169 * borders. However, there is no direct mapping between these and the
michael@0 170 * `left' and `right' ones, since this really depends on the glyph's
michael@0 171 * drawing orientation, which varies between font formats.
michael@0 172 *
michael@0 173 * You can however use @FT_Outline_GetInsideBorder and
michael@0 174 * @FT_Outline_GetOutsideBorder to get these.
michael@0 175 */
michael@0 176 typedef enum FT_StrokerBorder_
michael@0 177 {
michael@0 178 FT_STROKER_BORDER_LEFT = 0,
michael@0 179 FT_STROKER_BORDER_RIGHT
michael@0 180
michael@0 181 } FT_StrokerBorder;
michael@0 182
michael@0 183
michael@0 184 /**************************************************************
michael@0 185 *
michael@0 186 * @function:
michael@0 187 * FT_Outline_GetInsideBorder
michael@0 188 *
michael@0 189 * @description:
michael@0 190 * Retrieve the @FT_StrokerBorder value corresponding to the
michael@0 191 * `inside' borders of a given outline.
michael@0 192 *
michael@0 193 * @input:
michael@0 194 * outline ::
michael@0 195 * The source outline handle.
michael@0 196 *
michael@0 197 * @return:
michael@0 198 * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid
michael@0 199 * outlines.
michael@0 200 */
michael@0 201 FT_EXPORT( FT_StrokerBorder )
michael@0 202 FT_Outline_GetInsideBorder( FT_Outline* outline );
michael@0 203
michael@0 204
michael@0 205 /**************************************************************
michael@0 206 *
michael@0 207 * @function:
michael@0 208 * FT_Outline_GetOutsideBorder
michael@0 209 *
michael@0 210 * @description:
michael@0 211 * Retrieve the @FT_StrokerBorder value corresponding to the
michael@0 212 * `outside' borders of a given outline.
michael@0 213 *
michael@0 214 * @input:
michael@0 215 * outline ::
michael@0 216 * The source outline handle.
michael@0 217 *
michael@0 218 * @return:
michael@0 219 * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
michael@0 220 * outlines.
michael@0 221 */
michael@0 222 FT_EXPORT( FT_StrokerBorder )
michael@0 223 FT_Outline_GetOutsideBorder( FT_Outline* outline );
michael@0 224
michael@0 225
michael@0 226 /**************************************************************
michael@0 227 *
michael@0 228 * @function:
michael@0 229 * FT_Stroker_New
michael@0 230 *
michael@0 231 * @description:
michael@0 232 * Create a new stroker object.
michael@0 233 *
michael@0 234 * @input:
michael@0 235 * library ::
michael@0 236 * FreeType library handle.
michael@0 237 *
michael@0 238 * @output:
michael@0 239 * astroker ::
michael@0 240 * A new stroker object handle. NULL in case of error.
michael@0 241 *
michael@0 242 * @return:
michael@0 243 * FreeType error code. 0~means success.
michael@0 244 */
michael@0 245 FT_EXPORT( FT_Error )
michael@0 246 FT_Stroker_New( FT_Library library,
michael@0 247 FT_Stroker *astroker );
michael@0 248
michael@0 249
michael@0 250 /**************************************************************
michael@0 251 *
michael@0 252 * @function:
michael@0 253 * FT_Stroker_Set
michael@0 254 *
michael@0 255 * @description:
michael@0 256 * Reset a stroker object's attributes.
michael@0 257 *
michael@0 258 * @input:
michael@0 259 * stroker ::
michael@0 260 * The target stroker handle.
michael@0 261 *
michael@0 262 * radius ::
michael@0 263 * The border radius.
michael@0 264 *
michael@0 265 * line_cap ::
michael@0 266 * The line cap style.
michael@0 267 *
michael@0 268 * line_join ::
michael@0 269 * The line join style.
michael@0 270 *
michael@0 271 * miter_limit ::
michael@0 272 * The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and
michael@0 273 * FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles,
michael@0 274 * expressed as 16.16 fixed-point value.
michael@0 275 *
michael@0 276 * @note:
michael@0 277 * The radius is expressed in the same units as the outline
michael@0 278 * coordinates.
michael@0 279 */
michael@0 280 FT_EXPORT( void )
michael@0 281 FT_Stroker_Set( FT_Stroker stroker,
michael@0 282 FT_Fixed radius,
michael@0 283 FT_Stroker_LineCap line_cap,
michael@0 284 FT_Stroker_LineJoin line_join,
michael@0 285 FT_Fixed miter_limit );
michael@0 286
michael@0 287
michael@0 288 /**************************************************************
michael@0 289 *
michael@0 290 * @function:
michael@0 291 * FT_Stroker_Rewind
michael@0 292 *
michael@0 293 * @description:
michael@0 294 * Reset a stroker object without changing its attributes.
michael@0 295 * You should call this function before beginning a new
michael@0 296 * series of calls to @FT_Stroker_BeginSubPath or
michael@0 297 * @FT_Stroker_EndSubPath.
michael@0 298 *
michael@0 299 * @input:
michael@0 300 * stroker ::
michael@0 301 * The target stroker handle.
michael@0 302 */
michael@0 303 FT_EXPORT( void )
michael@0 304 FT_Stroker_Rewind( FT_Stroker stroker );
michael@0 305
michael@0 306
michael@0 307 /**************************************************************
michael@0 308 *
michael@0 309 * @function:
michael@0 310 * FT_Stroker_ParseOutline
michael@0 311 *
michael@0 312 * @description:
michael@0 313 * A convenience function used to parse a whole outline with
michael@0 314 * the stroker. The resulting outline(s) can be retrieved
michael@0 315 * later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
michael@0 316 *
michael@0 317 * @input:
michael@0 318 * stroker ::
michael@0 319 * The target stroker handle.
michael@0 320 *
michael@0 321 * outline ::
michael@0 322 * The source outline.
michael@0 323 *
michael@0 324 * opened ::
michael@0 325 * A boolean. If~1, the outline is treated as an open path instead
michael@0 326 * of a closed one.
michael@0 327 *
michael@0 328 * @return:
michael@0 329 * FreeType error code. 0~means success.
michael@0 330 *
michael@0 331 * @note:
michael@0 332 * If `opened' is~0 (the default), the outline is treated as a closed
michael@0 333 * path, and the stroker generates two distinct `border' outlines.
michael@0 334 *
michael@0 335 * If `opened' is~1, the outline is processed as an open path, and the
michael@0 336 * stroker generates a single `stroke' outline.
michael@0 337 *
michael@0 338 * This function calls @FT_Stroker_Rewind automatically.
michael@0 339 */
michael@0 340 FT_EXPORT( FT_Error )
michael@0 341 FT_Stroker_ParseOutline( FT_Stroker stroker,
michael@0 342 FT_Outline* outline,
michael@0 343 FT_Bool opened );
michael@0 344
michael@0 345
michael@0 346 /**************************************************************
michael@0 347 *
michael@0 348 * @function:
michael@0 349 * FT_Stroker_BeginSubPath
michael@0 350 *
michael@0 351 * @description:
michael@0 352 * Start a new sub-path in the stroker.
michael@0 353 *
michael@0 354 * @input:
michael@0 355 * stroker ::
michael@0 356 * The target stroker handle.
michael@0 357 *
michael@0 358 * to ::
michael@0 359 * A pointer to the start vector.
michael@0 360 *
michael@0 361 * open ::
michael@0 362 * A boolean. If~1, the sub-path is treated as an open one.
michael@0 363 *
michael@0 364 * @return:
michael@0 365 * FreeType error code. 0~means success.
michael@0 366 *
michael@0 367 * @note:
michael@0 368 * This function is useful when you need to stroke a path that is
michael@0 369 * not stored as an @FT_Outline object.
michael@0 370 */
michael@0 371 FT_EXPORT( FT_Error )
michael@0 372 FT_Stroker_BeginSubPath( FT_Stroker stroker,
michael@0 373 FT_Vector* to,
michael@0 374 FT_Bool open );
michael@0 375
michael@0 376
michael@0 377 /**************************************************************
michael@0 378 *
michael@0 379 * @function:
michael@0 380 * FT_Stroker_EndSubPath
michael@0 381 *
michael@0 382 * @description:
michael@0 383 * Close the current sub-path in the stroker.
michael@0 384 *
michael@0 385 * @input:
michael@0 386 * stroker ::
michael@0 387 * The target stroker handle.
michael@0 388 *
michael@0 389 * @return:
michael@0 390 * FreeType error code. 0~means success.
michael@0 391 *
michael@0 392 * @note:
michael@0 393 * You should call this function after @FT_Stroker_BeginSubPath.
michael@0 394 * If the subpath was not `opened', this function `draws' a
michael@0 395 * single line segment to the start position when needed.
michael@0 396 */
michael@0 397 FT_EXPORT( FT_Error )
michael@0 398 FT_Stroker_EndSubPath( FT_Stroker stroker );
michael@0 399
michael@0 400
michael@0 401 /**************************************************************
michael@0 402 *
michael@0 403 * @function:
michael@0 404 * FT_Stroker_LineTo
michael@0 405 *
michael@0 406 * @description:
michael@0 407 * `Draw' a single line segment in the stroker's current sub-path,
michael@0 408 * from the last position.
michael@0 409 *
michael@0 410 * @input:
michael@0 411 * stroker ::
michael@0 412 * The target stroker handle.
michael@0 413 *
michael@0 414 * to ::
michael@0 415 * A pointer to the destination point.
michael@0 416 *
michael@0 417 * @return:
michael@0 418 * FreeType error code. 0~means success.
michael@0 419 *
michael@0 420 * @note:
michael@0 421 * You should call this function between @FT_Stroker_BeginSubPath and
michael@0 422 * @FT_Stroker_EndSubPath.
michael@0 423 */
michael@0 424 FT_EXPORT( FT_Error )
michael@0 425 FT_Stroker_LineTo( FT_Stroker stroker,
michael@0 426 FT_Vector* to );
michael@0 427
michael@0 428
michael@0 429 /**************************************************************
michael@0 430 *
michael@0 431 * @function:
michael@0 432 * FT_Stroker_ConicTo
michael@0 433 *
michael@0 434 * @description:
michael@0 435 * `Draw' a single quadratic Bézier in the stroker's current sub-path,
michael@0 436 * from the last position.
michael@0 437 *
michael@0 438 * @input:
michael@0 439 * stroker ::
michael@0 440 * The target stroker handle.
michael@0 441 *
michael@0 442 * control ::
michael@0 443 * A pointer to a Bézier control point.
michael@0 444 *
michael@0 445 * to ::
michael@0 446 * A pointer to the destination point.
michael@0 447 *
michael@0 448 * @return:
michael@0 449 * FreeType error code. 0~means success.
michael@0 450 *
michael@0 451 * @note:
michael@0 452 * You should call this function between @FT_Stroker_BeginSubPath and
michael@0 453 * @FT_Stroker_EndSubPath.
michael@0 454 */
michael@0 455 FT_EXPORT( FT_Error )
michael@0 456 FT_Stroker_ConicTo( FT_Stroker stroker,
michael@0 457 FT_Vector* control,
michael@0 458 FT_Vector* to );
michael@0 459
michael@0 460
michael@0 461 /**************************************************************
michael@0 462 *
michael@0 463 * @function:
michael@0 464 * FT_Stroker_CubicTo
michael@0 465 *
michael@0 466 * @description:
michael@0 467 * `Draw' a single cubic Bézier in the stroker's current sub-path,
michael@0 468 * from the last position.
michael@0 469 *
michael@0 470 * @input:
michael@0 471 * stroker ::
michael@0 472 * The target stroker handle.
michael@0 473 *
michael@0 474 * control1 ::
michael@0 475 * A pointer to the first Bézier control point.
michael@0 476 *
michael@0 477 * control2 ::
michael@0 478 * A pointer to second Bézier control point.
michael@0 479 *
michael@0 480 * to ::
michael@0 481 * A pointer to the destination point.
michael@0 482 *
michael@0 483 * @return:
michael@0 484 * FreeType error code. 0~means success.
michael@0 485 *
michael@0 486 * @note:
michael@0 487 * You should call this function between @FT_Stroker_BeginSubPath and
michael@0 488 * @FT_Stroker_EndSubPath.
michael@0 489 */
michael@0 490 FT_EXPORT( FT_Error )
michael@0 491 FT_Stroker_CubicTo( FT_Stroker stroker,
michael@0 492 FT_Vector* control1,
michael@0 493 FT_Vector* control2,
michael@0 494 FT_Vector* to );
michael@0 495
michael@0 496
michael@0 497 /**************************************************************
michael@0 498 *
michael@0 499 * @function:
michael@0 500 * FT_Stroker_GetBorderCounts
michael@0 501 *
michael@0 502 * @description:
michael@0 503 * Call this function once you have finished parsing your paths
michael@0 504 * with the stroker. It returns the number of points and
michael@0 505 * contours necessary to export one of the `border' or `stroke'
michael@0 506 * outlines generated by the stroker.
michael@0 507 *
michael@0 508 * @input:
michael@0 509 * stroker ::
michael@0 510 * The target stroker handle.
michael@0 511 *
michael@0 512 * border ::
michael@0 513 * The border index.
michael@0 514 *
michael@0 515 * @output:
michael@0 516 * anum_points ::
michael@0 517 * The number of points.
michael@0 518 *
michael@0 519 * anum_contours ::
michael@0 520 * The number of contours.
michael@0 521 *
michael@0 522 * @return:
michael@0 523 * FreeType error code. 0~means success.
michael@0 524 *
michael@0 525 * @note:
michael@0 526 * When an outline, or a sub-path, is `closed', the stroker generates
michael@0 527 * two independent `border' outlines, named `left' and `right'.
michael@0 528 *
michael@0 529 * When the outline, or a sub-path, is `opened', the stroker merges
michael@0 530 * the `border' outlines with caps. The `left' border receives all
michael@0 531 * points, while the `right' border becomes empty.
michael@0 532 *
michael@0 533 * Use the function @FT_Stroker_GetCounts instead if you want to
michael@0 534 * retrieve the counts associated to both borders.
michael@0 535 */
michael@0 536 FT_EXPORT( FT_Error )
michael@0 537 FT_Stroker_GetBorderCounts( FT_Stroker stroker,
michael@0 538 FT_StrokerBorder border,
michael@0 539 FT_UInt *anum_points,
michael@0 540 FT_UInt *anum_contours );
michael@0 541
michael@0 542
michael@0 543 /**************************************************************
michael@0 544 *
michael@0 545 * @function:
michael@0 546 * FT_Stroker_ExportBorder
michael@0 547 *
michael@0 548 * @description:
michael@0 549 * Call this function after @FT_Stroker_GetBorderCounts to
michael@0 550 * export the corresponding border to your own @FT_Outline
michael@0 551 * structure.
michael@0 552 *
michael@0 553 * Note that this function appends the border points and
michael@0 554 * contours to your outline, but does not try to resize its
michael@0 555 * arrays.
michael@0 556 *
michael@0 557 * @input:
michael@0 558 * stroker ::
michael@0 559 * The target stroker handle.
michael@0 560 *
michael@0 561 * border ::
michael@0 562 * The border index.
michael@0 563 *
michael@0 564 * outline ::
michael@0 565 * The target outline handle.
michael@0 566 *
michael@0 567 * @note:
michael@0 568 * Always call this function after @FT_Stroker_GetBorderCounts to
michael@0 569 * get sure that there is enough room in your @FT_Outline object to
michael@0 570 * receive all new data.
michael@0 571 *
michael@0 572 * When an outline, or a sub-path, is `closed', the stroker generates
michael@0 573 * two independent `border' outlines, named `left' and `right'
michael@0 574 *
michael@0 575 * When the outline, or a sub-path, is `opened', the stroker merges
michael@0 576 * the `border' outlines with caps. The `left' border receives all
michael@0 577 * points, while the `right' border becomes empty.
michael@0 578 *
michael@0 579 * Use the function @FT_Stroker_Export instead if you want to
michael@0 580 * retrieve all borders at once.
michael@0 581 */
michael@0 582 FT_EXPORT( void )
michael@0 583 FT_Stroker_ExportBorder( FT_Stroker stroker,
michael@0 584 FT_StrokerBorder border,
michael@0 585 FT_Outline* outline );
michael@0 586
michael@0 587
michael@0 588 /**************************************************************
michael@0 589 *
michael@0 590 * @function:
michael@0 591 * FT_Stroker_GetCounts
michael@0 592 *
michael@0 593 * @description:
michael@0 594 * Call this function once you have finished parsing your paths
michael@0 595 * with the stroker. It returns the number of points and
michael@0 596 * contours necessary to export all points/borders from the stroked
michael@0 597 * outline/path.
michael@0 598 *
michael@0 599 * @input:
michael@0 600 * stroker ::
michael@0 601 * The target stroker handle.
michael@0 602 *
michael@0 603 * @output:
michael@0 604 * anum_points ::
michael@0 605 * The number of points.
michael@0 606 *
michael@0 607 * anum_contours ::
michael@0 608 * The number of contours.
michael@0 609 *
michael@0 610 * @return:
michael@0 611 * FreeType error code. 0~means success.
michael@0 612 */
michael@0 613 FT_EXPORT( FT_Error )
michael@0 614 FT_Stroker_GetCounts( FT_Stroker stroker,
michael@0 615 FT_UInt *anum_points,
michael@0 616 FT_UInt *anum_contours );
michael@0 617
michael@0 618
michael@0 619 /**************************************************************
michael@0 620 *
michael@0 621 * @function:
michael@0 622 * FT_Stroker_Export
michael@0 623 *
michael@0 624 * @description:
michael@0 625 * Call this function after @FT_Stroker_GetBorderCounts to
michael@0 626 * export all borders to your own @FT_Outline structure.
michael@0 627 *
michael@0 628 * Note that this function appends the border points and
michael@0 629 * contours to your outline, but does not try to resize its
michael@0 630 * arrays.
michael@0 631 *
michael@0 632 * @input:
michael@0 633 * stroker ::
michael@0 634 * The target stroker handle.
michael@0 635 *
michael@0 636 * outline ::
michael@0 637 * The target outline handle.
michael@0 638 */
michael@0 639 FT_EXPORT( void )
michael@0 640 FT_Stroker_Export( FT_Stroker stroker,
michael@0 641 FT_Outline* outline );
michael@0 642
michael@0 643
michael@0 644 /**************************************************************
michael@0 645 *
michael@0 646 * @function:
michael@0 647 * FT_Stroker_Done
michael@0 648 *
michael@0 649 * @description:
michael@0 650 * Destroy a stroker object.
michael@0 651 *
michael@0 652 * @input:
michael@0 653 * stroker ::
michael@0 654 * A stroker handle. Can be NULL.
michael@0 655 */
michael@0 656 FT_EXPORT( void )
michael@0 657 FT_Stroker_Done( FT_Stroker stroker );
michael@0 658
michael@0 659
michael@0 660 /**************************************************************
michael@0 661 *
michael@0 662 * @function:
michael@0 663 * FT_Glyph_Stroke
michael@0 664 *
michael@0 665 * @description:
michael@0 666 * Stroke a given outline glyph object with a given stroker.
michael@0 667 *
michael@0 668 * @inout:
michael@0 669 * pglyph ::
michael@0 670 * Source glyph handle on input, new glyph handle on output.
michael@0 671 *
michael@0 672 * @input:
michael@0 673 * stroker ::
michael@0 674 * A stroker handle.
michael@0 675 *
michael@0 676 * destroy ::
michael@0 677 * A Boolean. If~1, the source glyph object is destroyed
michael@0 678 * on success.
michael@0 679 *
michael@0 680 * @return:
michael@0 681 * FreeType error code. 0~means success.
michael@0 682 *
michael@0 683 * @note:
michael@0 684 * The source glyph is untouched in case of error.
michael@0 685 *
michael@0 686 * Adding stroke may yield a significantly wider and taller glyph
michael@0 687 * depending on how large of a radius was used to stroke the glyph. You
michael@0 688 * may need to manually adjust horizontal and vertical advance amounts
michael@0 689 * to account for this added size.
michael@0 690 */
michael@0 691 FT_EXPORT( FT_Error )
michael@0 692 FT_Glyph_Stroke( FT_Glyph *pglyph,
michael@0 693 FT_Stroker stroker,
michael@0 694 FT_Bool destroy );
michael@0 695
michael@0 696
michael@0 697 /**************************************************************
michael@0 698 *
michael@0 699 * @function:
michael@0 700 * FT_Glyph_StrokeBorder
michael@0 701 *
michael@0 702 * @description:
michael@0 703 * Stroke a given outline glyph object with a given stroker, but
michael@0 704 * only return either its inside or outside border.
michael@0 705 *
michael@0 706 * @inout:
michael@0 707 * pglyph ::
michael@0 708 * Source glyph handle on input, new glyph handle on output.
michael@0 709 *
michael@0 710 * @input:
michael@0 711 * stroker ::
michael@0 712 * A stroker handle.
michael@0 713 *
michael@0 714 * inside ::
michael@0 715 * A Boolean. If~1, return the inside border, otherwise
michael@0 716 * the outside border.
michael@0 717 *
michael@0 718 * destroy ::
michael@0 719 * A Boolean. If~1, the source glyph object is destroyed
michael@0 720 * on success.
michael@0 721 *
michael@0 722 * @return:
michael@0 723 * FreeType error code. 0~means success.
michael@0 724 *
michael@0 725 * @note:
michael@0 726 * The source glyph is untouched in case of error.
michael@0 727 *
michael@0 728 * Adding stroke may yield a significantly wider and taller glyph
michael@0 729 * depending on how large of a radius was used to stroke the glyph. You
michael@0 730 * may need to manually adjust horizontal and vertical advance amounts
michael@0 731 * to account for this added size.
michael@0 732 */
michael@0 733 FT_EXPORT( FT_Error )
michael@0 734 FT_Glyph_StrokeBorder( FT_Glyph *pglyph,
michael@0 735 FT_Stroker stroker,
michael@0 736 FT_Bool inside,
michael@0 737 FT_Bool destroy );
michael@0 738
michael@0 739 /* */
michael@0 740
michael@0 741 FT_END_HEADER
michael@0 742
michael@0 743 #endif /* __FT_STROKE_H__ */
michael@0 744
michael@0 745
michael@0 746 /* END */
michael@0 747
michael@0 748
michael@0 749 /* Local Variables: */
michael@0 750 /* coding: utf-8 */
michael@0 751 /* End: */

mercurial