Hello, guys!

I'm using VCL's TBitmap with PixelFormat = pf32bit and using the 4st of the pixel byte as my alpha channel. Instead of using the TRGBQuad record of delphi, I'm using the following datatypes:
[pascal]type
PRGB32 = ^TRGB32;
TRGB32 = packed record
B, G, R, A : byte;
end;
[/pascal]
Ok. It woks just fine and I can load and save bitmaps with a valid alpha channel.
Now I'm trying to blend pixels using the alpha information, but the formula I'm usiging is producing a strange result. Could anyone, please, tell me a valid formula to blend pixels using alpha channel or say what I'm doing wrong? This is what my code looks like:

[pascal]procedure TfrmCGScreen.DrawScene;
var
x, y, m : integer;
p : PRGB32;
begin

//Just creating a background pattern...
for x:=0 to fBuffer.Width-1 do
for y:=0 to fBuffer.Height-1 do
with fBufferFisrtLine[Y*fBufferLineLength+X] do
begin
B := 0;
R := 0;
A := 0;
m := Tag div fBuffer.Height;
case m of
0 : B := ((x or y) + Tag) mod 255;
1 : G := ((x and y) + Tag) mod 255;
2 : R := ((x or y) + Tag) mod 255;
else
begin
G := ((x xor y) + Tag) mod 255;
tag := 0;
end;
end;
end;

//now I'm trying to blend the "fBlendImage" with the image in my backffuer
for y:=0 to fBlendImage.Height-1 do
begin
p := fBlendImage.ScanLine[y];
for x:= 0 to fBlendImage.Width -1 do
begin
with fBufferFisrtLine[Y*fBufferLineLength+ (X + (tag mod 600))] do
begin
B := B + p.B * p.A div 255;
G := G + p.G * p.A div 255;
R := R + p.R * p.A div 255;
end;
Inc(p);
end;
end;
Tag := Tag+1;
end;[/pascal]

Thanks a lot!