begin //see diary 6.July 2016
picm:= TPicture.Create;
picm1:= TPicture.Create;
for n:=0 to nwidth-1 do
begin
// picture2[n]:= TPicture.Create; //already defined
nr:=n; //real of n
mr:=nr*nmax/nwidth; //real of m
m:=floor(mr);
dmr:=mr-m; //fade position
Str(m:4,nstring);
fastring:=files+'\b'+nstring+'.jpg';
Str(m+1:4,nstring);
fbstring:=files+'\b'+nstring+'.jpg';
picm.LoadFromFile(fastring); //image 1
picm1.LoadFromFile(fbstring); //image 2
for nh:=0 to nheight-1 do
begin
for nw:=0 to nwidth-1 do //for every pixel do
begin
colorm:=picm.bitmap.Canvas.Pixels[nw,nh]; //color of picm
RedGreenBlue(colorm, mRed, mGreen, mBlue); //bytes! -> only 512 different colors?
colorm1:=picm1.bitmap.Canvas.Pixels[nw,nh]; //color of picm1
RedGreenBlue(colorm1, m1Red, m1Green, m1Blue);
// fpcolorm1:=picm1.bitmap.Canvas.getColor(nw,nh); //FPcolor of picm1 does not work
nred:=round((1-dmr)*mRed+dmr*m1Red); //to be scaled by 256? or 8?
ngreen:=round((1-dmr)*mGreen+dmr*m1Green);
nblue:=round((1-dmr)*mBlue+dmr*m1Blue);
// function RGBToColor(R, G, B: Byte): TColor;
colorn:=RGBToColor(nred, ngreen, nblue);
picture2[n].bitmap.Canvas.Pixels[nw,nh]:=colorn; //image 3
end;
end;
end;
Str(n:4,nstring);
fastring:=files+'\bb'+nstring+'.jpg'; // bb... different name to not overwrite b... files of user
picture2[n].SaveToFile(fastring); //
picture2[n].free; //
end;