Debian Codegraph @

converter/other/pamtosvg/pxl-outline.h

raw symbols SCIP
1 /* pxl-outline.h: find a list of outlines which make up one character. */
2
3 #ifndef PXL_OUTLINE_H
4 #define PXL_OUTLINE_H
5
6 #include "ppm.h"
7
8 #include "autotrace.h"
9 #include "exception.h"
10 #include "bitmap.h"
11
12 /* This is a list of contiguous points on the bitmap. */
13 typedef struct
14 {
15 pm_pixelcoord * data;
16 unsigned length;
17 bool clockwise;
18 pixel color;
19 bool open;
20 } pixel_outline_type;
21
22
23 /* The Nth coordinate in the list. */
24 #define O_COORDINATE(p_o, n) ((p_o).data[n])
25
26
27 /* The length of the list. */
28 #define O_LENGTH(p_o) ((p_o).length)
29
30 /* Whether the outline moves clockwise or counterclockwise. */
31 #define O_CLOCKWISE(p_o) ((p_o).clockwise)
32
33 /* Since a pixel outline is cyclic, the index of the next coordinate
34 after the last is the first, and the previous coordinate before the
35 first is the last. */
36 #define O_NEXT(p_o, n) (((n) + 1) % O_LENGTH (p_o))
37 #define O_PREV(p_o, n) ((n) == 0 \
38 ? O_LENGTH (p_o) - 1 \
39 : (n) - 1)
40
41 /* And the character turns into a list of such lists. */
42 typedef struct
43 {
44 pixel_outline_type *data;
45 unsigned length;
46 } pixel_outline_list_type;
47
48 /* The Nth list in the list of lists. */
49 #define O_LIST_OUTLINE(p_o_l, n) ((p_o_l).data[n])
50
51 /* The length of the list of lists. */
52 #define O_LIST_LENGTH(p_o_l) ((p_o_l).length)
53
54 /* Find all pixels on the outline in the character C. */
55 pixel_outline_list_type
56 find_outline_pixels (bitmap_type const type,
57 bool const bg_spec,
58 pixel const bg_color,
59 at_progress_func notify_progress,
60 void * const progress_data,
61 at_testcancel_func test_cancel,
62 void * const testcancel_data,
63 at_exception_type * const exp);
64
65 /* Find all pixels on the center line of the character C. */
66 pixel_outline_list_type
67 find_centerline_pixels (bitmap_type const type,
68 pixel const bg_color,
69 at_progress_func notify_progress,
70 void * const progress_data,
71 at_testcancel_func test_cancel,
72 void * const testcancel_data,
73 at_exception_type * const exp);
74
75 /* Free the memory in the list. */
76 extern void
77 free_pixel_outline_list (pixel_outline_list_type *);
78
79 #endif /* not PXL_OUTLINE_H */