浮雕效果
procedure TMainForm.EmbossClick(Sender: TObject);
var
i, j: integer;
p1, p2: pbyteArray;
Value: integer;
BMP: Tbitmap;
begin
bmp := TBITMAP.Create;
BMP.Assign(Childform.Image1.Picture.Bitmap);
bmp.PixelFormat := pf24bit;
for i := 0 to bmp.Height - 2 do
begin
p1 := Bmp.ScanLine;
p2 := Bmp.ScanLine[i + 1];
for j := 0 to Bmp.Width - 1 do
begin
Value := (p1[3 * j + 2] - p2[3 * j + 2]) + 128;
p1[3 * j + 2] := Min(255, Max(0, Value));
Value := p1[3 * j + 1] - p2[3 * j + 1] + 128;
p1[3 * j + 1] := Min(255, Max(0, Value));
Value := p1[3 * j] - p2[3 * j] + 128;
p1[3 * j] := Min(255, Max(0, Value));
end;
end;
childform.Image1.Picture.Bitmap.Assign(bmp);
bmp.Free;
end;