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