首页  编辑  

浮雕效果

Tags: /超级猛料/Picture.图形图像编程/图形处理算法/   Date Created:

Author: David Reinig

procedure Emboss(ABitmap : TBitmap; AMount : Integer);

var

 x, y, i : integer;

 p1, p2: PByteArray;

begin

 for i := 0 to AMount do

 begin

   for y := 0 to ABitmap.Height-2 do

   begin

     p1 := ABitmap.ScanLine[y];

     p2 := ABitmap.ScanLine[y+1];

     for x := 0 to ABitmap.Width do

     begin

       p1[x*3] := (p1[x*3]+(p2[(x+3)*3] xor $FF)) shr 1;

       p1[x*3+1] := (p1[x*3+1]+(p2[(x+3)*3+1] xor $FF)) shr 1;

       p1[x*3+2] := (p1[x*3+1]+(p2[(x+3)*3+1] xor $FF)) shr 1;

     end;

   end;

 end;

end;