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

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