Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - fg_getfillside http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                              fg_getfillside

   Usage
   #include <fg.h>
   int fg_getfillside(const fg_coord_t *pt_pairs, unsigned int vertices)

   Description
   Figure out which side of the polygon/outline, as it is traversed,  the
   fill is on. Return FG_FILL_ON_RIGHT or FG_FILL_ON_LEFT. The  algorithm
   may  fail if line segments cross each other or are colinear. The  last
   point  pair in the array pt_pairs must be equal to the first.  May  be
   used with fg_filloutline to fill arbitrary shapes.

   Example
   fill_users_outline()
   {
   fg_coord_t *p, *buf;
   unsigned int point_pairs;
   char *s;

        point_pairs = get_users_outline(&p)

        if(point_pairs 0)
        {
             unsigned int buffer_size;

             int side = fg_getfillside(p, point_pairs)

             if(side == FG_FILL_ON_RIGHT)
                  s = "Filling on the right side";
             else
             {
                  assert(side == FG_FILL_ON_LEFT);
                  s = "Filling on the left side.";
             }

             buffer_size = get_outline_buff_size(p, point_pairs);
             buf = malloc(buffer_size);
             if(buf)
             {
                  fg_filloutline(FG_WHITE,FG_MODE_SET,~0,p,buf,
                                 point_pairs,side,fg.displaybox);
                  free(buf);
             }
             else
                  s = "Insufficient memory.";
        }
        else
             s = "No outline obtained.";

        fg_puts(FG_WHITE, FG_MODE_SET, ~0, FG_ROT0, 0, 0, s,
                  fg.displaybox);
   }


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson