| 1 |
|
| 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 |
|
| 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 |
|
| 24 |
#define O_COORDINATE(p_o, n) ((p_o).data[n]) |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#define O_LENGTH(p_o) ((p_o).length) |
| 29 |
|
| 30 |
|
| 31 |
#define O_CLOCKWISE(p_o) ((p_o).clockwise) |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 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 |
|
| 42 |
typedef struct |
| 43 |
{ |
| 44 |
pixel_outline_type *data; |
| 45 |
unsigned length; |
| 46 |
} pixel_outline_list_type; |
| 47 |
|
| 48 |
|
| 49 |
#define O_LIST_OUTLINE(p_o_l, n) ((p_o_l).data[n]) |
| 50 |
|
| 51 |
|
| 52 |
#define O_LIST_LENGTH(p_o_l) ((p_o_l).length) |
| 53 |
|
| 54 |
|
| 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 |
|
| 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 |
|
| 76 |
extern void |
| 77 |
free_pixel_outline_list (pixel_outline_list_type *); |
| 78 |
|
| 79 |
#endif |