für alle die es interessiert:
Mit der CLX werden keine 24Bit Bitmaps unterstützt. (32Bit ist aber kein Problem)
Ich habe die Funktion mal umgeschrieben, damit Sie auch mit der CLX läuft:
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30:
| procedure TTiCidItem.Blending( bmpBottom, bmpTop:tbitmap; opacity:integer; var bmpResult:tbitmap); var x,y:integer; p1,p2:pbytearray; temp:tbitmap; hilf, hilf1:real; begin temp:=tbitmap.create; try temp.assign(bmpBottom); temp.pixelformat:=pf32bit;
hilf:=opacity/100; hilf1:=abs(1-hilf);
for y:=0 to temp.Height-1 do begin p1:=bmpTop.scanline[y]; p2:=temp.scanline[y];
for x:=0 to temp.Width-1 do begin p2[x*4]:=trunc(p1[x*4]*hilf+p2[x*4]*hilf1); p2[x*4+1]:=trunc(p1[x*4+1]*hilf+p2[x*4+1]*hilf1); p2[x*4+2]:=trunc(p1[x*4+2]*hilf+p2[x*4+2]*hilf1); end;
end; bmpResult.Assign(temp); finally temp.free; end; end; |