27 #include "config_auto.h" 30 #define INTERSECTING INT16_MAX 32 int lessthan(
const void *first,
const void *second);
35 ICOORDELT_IT v = &vertices;
47 ICOORDELT_IT v = &vertices;
68 ICOORDELT_IT pts = &vertices;
70 botleft = *pts.data ();
74 if (pos.
x () < botleft.
x ())
76 botleft =
ICOORD (pos.
x (), botleft.
y ());
77 if (pos.
y () < botleft.
y ())
78 botleft =
ICOORD (botleft.
x (), pos.
y ());
79 if (pos.
x () > topright.
x ())
80 topright =
ICOORD (pos.
x (), topright.
y ());
81 if (pos.
y () > topright.
y ())
82 topright =
ICOORD (topright.
x (), pos.
y ());
85 while (!pts.at_first ());
86 ibl =
ICOORD (botleft.
x (), botleft.
y ());
87 itr =
ICOORD (topright.
x (), topright.
y ());
88 box =
TBOX (ibl, itr);
105 ICOORDELT_IT it = &vertices;
111 vvec = *it.data_relative (1) - pt;
113 if (vec.
y () <= 0 && vec.
y () + vvec.
y () > 0) {
120 else if (vec.
y () > 0 && vec.
y () + vvec.
y () <= 0) {
127 else if (vec.
y () == 0 && vec.
x () == 0)
131 while (!it.at_first ());
139 ICOORDELT_IT it = &vertices;
148 vertex = *it.data ();
156 while (!it.at_first ());
161 it.set_to_list (other->
points ());
163 vertex = *it.data ();
171 while (!it.at_first ());
186 ICOORDELT_IT pts = &vertices;
193 pt->
set_x(static_cast<int16_t>(floor(pos.
x() + 0.5)));
194 pt->
set_y(static_cast<int16_t>(floor(pos.
y() + 0.5)));
197 while (!pts.at_first ());
209 ICOORDELT_IT pts = &vertices;
216 while (!pts.at_first());
230 ICOORDELT_IT pts = &vertices;
237 while (!pts.at_first ());
242 #ifndef GRAPHICS_DISABLED 244 ICOORDELT_IT v = &vertices;
253 #if !defined(_WIN32) || defined(__MINGW32__) 254 snprintf(temp_buff,
sizeof(temp_buff),
"%" PRId32, num);
256 ltoa (num, temp_buff, 10);
258 window->
Text(v.data ()->x (), v.data ()->y (), temp_buff);
261 window->
SetCursor(v.data ()->x (), v.data ()->y ());
262 for (v.mark_cycle_pt (); !v.cycled_list (); v.forward ()) {
263 window->
DrawTo(v.data ()->x (), v.data ()->y ());
266 window->
DrawTo(v.data ()->x (), v.data ()->y ());
281 const std::unique_ptr< ICOORDELT_LIST> segments(
283 if (!segments->empty ()) {
284 s_it.set_to_list(segments.get());
285 for (s_it.mark_cycle_pt (); !s_it.cycled_list (); s_it.forward ()) {
289 width = s_it.data ()->y ();
290 window->
SetCursor(s_it.data ()->x (), y);
291 window->
DrawTo(s_it.data()->x() +
static_cast<float>(width), y);
304 ICOORDELT_IT it = &vertices;
313 vertex = *it.data ();
321 while (!it.at_first ());
326 it.set_to_list (other->
points ());
336 while (!it.at_first ());
343 ICOORDELT_LIST *result;
346 result =
new ICOORDELT_LIST ();
347 r.set_to_list (result);
348 v.set_to_list (block->
points ());
350 for (v.mark_cycle_pt (); !v.cycled_list (); v.forward ()) {
351 if (((v.data_relative (-1)->y () > y) && (v.data ()->y () <= y))
352 || ((v.data_relative (-1)->y () <= y) && (v.data ()->y () > y))) {
353 previous = v.data_relative (-1);
355 float fx = 0.5f + previous->
x() +
356 (current->
x() - previous->
x()) * (fy - previous->
y()) /
357 (current->
y() - previous->
y());
358 x =
new ICOORDELT(static_cast<int16_t>(fx), 0);
365 for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ())
367 for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ()) {
368 r.data ()->
set_y (r.data_relative (1)->x () - r.data ()->x ());
370 delete (r.extract ());
378 int lessthan(
const void *first,
const void *second) {
382 if (p1->
x () < p2->
x ())
384 else if (p1->
x () > p2->
x ())
390 #ifndef GRAPHICS_DISABLED 412 return kPBColors[type];
416 #endif // GRAPHICS_DISABLED void DrawTo(int x, int y)
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)
void set_x(int16_t xin)
rewrite function
void rotate(const FCOORD vec)
int16_t y() const
access_function
void rotate(FCOORD rotation)
void set_x(float xin)
rewrite function
void SetCursor(int x, int y)
int lessthan(const void *first, const void *second)
static ScrollView::Color ColorForPolyBlockType(PolyBlockType type)
Returns a color to draw the given type.
void fill(ScrollView *window, ScrollView::Color colour)
bool contains(POLY_BLOCK *other)
int16_t x() const
access function
ICOORDELT_LIST * get_line(int16_t y)
void Text(int x, int y, const char *mystring)
bool overlap(POLY_BLOCK *other)
bool overlap(const TBOX &box) const
int16_t winding_number(const ICOORD &test_pt)
ICOORDELT_LIST * points()
void set_y(int16_t yin)
rewrite function
void plot(ScrollView *window, int32_t num)
void set_y(float yin)
rewrite function