Changeset 472 for GraphicTest/Packages/bgrabitmap/bgrablend.pas
- Timestamp:
- Apr 9, 2015, 9:58:36 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/Packages/bgrabitmap/bgrablend.pas
r452 r472 26 26 27 27 { Draw a series of pixels with alpha blending } 28 procedure PutPixels(pdest: PBGRAPixel; psource: PBGRAPixel; copycount: integer; mode: TDrawMode; AOpacity:byte); 28 29 procedure DrawPixelsInline(dest: PBGRAPixel; c: TBGRAPixel; Count: integer); inline; overload; 29 30 procedure DrawExpandedPixelsInline(dest: PBGRAPixel; ec: TExpandedPixel; Count: integer); inline; overload; … … 238 239 end; 239 240 241 procedure PutPixels(pdest: PBGRAPixel; psource: PBGRAPixel; copycount: integer; 242 mode: TDrawMode; AOpacity: byte); 243 var i: integer; tempPixel: TBGRAPixel; 244 begin 245 case mode of 246 dmSet: 247 begin 248 if AOpacity <> 255 then 249 CopyPixelsWithOpacity(pdest, psource, AOpacity, copycount) 250 else 251 begin 252 copycount *= sizeof(TBGRAPixel); 253 move(psource^, pdest^, copycount); 254 end; 255 end; 256 dmSetExceptTransparent: 257 begin 258 if AOpacity <> 255 then 259 begin 260 for i := copycount - 1 downto 0 do 261 begin 262 if psource^.alpha = 255 then 263 begin 264 tempPixel := psource^; 265 tempPixel.alpha := ApplyOpacity(tempPixel.alpha,AOpacity); 266 FastBlendPixelInline(pdest,tempPixel); 267 end; 268 Inc(pdest); 269 Inc(psource); 270 end; 271 end else 272 for i := copycount - 1 downto 0 do 273 begin 274 if psource^.alpha = 255 then 275 pdest^ := psource^; 276 Inc(pdest); 277 Inc(psource); 278 end; 279 end; 280 dmDrawWithTransparency: 281 begin 282 if AOpacity <> 255 then 283 begin 284 for i := copycount - 1 downto 0 do 285 begin 286 DrawPixelInlineWithAlphaCheck(pdest, psource^, AOpacity); 287 Inc(pdest); 288 Inc(psource); 289 end; 290 end 291 else 292 for i := copycount - 1 downto 0 do 293 begin 294 DrawPixelInlineWithAlphaCheck(pdest, psource^); 295 Inc(pdest); 296 Inc(psource); 297 end; 298 end; 299 dmFastBlend: 300 begin 301 if AOpacity <> 255 then 302 begin 303 for i := copycount - 1 downto 0 do 304 begin 305 FastBlendPixelInline(pdest, psource^, AOpacity); 306 Inc(pdest); 307 Inc(psource); 308 end; 309 end else 310 for i := copycount - 1 downto 0 do 311 begin 312 FastBlendPixelInline(pdest, psource^); 313 Inc(pdest); 314 Inc(psource); 315 end; 316 end; 317 dmXor: 318 begin 319 if AOpacity <> 255 then 320 begin 321 for i := copycount - 1 downto 0 do 322 begin 323 FastBlendPixelInline(pdest, TBGRAPixel(PDWord(pdest)^ xor PDword(psource)^), AOpacity); 324 Inc(pdest); 325 Inc(psource); 326 end; 327 end else 328 XorPixels(pdest, psource, copycount); 329 end; 330 end; 331 end; 332 240 333 procedure DrawPixelsInline(dest: PBGRAPixel; c: TBGRAPixel; Count: integer); 241 334 var … … 385 478 a1f, a2f, a12, a12m: cardinal; 386 479 begin 480 {$HINTS OFF} 387 481 a12 := 65025 - (not dest^.alpha) * (not c.alpha); 482 {$HINTS ON} 388 483 a12m := a12 shr 1; 389 484 … … 412 507 a1f, a2f, a12, a12m: cardinal; 413 508 begin 509 {$HINTS OFF} 414 510 a12 := 65025 - (not dest^.alpha) * (not calpha); 511 {$HINTS ON} 415 512 a12m := a12 shr 1; 416 513 … … 446 543 end; 447 544 545 {$HINTS OFF} 448 546 a12 := 65025 - (not dest^.alpha) * (not c.alpha); 547 {$HINTS ON} 449 548 a12m := a12 shr 1; 450 549
Note:
See TracChangeset
for help on using the changeset viewer.