//浮雕
procedure Emboss(SrcBmp,DestBmp:TBitmap;AzimuthChange:integer);overload;
var
i, j, Gray, Azimuthvalue, R, G, B: integer;
SrcRGB, SrcRGB1, SrcRGB2, DestRGB: pRGBTriple;
begin
for i := 0 to SrcBmp.Height - 1 do
begin
SrcRGB := SrcBmp.ScanLine[i];
DestRGB := DestBmp.ScanLine[i];
if (AzimuthChange >= -180) and (AzimuthChange < -135) then
begin
if i > 0 then
SrcRGB1 := SrcBmp.ScanLine[i-1]
else
SrcRGB1 := SrcRGB;
Inc(SrcRGB1);
SrcRGB2 := SrcRGB;
Inc(SrcRGB2);
end
else if (AzimuthChange >= -135) and (AzimuthChange < -90) then
begin
if i > 0 then
SrcRGB1 := SrcBmp.ScanLine[i-1]
else
SrcRGB1 := SrcRGB;
SrcRGB2 := SrcRGB1;
Inc(SrcRGB2);
end
else if (AzimuthChange >= -90) and (AzimuthChange < -45) then
begin
if i > 0 then
SrcRGB1 := SrcBmp.ScanLine[i-1]
else
SrcRGB1 := SrcRGB;
SrcRGB2 := SrcRGB1;
end
else if (AzimuthChange >= -45) and (AzimuthChange < 0) then
begin
SrcRGB1 := SrcRGB;
if i > 0 then
SrcRGB2 := SrcBmp.ScanLine[i-1]
else
SrcRGB2 := SrcRGB;
end
else if (AzimuthChange >= 0) and (AzimuthChange < 45) then
begin
SrcRGB2 := SrcRGB;
if (i < SrcBmp.Height - 1) then
SrcRGB1 := SrcBmp.ScanLine[i+1]
else
SrcRGB1 := SrcRGB;
end
else if (AzimuthChange >= 45) and (AzimuthChange < 90) then
begin
if (i < SrcBmp.Height - 1) then
SrcRGB1 := SrcBmp.ScanLine[i+1]
else
SrcRGB1 := SrcRGB;
SrcRGB2 := SrcRGB1;
end
else if (AzimuthChange >= 90) and (AzimuthChange < 135) then
begin
if (i < SrcBmp.Height - 1) then
SrcRGB1 := SrcBmp.ScanLine[i+1]
else
SrcRGB1 := SrcRGB;
SrcRGB2 := SrcRGB1;
Inc(SrcRGB1);
end
else if (AzimuthChange >= 135) and (AzimuthChange <= 180) then
begin
if (i < SrcBmp.Height - 1) then
SrcRGB2 := SrcBmp.ScanLine[i+1]
else
SrcRGB2 := SrcRGB;
Inc(SrcRGB2);
SrcRGB1 := SrcRGB;
Inc(SrcRGB1);
end;
for j := 0 to SrcBmp.Width - 1 do
begin
if (AzimuthChange >= -180) and (AzimuthChange < -135) then
begin
Azimuthvalue := AzimuthChange + 180;
R:=SrcRGB.rgbtRed-((SrcRGB1.rgbtRed)*Azimuthvalue div 45)-((SrcRGB2.rgbtRed)*(45-Azimuthvalue) div 45)+78;
G:=SrcRGB.rgbtGreen-((SrcRGB1.rgbtGreen)*Azimuthvalue div 45)-((SrcRGB2.rgbtGreen)*(45-Azimuthvalue) div 45)+78;
B:=SrcRGB.rgbtBlue-((SrcRGB1.rgbtBlue)*Azimuthvalue div 45)-((SrcRGB2.rgbtBlue)*(45-Azimuthvalue) div 45)+78;
end
else if (AzimuthChange >= -135) and (AzimuthChange < -90) then
begin
Azimuthvalue := AzimuthChange + 135;
R:=SrcRGB.rgbtRed-((SrcRGB1.rgbtRed)*Azimuthvalue div 45)-((SrcRGB2.rgbtRed)*(45-Azimuthvalue) div 45)+78;
G:=SrcRGB.rgbtGreen-((SrcRGB1.rgbtGreen)*Azimuthvalue div 45)-((SrcRGB2.rgbtGreen)*(45-Azimuthvalue) div 45)+78;
B:=SrcRGB.rgbtBlue-((SrcRGB1.rgbtBlue)*Azimuthvalue div 45)-((SrcRGB2.rgbtBlue)*(45-Azimuthvalue) div 45)+78;
end
else if (AzimuthChange >= -90) and (AzimuthChange < -45) then
begin
if j=1 then Inc(SrcRGB1,-1);
Azimuthvalue := AzimuthChange + 90;
R:=SrcRGB.rgbtRed-((SrcRGB1.rgbtRed)*Azimuthvalue div 45)-((SrcRGB2.rgbtRed)*(45-Azimuthvalue) div 45)+78;
G:=SrcRGB.rgbtGreen-((SrcRGB1.rgbtGreen)*Azimuthvalue div 45)-((SrcRGB2.rgbtGreen)*(45-Azimuthvalue) div 45)+78;
B:=SrcRGB.rgbtBlue-((SrcRGB1.rgbtBlue)*Azimuthvalue div 45)-((SrcRGB2.rgbtBlue)*(45-Azimuthvalue) div 45)+78;
end
else if (AzimuthChange >= -45) and (AzimuthChange < 0) then
begin
if j=1 then
begin
Inc(SrcRGB1,-1);
Inc(SrcRGB2,-1);
end;
Azimuthvalue := AzimuthChange + 45;
R:=SrcRGB.rgbtRed-((SrcRGB1.rgbtRed)*Azimuthvalue div 45)-((SrcRGB2.rgbtRed)*(45-Azimuthvalue) div 45)+78;
G:=SrcRGB.rgbtGreen-((SrcRGB1.rgbtGreen)*Azimuthvalue div 45)-((SrcRGB2.rgbtGreen)*(45-Azimuthvalue) div 45)+78;
B:=SrcRGB.rgbtBlue-((SrcRGB1.rgbtBlue)*Azimuthvalue div 45)-((SrcRGB2.rgbtBlue)*(45-Azimuthvalue) div 45)+78;
end
else if (AzimuthChange >= 0) and (AzimuthChange < 45) then
begin
if j=1 then
begin
Inc(SrcRGB1,-1);
Inc(SrcRGB2,-1);
end;
Azimuthvalue := AzimuthChange;
R:=SrcRGB.rgbtRed-((SrcRGB1.rgbtRed)*Azimuthvalue div 45)-((SrcRGB2.rgbtRed)*(45-Azimuthvalue) div 45)+78;
G:=SrcRGB.rgbtGreen-((SrcRGB1.rgbtGreen)*Azimuthvalue div 45)-((SrcRGB2.rgbtGreen)*(45-Azimuthvalue) div 45)+78;
B:=SrcRGB.rgbtBlue-((SrcRGB1.rgbtBlue)*Azimuthvalue div 45)-((SrcRGB2.rgbtBlue)*(45-Azimuthvalue) div 45)+78;
end
else if (AzimuthChange >= 45) and (AzimuthChange < 90) then