home *** CD-ROM | disk | FTP | other *** search
/ Graphics Programming Black Book (Special Edition) / BlackBook.bin / disk1 / source / chapterf / polygon.h < prev   
C/C++ Source or Header  |  1997-06-18  |  1KB  |  40 lines

  1. /* Listing 24.5. POLYGON.H
  2.    Header file for polygon-filling code */
  3.  
  4. #define CONVEX    0
  5. #define NONCONVEX 1
  6. #define COMPLEX   2
  7.  
  8. /* Describes a single point (used for a single vertex) */
  9. struct Point {
  10.    int X;   /* X coordinate */
  11.    int Y;   /* Y coordinate */
  12. };
  13.  
  14. /* Describes series of points (used to store a list of vertices that describe 
  15. a polygon; each vertex is assumed to connect to the two adjacent vertices, and 
  16. last vertex is assumed to connect to the first) */
  17. struct PointListHeader {
  18.    int Length;                /* # of points */
  19.    struct Point * PointPtr;   /* pointer to list of points */
  20. };
  21.  
  22. /* Describes beginning and ending X coordinates of a single horizontal line */
  23. struct HLine {
  24.    int XStart; /* X coordinate of leftmost pixel in line */
  25.    int XEnd;   /* X coordinate of rightmost pixel in line */
  26. };
  27.  
  28. /* Describes a Length-long series of horizontal lines, all assumed to be on 
  29. contiguous scan lines starting at YStart and proceeding downward (used to 
  30. describe scan-converted polygon to low-level hardware-dependent drawing code)*/
  31. struct HLineList {
  32.    int Length;                /* # of horizontal lines */
  33.    int YStart;                /* Y coordinate of topmost line */
  34.    struct HLine * HLinePtr;   /* pointer to list of horz lines */
  35. };
  36.  
  37. /* Describes a color as an RGB triple, plus one byte for other info */
  38. struct RGB { unsigned char Red, Green, Blue, Spare; };
  39.  
  40.