1 /* spline.h: manipulate the spline representation. 2 Some of macrs are only renamed macros in output.h. */ 3 4 #ifndef SPLINE_H 5 #define SPLINE_H 6 7 #include <stdio.h> 8 #include "autotrace.h" 9 #include "output.h" 10 11 typedef at_polynomial_degree polynomial_degree; 12 typedef at_spline_type spline_type; 13 14 #define LINEARTYPE AT_LINEARTYPE 15 #define QUADRATICTYPE AT_QUADRATICTYPE 16 #define CUBICTYPE AT_CUBICTYPE 17 #define PARALLELELLIPSETYPE AT_PARALLELELLIPSETYPE 18 #define ELLIPSETYPE AT_ELLIPSETYPE 19 #define CIRCLETYPE AT_CIRCLETYPE 20 21 #define START_POINT AT_SPLINE_START_POINT_VALUE 22 #define CONTROL1 AT_SPLINE_CONTROL1_VALUE 23 #define CONTROL2 AT_SPLINE_CONTROL2_VALUE 24 #define END_POINT AT_SPLINE_END_POINT_VALUE 25 #define SPLINE_DEGREE AT_SPLINE_DEGREE_VALUE 26 #define SPLINE_LINEARITY(spl) ((spl).linearity) 27 28 #ifndef _IMPORTING 29 /* Print a spline on the given file. */ 30 extern void print_spline(spline_type); 31 32 /* Evaluate SPLINE at the given T value. */ 33 extern at_real_coord evaluate_spline(spline_type spline, gfloat t); 34 #endif 35 36 /* Each outline in a character is typically represented by many 37 splines. So, here is a list structure for that: */ 38 typedef at_spline_list_type spline_list_type; 39 40 /* An empty list will have length zero (and null data). */ 41 #define SPLINE_LIST_LENGTH AT_SPLINE_LIST_LENGTH_VALUE 42 43 /* The address of the beginning of the array of data. */ 44 #define SPLINE_LIST_DATA AT_SPLINE_LIST_DATA_VALUE 45 46 /* The element INDEX in S_L. */ 47 #define SPLINE_LIST_ELT AT_SPLINE_LIST_ELT_VALUE 48 49 /* The last element in S_L. */ 50 #define LAST_SPLINE_LIST_ELT(s_l) \ 51 (SPLINE_LIST_DATA (s_l)[SPLINE_LIST_LENGTH (s_l) - 1]) 52 53 /* The previous and next elements to INDEX in S_L. */ 54 #define NEXT_SPLINE_LIST_ELT(s_l, index) \ 55 SPLINE_LIST_ELT (s_l, ((index) + 1) % SPLINE_LIST_LENGTH (s_l)) 56 #define PREV_SPLINE_LIST_ELT(s_l, index) \ 57 SPLINE_LIST_ELT (s_l, index == 0 \ 58 ? SPLINE_LIST_LENGTH (s_l) - 1 \ 59 : index - 1) 60 61 #ifndef _IMPORTING 62 /* Construct and destroy new `spline_list_type' objects. */ 63 extern spline_list_type *new_spline_list(void); /* Allocate new memory */ 64 extern spline_list_type empty_spline_list(void); /* No allocation */ 65 extern spline_list_type *new_spline_list_with_spline(spline_type); 66 extern void free_spline_list(spline_list_type); 67 68 /* Append the spline S to the list S_LIST. */ 69 extern void append_spline(spline_list_type * s_list, spline_type s); 70 71 /* Append the elements in list S2 to S1, changing S1. */ 72 extern void concat_spline_lists(spline_list_type * s1, spline_list_type s2); 73 #endif 74 75 typedef at_spline_list_array_type spline_list_array_type; 76 77 /* Turns out we can use the same definitions for lists of lists as for 78 just lists. But we define the usual names, just in case. */ 79 #define SPLINE_LIST_ARRAY_LENGTH AT_SPLINE_LIST_ARRAY_LENGTH_VALUE 80 #define SPLINE_LIST_ARRAY_DATA SPLINE_LIST_DATA 81 #define SPLINE_LIST_ARRAY_ELT AT_SPLINE_LIST_ARRAY_ELT_VALUE 82 #define LAST_SPLINE_LIST_ARRAY_ELT LAST_SPLINE_LIST_ELT 83 84 extern spline_list_array_type new_spline_list_array(void); 85 extern void append_spline_list(spline_list_array_type *, spline_list_type); 86 extern void free_spline_list_array(spline_list_array_type *); 87 88 #endif /* not SPLINE_H */ 89