孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

procedure Effect_Emboss(Picture:TBitmap);

var

BB1,BB2:TBitmap;

begin

BB1:=TBitmap.Create;

BB1.PixelFormat :=pf24bit;

BB1.Assign(Picture.Bitmap);

BB2:=TBitmap.Create;

BB2.PixelFormat:=pf24bit;

BB2.Assign(BB1);

Emboss(BB2);

Picture.Bitmap.Assigned(BB2);

BB1.Free;

BB2.Free;

end;

procedure Emboss(var Bmp:TBitmap);

var

x,y:integer;

p1,p2:PByteArray;

begin

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

begin

p1:=bmp.Scanline[y];

p2:=bmp.Scanline[y+1];

for x:=0 to Bmp.Width-4 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+2]+(p2[(x+3)*3+2] xor $FF)) shr 1;

end;

end;

end;

posted on 2008-09-10 21:48  孤独的猫  阅读(180)  评论(0编辑  收藏  举报