Kann jemand helfen ?
Mein Versuch..
Delphi-Quellcode:
function Rgb2Alpha(colrRGB: Colorref): Byte;
begin
if colrRGB <> 0
then
Result := LOBYTE(round(colrRGB * 0.2989)) + LOBYTE(round((colrRGB
shr 8) * 0.5870)) +
LOBYTE(round((colrRGB
shr 16) * 0.114))
else
Result := 0;
end;
procedure TSkinEngine.SetupAlphaChannel(
DC: HDC);
var
bm: BITMAP;
P: integer;
Alpha: byte;
pBits: PByte;
begin
FillChar(bm, sizeof(bm), 0);
GetObject(GetCurrentObject(
DC, OBJ_BITMAP), sizeof(bm), @bm);
pBits := bm.bmBits;
for P := 0
to (bm.bmWidth * bm.bmHeight) -1
do
begin
Alpha := (Rgb2Alpha(
RGB(pBits[2], pBits[1], pBits[0]))
and $000000FF);
if ((Alpha = 0)
and (pBits[3] = 0))
then
pBits[3] := 0
else
if (pBits[3] = 0)
then
pBits[3] := 255;
inc(pBits, 4);
end;
end;
Das Problem ist einmal funktioniert es dann wieder nicht!
Das erste schlecht das zweite gut.
gruss