1 /*
2 * BitLigne.h
3 * nlivarot
4 *
5 * Created by fred on Wed Jul 23 2003.
6 * public domain
7 *
8 */
10 #ifndef my_bit_ligne
11 #define my_bit_ligne
13 #include "LivarotDefs.h"
15 /*
16 * a line of bits used for rasterizations of polygons
17 * the Scan() and QuickScan() functions fill the line with bits; after that you can use the Copy() function
18 * of the IntLigne class to have a set of pixel coverage runs
19 */
21 class BitLigne {
22 public:
23 // start and end pixels of the line
24 int st,en;
25 // start and end bits of the line
26 int stBit,enBit;
27 // size of the fullB and partB arrays
28 int nbInt;
29 // arrays of uint32_t used to store the bits
30 // bits of fullB mean "this pixel/bit is entirely covered"
31 // bits of partB mean "this pixel/bit is not entirely covered" (a better use would be: "this pixel is at least partially covered)
32 // so it's in fact a triage mask
33 uint32_t* fullB;
34 uint32_t* partB;
36 // when adding bits, these 2 values are updated to reflect which portion of the line has received coverage
37 int curMin,curMax;
38 // invScale is: canvas -> bit in the line
39 // scale is: bit -> canvas, ie the size (width) of a bit
40 float scale,invScale;
42 BitLigne(int ist,int ien,float iScale=0.25); // default scale is 1/4 for 4x4 supersampling
43 ~BitLigne(void);
45 // reset the line to full empty
46 void Reset(void);
48 // put coverage from spos to epos (in canvas coordinates)
49 // full==true means that the bits from (fractional) position spos to epos are entirely covered
50 // full==false means the bits are not entirely covered, ie this is an edge
51 // see the Scan() and AvanceEdge() functions to see the difference
52 int AddBord(float spos,float epos,bool full);
54 // debug dump
55 void Affiche(void);
57 };
59 #endif