1 | procedure FastBlendPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
2 | begin
|
---|
3 | while Count > 0 do
|
---|
4 | begin
|
---|
5 | FastBlendPixelInline(pdest, psrc^);
|
---|
6 | Inc(pdest);
|
---|
7 | Inc(psrc);
|
---|
8 | Dec(Count);
|
---|
9 | end;
|
---|
10 | end;
|
---|
11 |
|
---|
12 | procedure DrawTransparentPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
13 | begin
|
---|
14 | while Count > 0 do
|
---|
15 | begin
|
---|
16 | DrawPixelInlineWithAlphaCheck(pdest, psrc^);
|
---|
17 | Inc(pdest);
|
---|
18 | Inc(psrc);
|
---|
19 | Dec(Count);
|
---|
20 | end;
|
---|
21 | end;
|
---|
22 |
|
---|
23 | procedure LinearMultiplyPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
24 | begin
|
---|
25 | while Count > 0 do
|
---|
26 | begin
|
---|
27 | LinearMultiplyPixelInline(pdest, psrc^); //same look with non linear
|
---|
28 | Inc(pdest);
|
---|
29 | Inc(psrc);
|
---|
30 | Dec(Count);
|
---|
31 | end;
|
---|
32 | end;
|
---|
33 |
|
---|
34 | procedure AddPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
35 | begin
|
---|
36 | while Count > 0 do
|
---|
37 | begin
|
---|
38 | AddPixelInline(pdest, psrc^);
|
---|
39 | Inc(pdest);
|
---|
40 | Inc(psrc);
|
---|
41 | Dec(Count);
|
---|
42 | end;
|
---|
43 | end;
|
---|
44 |
|
---|
45 | procedure LinearAddPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
46 | begin
|
---|
47 | while Count > 0 do
|
---|
48 | begin
|
---|
49 | LinearAddPixelInline(pdest, psrc^);
|
---|
50 | Inc(pdest);
|
---|
51 | Inc(psrc);
|
---|
52 | Dec(Count);
|
---|
53 | end;
|
---|
54 | end;
|
---|
55 |
|
---|
56 | procedure ColorBurnPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
57 | begin
|
---|
58 | while Count > 0 do
|
---|
59 | begin
|
---|
60 | ColorBurnPixelInline(pdest, psrc^);
|
---|
61 | Inc(pdest);
|
---|
62 | Inc(psrc);
|
---|
63 | Dec(Count);
|
---|
64 | end;
|
---|
65 | end;
|
---|
66 |
|
---|
67 | procedure ColorDodgePixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
68 | begin
|
---|
69 | while Count > 0 do
|
---|
70 | begin
|
---|
71 | ColorDodgePixelInline(pdest, psrc^);
|
---|
72 | Inc(pdest);
|
---|
73 | Inc(psrc);
|
---|
74 | Dec(Count);
|
---|
75 | end;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure DividePixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
79 | begin
|
---|
80 | while Count > 0 do
|
---|
81 | begin
|
---|
82 | DividePixelInline(pdest, psrc^);
|
---|
83 | Inc(pdest);
|
---|
84 | Inc(psrc);
|
---|
85 | Dec(Count);
|
---|
86 | end;
|
---|
87 | end;
|
---|
88 |
|
---|
89 | procedure ReflectPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
90 | begin
|
---|
91 | while Count > 0 do
|
---|
92 | begin
|
---|
93 | ReflectPixelInline(pdest, psrc^);
|
---|
94 | Inc(pdest);
|
---|
95 | Inc(psrc);
|
---|
96 | Dec(Count);
|
---|
97 | end;
|
---|
98 | end;
|
---|
99 |
|
---|
100 | procedure GlowPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
101 | begin
|
---|
102 | while Count > 0 do
|
---|
103 | begin
|
---|
104 | GlowPixelInline(pdest, psrc^);
|
---|
105 | Inc(pdest);
|
---|
106 | Inc(psrc);
|
---|
107 | Dec(Count);
|
---|
108 | end;
|
---|
109 | end;
|
---|
110 |
|
---|
111 | procedure NiceGlowPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
112 | begin
|
---|
113 | while Count > 0 do
|
---|
114 | begin
|
---|
115 | NiceGlowPixelInline(pdest, psrc^);
|
---|
116 | Inc(pdest);
|
---|
117 | Inc(psrc);
|
---|
118 | Dec(Count);
|
---|
119 | end;
|
---|
120 | end;
|
---|
121 |
|
---|
122 | procedure OverlayPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
123 | begin
|
---|
124 | while Count > 0 do
|
---|
125 | begin
|
---|
126 | OverlayPixelInline(pdest, psrc^);
|
---|
127 | Inc(pdest);
|
---|
128 | Inc(psrc);
|
---|
129 | Dec(Count);
|
---|
130 | end;
|
---|
131 | end;
|
---|
132 |
|
---|
133 | procedure LinearOverlayPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
134 | begin
|
---|
135 | while Count > 0 do
|
---|
136 | begin
|
---|
137 | LinearOverlayPixelInline(pdest, psrc^);
|
---|
138 | Inc(pdest);
|
---|
139 | Inc(psrc);
|
---|
140 | Dec(Count);
|
---|
141 | end;
|
---|
142 | end;
|
---|
143 |
|
---|
144 | procedure DifferencePixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
145 | begin
|
---|
146 | while Count > 0 do
|
---|
147 | begin
|
---|
148 | DifferencePixelInline(pdest, psrc^);
|
---|
149 | Inc(pdest);
|
---|
150 | Inc(psrc);
|
---|
151 | Dec(Count);
|
---|
152 | end;
|
---|
153 | end;
|
---|
154 |
|
---|
155 | procedure LinearDifferencePixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
156 | begin
|
---|
157 | while Count > 0 do
|
---|
158 | begin
|
---|
159 | LinearDifferencePixelInline(pdest, psrc^);
|
---|
160 | Inc(pdest);
|
---|
161 | Inc(psrc);
|
---|
162 | Dec(Count);
|
---|
163 | end;
|
---|
164 | end;
|
---|
165 |
|
---|
166 | procedure ExclusionPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
167 | begin
|
---|
168 | while Count > 0 do
|
---|
169 | begin
|
---|
170 | ExclusionPixelInline(pdest, psrc^);
|
---|
171 | Inc(pdest);
|
---|
172 | Inc(psrc);
|
---|
173 | Dec(Count);
|
---|
174 | end;
|
---|
175 | end;
|
---|
176 |
|
---|
177 | procedure LinearExclusionPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
178 | begin
|
---|
179 | while Count > 0 do
|
---|
180 | begin
|
---|
181 | LinearExclusionPixelInline(pdest, psrc^);
|
---|
182 | Inc(pdest);
|
---|
183 | Inc(psrc);
|
---|
184 | Dec(Count);
|
---|
185 | end;
|
---|
186 | end;
|
---|
187 |
|
---|
188 | procedure LinearSubtractPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
189 | begin
|
---|
190 | while Count > 0 do
|
---|
191 | begin
|
---|
192 | LinearSubtractPixelInline(pdest, psrc^);
|
---|
193 | Inc(pdest);
|
---|
194 | Inc(psrc);
|
---|
195 | Dec(Count);
|
---|
196 | end;
|
---|
197 | end;
|
---|
198 |
|
---|
199 | procedure LinearSubtractInversePixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
200 | begin
|
---|
201 | while Count > 0 do
|
---|
202 | begin
|
---|
203 | LinearSubtractInversePixelInline(pdest, psrc^);
|
---|
204 | Inc(pdest);
|
---|
205 | Inc(psrc);
|
---|
206 | Dec(Count);
|
---|
207 | end;
|
---|
208 | end;
|
---|
209 |
|
---|
210 | procedure SubtractPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
211 | begin
|
---|
212 | while Count > 0 do
|
---|
213 | begin
|
---|
214 | SubtractPixelInline(pdest, psrc^);
|
---|
215 | Inc(pdest);
|
---|
216 | Inc(psrc);
|
---|
217 | Dec(Count);
|
---|
218 | end;
|
---|
219 | end;
|
---|
220 |
|
---|
221 | procedure SubtractInversePixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
222 | begin
|
---|
223 | while Count > 0 do
|
---|
224 | begin
|
---|
225 | SubtractInversePixelInline(pdest, psrc^);
|
---|
226 | Inc(pdest);
|
---|
227 | Inc(psrc);
|
---|
228 | Dec(Count);
|
---|
229 | end;
|
---|
230 | end;
|
---|
231 |
|
---|
232 | procedure NegationPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
233 | begin
|
---|
234 | while Count > 0 do
|
---|
235 | begin
|
---|
236 | NegationPixelInline(pdest, psrc^);
|
---|
237 | Inc(pdest);
|
---|
238 | Inc(psrc);
|
---|
239 | Dec(Count);
|
---|
240 | end;
|
---|
241 | end;
|
---|
242 |
|
---|
243 | procedure LinearNegationPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
244 | begin
|
---|
245 | while Count > 0 do
|
---|
246 | begin
|
---|
247 | LinearNegationPixelInline(pdest, psrc^);
|
---|
248 | Inc(pdest);
|
---|
249 | Inc(psrc);
|
---|
250 | Dec(Count);
|
---|
251 | end;
|
---|
252 | end;
|
---|
253 |
|
---|
254 | procedure LightenPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
255 | begin
|
---|
256 | while Count > 0 do
|
---|
257 | begin
|
---|
258 | LightenPixelInline(pdest, psrc^);
|
---|
259 | Inc(pdest);
|
---|
260 | Inc(psrc);
|
---|
261 | Dec(Count);
|
---|
262 | end;
|
---|
263 | end;
|
---|
264 |
|
---|
265 | procedure DarkenPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
266 | begin
|
---|
267 | while Count > 0 do
|
---|
268 | begin
|
---|
269 | DarkenPixelInline(pdest, psrc^);
|
---|
270 | Inc(pdest);
|
---|
271 | Inc(psrc);
|
---|
272 | Dec(Count);
|
---|
273 | end;
|
---|
274 | end;
|
---|
275 |
|
---|
276 | procedure ScreenPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
277 | begin
|
---|
278 | while Count > 0 do
|
---|
279 | begin
|
---|
280 | ScreenPixelInline(pdest, psrc^);
|
---|
281 | Inc(pdest);
|
---|
282 | Inc(psrc);
|
---|
283 | Dec(Count);
|
---|
284 | end;
|
---|
285 | end;
|
---|
286 |
|
---|
287 | procedure SoftLightPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
288 | begin
|
---|
289 | while Count > 0 do
|
---|
290 | begin
|
---|
291 | SoftLightPixelInline(pdest, psrc^);
|
---|
292 | Inc(pdest);
|
---|
293 | Inc(psrc);
|
---|
294 | Dec(Count);
|
---|
295 | end;
|
---|
296 | end;
|
---|
297 |
|
---|
298 | procedure SvgSoftLightPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
299 | begin
|
---|
300 | while Count > 0 do
|
---|
301 | begin
|
---|
302 | SvgSoftLightPixelInline(pdest, psrc^);
|
---|
303 | Inc(pdest);
|
---|
304 | Inc(psrc);
|
---|
305 | Dec(Count);
|
---|
306 | end;
|
---|
307 | end;
|
---|
308 |
|
---|
309 | procedure HardLightPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
310 | begin
|
---|
311 | while Count > 0 do
|
---|
312 | begin
|
---|
313 | HardLightPixelInline(pdest, psrc^);
|
---|
314 | Inc(pdest);
|
---|
315 | Inc(psrc);
|
---|
316 | Dec(Count);
|
---|
317 | end;
|
---|
318 | end;
|
---|
319 |
|
---|
320 | procedure BlendXorPixels(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
321 | begin
|
---|
322 | while Count > 0 do
|
---|
323 | begin
|
---|
324 | BlendXorPixelInline(pdest, psrc^);
|
---|
325 | Inc(pdest);
|
---|
326 | Inc(psrc);
|
---|
327 | Dec(Count);
|
---|
328 | end;
|
---|
329 | end;
|
---|
330 |
|
---|
331 | type
|
---|
332 | TBlendPixelsProc = procedure(pdest: PBGRAPixel; psrc: PBGRAPixel; Count: integer);
|
---|
333 |
|
---|
334 | const
|
---|
335 | BlendPixelsProc: array[TBlendOperation] of TBlendPixelsProc =
|
---|
336 | ( @FastBlendPixels, @DrawTransparentPixels,
|
---|
337 | @LightenPixels, @ScreenPixels, @AddPixels, @LinearAddPixels, @ColorDodgePixels, @DividePixels, @NiceGlowPixels, @SoftLightPixels, @HardLightPixels,
|
---|
338 | @GlowPixels, @ReflectPixels, @LinearOverlayPixels, @OverlayPixels, @DarkenPixels, @LinearMultiplyPixels, @ColorBurnPixels,
|
---|
339 | @DifferencePixels, @LinearDifferencePixels, @ExclusionPixels, @LinearExclusionPixels, @SubtractPixels, @LinearSubtractPixels,
|
---|
340 | @SubtractInversePixels, @LinearSubtractInversePixels, @NegationPixels, @LinearNegationPixels, @BlendXorPixels, @SvgSoftLightPixels);
|
---|
341 |
|
---|
342 | procedure BlendPixels(pdest: PBGRAPixel; psrc: PBGRAPixel;
|
---|
343 | blendOp: TBlendOperation; Count: integer);
|
---|
344 | begin
|
---|
345 | BlendPixelsProc[blendOp](pdest,psrc,count);
|
---|
346 | end;
|
---|
347 |
|
---|