1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /** @file
3  * TODO: insert short description here
4  *//*
5  * Authors:
6  * see git history
7  * Fred
8  *
9  * Copyright (C) 2018 Authors
10  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11  */
12 
13 #ifndef my_bit_ligne
14 #define my_bit_ligne
15 
16 #include "LivarotDefs.h"
17 
18 /*
19  * a line of bits used for rasterizations of polygons
20  * the Scan() and QuickScan() functions fill the line with bits; after that you can use the Copy() function
21  * of the IntLigne class to have a set of pixel coverage runs
22  */
23 
24 class BitLigne {
25 public:
26   // start and end pixels of the line
27 	int           st,en;
28   // start and end bits of the line
29 	int           stBit,enBit;
30   // size of the fullB and partB arrays
31 	int           nbInt;
32   // arrays of uint32_t used to store the bits
33   // bits of fullB mean "this pixel/bit is entirely covered"
34   // bits of partB mean "this pixel/bit is not entirely covered" (a better use would be: "this pixel is at least partially covered)
35   // so it's in fact a triage mask
36 	uint32_t*     fullB;
37 	uint32_t*     partB;
38 
39   // when adding bits, these 2 values are updated to reflect which portion of the line has received coverage
40 	int           curMin,curMax;
41   // invScale is: canvas -> bit in the line
42   // scale is: bit -> canvas, ie the size (width) of a bit
43   float         scale,invScale;
44 
45 	BitLigne(int ist,int ien,float iScale=0.25);  // default scale is 1/4 for 4x4 supersampling
46     virtual ~BitLigne();
47 
48   // reset the line to full empty
49 	void             Reset();
50 
51   // put coverage from spos to epos (in canvas coordinates)
52   // full==true means that the bits from (fractional) position spos to epos are entirely covered
53   // full==false means the bits are not entirely covered, ie this is an edge
54   // see the Scan() and AvanceEdge() functions to see the difference
55 	int              AddBord(float spos,float epos,bool full);
56 
57   // debug dump
58 	void             Affiche();
59 
60 };
61 
62 #endif
63 
64 
65