| 1 |
|
| /* |
| 2 |
|
| * pdfmake_render_stroke.c - Minimal stroke support |
| 3 |
|
| * |
| 4 |
|
| * Provides the declared stroke API so render/text callers link correctly. |
| 5 |
|
| * Current implementation uses a conservative fill-path fallback until a |
| 6 |
|
| * full geometric stroker lands. |
| 7 |
|
| */ |
| 8 |
|
| |
| 9 |
|
| #include "pdfmake_render.h" |
| 10 |
|
| |
| 11 |
0 |
| pdfmake_path_t *pdfmake_stroke_to_path( |
| 12 |
|
| pdfmake_path_t *path, |
| 13 |
|
| pdfmake_stroke_style_t *style) |
| 14 |
|
| { |
| 15 |
|
| (void)style; |
| 16 |
|
| |
| 17 |
0 |
▶ | if (!path || pdfmake_path_is_empty(path)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (!path || pdfmake_path_is_empty(path)) { |
0 |
0 |
0 |
| if (!path || pdfmake_path_is_empty(path)) { |
0 |
0 |
0 |
|
| 18 |
0 |
| return NULL; |
| 19 |
|
| } |
| 20 |
|
| |
| 21 |
0 |
| return pdfmake_path_flatten(path, 0.5); |
| 22 |
|
| } |
| 23 |
|
| |
| 24 |
0 |
| pdfmake_render_err_t pdfmake_stroke_path( |
| 25 |
|
| pdfmake_render_ctx_t *ctx, |
| 26 |
|
| pdfmake_path_t *path, |
| 27 |
|
| pdfmake_stroke_style_t *style) |
| 28 |
|
| { |
| 29 |
|
| (void)style; |
| 30 |
|
| |
| 31 |
0 |
▶ | if (!ctx || !path) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (!ctx || !path) { |
0 |
0 |
0 |
| if (!ctx || !path) { |
0 |
0 |
0 |
|
| 32 |
0 |
| return PDFMAKE_RENDER_ERR_NULL; |
| 33 |
|
| } |
| 34 |
|
| |
| 35 |
0 |
▶ | if (pdfmake_path_is_empty(path)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_path_is_empty(path)) { |
0 |
0 |
0 |
|
| 36 |
0 |
| return PDFMAKE_RENDER_ERR_EMPTY_PATH; |
| 37 |
|
| } |
| 38 |
|
| |
| 39 |
0 |
| return pdfmake_fill_path(ctx, path, PDFMAKE_FILL_NONZERO); |
| 40 |
|
| } |
| 41 |
|
| |
| 42 |
0 |
| pdfmake_render_err_t pdfmake_render_stroke(pdfmake_render_ctx_t *ctx) |
| 43 |
|
| { |
| 44 |
|
| pdfmake_render_err_t err; |
| 45 |
|
| |
| 46 |
0 |
▶ | if (!ctx) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ctx) { |
0 |
0 |
0 |
|
| 47 |
0 |
| return PDFMAKE_RENDER_ERR_NULL; |
| 48 |
|
| } |
| 49 |
|
| |
| 50 |
0 |
| err = pdfmake_stroke_path(ctx, ctx->path, &ctx->stroke_style); |
| 51 |
0 |
| pdfmake_path_clear(ctx->path); |
| 52 |
0 |
| return err; |
| 53 |
|
| } |
| 54 |
|
| |
| 55 |
0 |
| pdfmake_render_err_t pdfmake_render_stroke_preserve(pdfmake_render_ctx_t *ctx) |
| 56 |
|
| { |
| 57 |
0 |
▶ | if (!ctx) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ctx) { |
0 |
0 |
0 |
|
| 58 |
0 |
| return PDFMAKE_RENDER_ERR_NULL; |
| 59 |
|
| } |
| 60 |
|
| |
| 61 |
0 |
| return pdfmake_stroke_path(ctx, ctx->path, &ctx->stroke_style); |
| 62 |
|
| } |