1 | {$IFDEF INCLUDE_FILLDENSITY}
|
---|
2 | {$UNDEF INCLUDE_FILLDENSITY}
|
---|
3 |
|
---|
4 | {$IFNDEF PARAM_SINGLESEGMENT}
|
---|
5 | begin
|
---|
6 | { this loops fill one scanline of densities by adding 256 for full horizontal pixels }
|
---|
7 |
|
---|
8 | for i := 0 to nbinter div 2 - 1 do
|
---|
9 | begin
|
---|
10 | x1 := inter[i + i].interX;
|
---|
11 | x2 := inter[i + i + 1].interX;
|
---|
12 | {$ENDIF}
|
---|
13 |
|
---|
14 | if (x1 <> x2) and (x1 < maxx + 1) and (x2 >= minx) then
|
---|
15 | begin
|
---|
16 | if x1 < minx then
|
---|
17 | x1 := minx;
|
---|
18 | if x2 >= maxx + 1 then
|
---|
19 | x2 := maxx + 1;
|
---|
20 | ix1 := floor(x1);
|
---|
21 | ix2 := floor(x2);
|
---|
22 |
|
---|
23 | //here it may go one pixel further if x2 is an integer
|
---|
24 | if ix1 < densMinx then densMinx := ix1;
|
---|
25 | if ix2 > densMaxx then densMaxx := ix2;
|
---|
26 |
|
---|
27 | if ix1 = ix2 then
|
---|
28 | (density + (ix1 - minx))^ += round((x2-ix2)*256) - round((x1-ix1)*256)
|
---|
29 | else
|
---|
30 | begin
|
---|
31 | (density + (ix1 - minx))^ += 256 - round((x1 - ix1)*256);
|
---|
32 | if (ix2 <= maxx) then
|
---|
33 | (density + (ix2 - minx))^ += round((x2 - ix2)*256);
|
---|
34 | end;
|
---|
35 | if ix2 > ix1 + 1 then
|
---|
36 | begin
|
---|
37 | AddDensity(density, ix1+1 - minx, ix2-(ix1+1), 256);
|
---|
38 | end;
|
---|
39 | end;
|
---|
40 |
|
---|
41 | {$IFNDEF PARAM_SINGLESEGMENT}
|
---|
42 | end;
|
---|
43 | end;
|
---|
44 | {$ENDIF}
|
---|
45 |
|
---|
46 | {$UNDEF PARAM_SINGLESEGMENT}
|
---|
47 | {$ENDIF}
|
---|
48 |
|
---|
49 | {$IFDEF INCLUDE_RENDERDENSITY}
|
---|
50 | {$UNDEF INCLUDE_RENDERDENSITY}
|
---|
51 | begin
|
---|
52 | if densMinX <= densMaxX then
|
---|
53 | begin
|
---|
54 | if densMinX < minx then densMinX := minx;
|
---|
55 | if densMaxX > maxx then densMaxX := maxx;
|
---|
56 |
|
---|
57 | pdest := bmp.ScanLine[yb] + densMinX;
|
---|
58 | pdens := density + (densMinX-minx);
|
---|
59 | //render scanline
|
---|
60 | if scan <> nil then //with texture scan
|
---|
61 | begin
|
---|
62 | scan.ScanMoveTo(densMinX,yb);
|
---|
63 | if MemScanCopy <> nil then
|
---|
64 | begin
|
---|
65 | scan.ScanPutPixels(MemScanCopy,densMaxX-densMinX+1,dmSet);
|
---|
66 | pscan := MemScanCopy;
|
---|
67 | for xb := densMinX to densMaxX do
|
---|
68 | begin
|
---|
69 | tempDensity := pdens^;
|
---|
70 | Inc(pdens);
|
---|
71 | if tempDensity >= 256 {$ifdef PARAM_ANTIALIASINGFACTOR}shl AntialiasPrecisionShift{$endif} then
|
---|
72 | {$ifdef PARAM_LINEARANTIALIASING}
|
---|
73 | FastBlendPixelInline
|
---|
74 | {$else}
|
---|
75 | DrawPixelInlineWithAlphaCheck{$endif}(pdest, pscan^) else
|
---|
76 | if tempDensity <> 0 then
|
---|
77 | begin
|
---|
78 | c := pscan^;
|
---|
79 | {$ifdef PARAM_LINEARANTIALIASING}
|
---|
80 | FastBlendPixelInline
|
---|
81 | {$else}
|
---|
82 | DrawPixelInlineWithAlphaCheck{$endif}(pdest, BGRA(c.red, c.green, c.blue,
|
---|
83 | {$ifdef PARAM_ANTIALIASINGFACTOR}DivByAntialiasPrecision256{$endif}
|
---|
84 | (c.alpha * tempDensity
|
---|
85 | {$ifdef PARAM_ANTIALIASINGFACTOR} ) {$else} +128) shr 8 {$endif}
|
---|
86 | ));
|
---|
87 | end;
|
---|
88 | inc(pscan);
|
---|
89 | Inc(pdest);
|
---|
90 | end;
|
---|
91 | end else
|
---|
92 | begin
|
---|
93 | for xb := densMinX to densMaxX do
|
---|
94 | begin
|
---|
95 | tempDensity := pdens^;
|
---|
96 | Inc(pdens);
|
---|
97 | c := ScanNextPixelProc();
|
---|
98 | if tempDensity <> 0 then
|
---|
99 | {$ifdef PARAM_LINEARANTIALIASING}
|
---|
100 | FastBlendPixelInline
|
---|
101 | {$else}
|
---|
102 | DrawPixelInlineWithAlphaCheck{$endif}(pdest, BGRA(c.red, c.green, c.blue,
|
---|
103 | {$ifdef PARAM_ANTIALIASINGFACTOR}DivByAntialiasPrecision256{$endif}
|
---|
104 | (c.alpha * tempDensity
|
---|
105 | {$ifdef PARAM_ANTIALIASINGFACTOR} ) {$else} +128) shr 8 {$endif}
|
---|
106 | ));
|
---|
107 | Inc(pdest);
|
---|
108 | end;
|
---|
109 | end;
|
---|
110 |
|
---|
111 | end else
|
---|
112 | if EraseMode then //erase with alpha
|
---|
113 | begin
|
---|
114 | for xb := densMinX to densMaxX do
|
---|
115 | begin
|
---|
116 | tempDensity := pdens^;
|
---|
117 | Inc(pdens);
|
---|
118 | if tempDensity <> 0 then
|
---|
119 | ErasePixelInline(pdest,
|
---|
120 | {$ifdef PARAM_ANTIALIASINGFACTOR}DivByAntialiasPrecision256{$endif}
|
---|
121 | (c.alpha * tempDensity
|
---|
122 | {$ifdef PARAM_ANTIALIASINGFACTOR} ) {$else} +128) shr 8 {$endif}
|
---|
123 | );
|
---|
124 | Inc(pdest);
|
---|
125 | end;
|
---|
126 | end
|
---|
127 | else
|
---|
128 | begin //solid color
|
---|
129 | for xb := densMinX to densMaxX do
|
---|
130 | begin
|
---|
131 | tempDensity := pdens^;
|
---|
132 | Inc(pdens);
|
---|
133 | if tempDensity <> 0 then
|
---|
134 | begin
|
---|
135 | c2.alpha :=
|
---|
136 | {$ifdef PARAM_ANTIALIASINGFACTOR}DivByAntialiasPrecision256{$endif}
|
---|
137 | (c.alpha * tempDensity
|
---|
138 | {$ifdef PARAM_ANTIALIASINGFACTOR} ) {$else} +128) shr 8 {$endif}
|
---|
139 | ;
|
---|
140 | {$ifdef PARAM_LINEARANTIALIASING}
|
---|
141 | FastBlendPixelInline(pdest, c2);
|
---|
142 | {$else}
|
---|
143 | DrawPixelInlineExpandedOrNotWithAlphaCheck(pdest, ec, c2);
|
---|
144 | {$endif}
|
---|
145 | end;
|
---|
146 | Inc(pdest);
|
---|
147 | end;
|
---|
148 | end;
|
---|
149 | end;
|
---|
150 | end
|
---|
151 |
|
---|
152 | {$undef PARAM_ANTIALIASINGFACTOR}
|
---|
153 | {$undef PARAM_LINEARANTIALIASING}
|
---|
154 | {$ENDIF}
|
---|