3 fillstyle_t fillstyle_default;
5 windstate_t windstate_nonfilled = {
10 // -------------------- even/odd ----------------------
12 windstate_t evenodd_start(windcontext_t*context)
14 return windstate_nonfilled;
16 windstate_t evenodd_add(windcontext_t*context, windstate_t left, fillstyle_t*edge, segment_dir_t dir, int master)
21 fillstyle_t* evenodd_diff(windstate_t*left, windstate_t*right)
23 if(left->is_filled==right->is_filled)
26 return &fillstyle_default;
29 windrule_t windrule_evenodd = {
35 // -------------------- circular ----------------------
37 windstate_t circular_start(windcontext_t*context)
39 return windstate_nonfilled;
42 windstate_t circular_add(windcontext_t*context, windstate_t left, fillstyle_t*edge, segment_dir_t dir, int master)
44 /* which one is + and which one - doesn't actually make any difference */
50 left.is_filled = left.wind_nr != 0;
54 fillstyle_t* circular_diff(windstate_t*left, windstate_t*right)
56 if(left->is_filled==right->is_filled)
59 return &fillstyle_default;
62 windrule_t windrule_circular = {
63 start: circular_start,
68 // -------------------- intersect ----------------------
70 windstate_t intersect_start(windcontext_t*context)
72 return windstate_nonfilled;
75 windstate_t intersect_add(windcontext_t*context, windstate_t left, fillstyle_t*edge, segment_dir_t dir, int master)
77 assert(master < context->num_polygons);
79 left.wind_nr ^= 1<<master;
80 left.is_filled = (left.wind_nr == (1<<context->num_polygons)-1);
84 fillstyle_t* intersect_diff(windstate_t*left, windstate_t*right)
86 if(left->is_filled==right->is_filled)
89 return &fillstyle_default;
92 windrule_t windrule_intersect = {
93 start: intersect_start,
98 // -------------------- union ----------------------
100 windstate_t union_start(windcontext_t*context)
102 return windstate_nonfilled;
105 windstate_t union_add(windcontext_t*context, windstate_t left, fillstyle_t*edge, segment_dir_t dir, int master)
107 assert(master<sizeof(left.wind_nr)*8); //up to 32/64 polygons max
108 left.wind_nr ^= 1<<master;
109 left.is_filled = (left.wind_nr!=0);
113 fillstyle_t* union_diff(windstate_t*left, windstate_t*right)
115 if(left->is_filled==right->is_filled)
118 return &fillstyle_default;
121 windrule_t windrule_union = {
129 } else if (rule == WIND_NONZERO) {
131 } else if (rule == WIND_ODDEVEN) {
133 } else { // rule == WIND_POSITIVE