【图像处理高级编程】-图像 特效

图像 特效

提示:这里可以添加技术概要
请添加图片描述

核心源码

procedure TForm1.N25Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
image1.Picture.Bitmap.LoadFromFile(OpenPictureDialog1.FileName);
OriginalBMP.Assign(image1.Picture.Bitmap);
Image1.Top := self.Height div 2 -
Image1.Picture.Bitmap.Height div 2;
Image1.Left := self.Width div 2 -
Image1.Picture.Bitmap.Width div 2;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
self.Image1.AutoSize := True;
self.Image1.Stretch := True;
InBmp := TBitmap.Create;
OriginalBmp := TBitmap.Create;
end;

procedure TForm1.UpToDownClick(Sender: TObject);
var
newbmp: TBitmap;
i, bmpWidth, bmpHeight: integer;
begin
newbmp := TBitmap.Create;
newbmp.Width := image1.Width;
newbmp.Height := image1.Height;
bmpWidth := image1.Width;
bmpHeight := image1.Height;
for i := 0 to bmpHeight - 1 do
begin
newbmp.canvas.CopyRect(Rect(0, i, bmpwidth, i + 1),
image1.canvas, Rect(0, i, bmpwidth, i + 1));
self.Canvas.draw(image1.Left, image1.Top, newbmp);
sleep(5);
application.ProcessMessages;
end;
newbmp.Free;
end; //实现自上而下卷帘式显示

procedure TForm1.DownToUpClick(Sender: TObject);
var
newbmp: TBitmap;
i, bmpWidth, bmpHeight: integer;
begin
newbmp := TBitmap.Create;
newbmp.Width := image1.Width;
newbmp.Height := image1.Height;
bmpWidth := image1.Width;
bmpHeight := image1.Height;
image1.Visible := false;
for i := 0 to bmpheight - 1 do
begin
newbmp.Canvas.CopyRect(rect(0, bmpheight - 1 - i, bmpWidth, bmpheight -
i),
image1.canvas, rect(0, bmpheight - 1 - i, bmpWidth, bmpheight - i));
self.Canvas.draw(image1.Left, image1.Top, newbmp);
sleep(5);
application.ProcessMessages;
end;
newbmp.Free;
image1.Visible := true;
end; //自下而上卷帘式显示图片

procedure TForm1.LeftToRightClick(Sender: TObject);
var
newbmp: TBitmap;
i, bmpWidth, bmpHeight: integer;
begin
newbmp := TBitmap.Create;
newbmp.Width := image1.Width;
newbmp.Height := image1.Height;
bmpWidth := image1.Width;
bmpHeight := image1.Height;
for i := 0 to bmpWidth - 1 do
begin
newbmp.Canvas.Copyrect(rect(i, 0, i + 1, bmpheight), image1.canvas,
rect(i, 0, i + 1, bmpheight));
self.Canvas.Draw(image1.Left, image1.Top, newbmp);
sleep(2);
application.ProcessMessages;
end;
newbmp.Free;
end; //从左到右卷帘式显示图片

procedure TForm1.RightToLeftClick(Sender: TObject);
var
newbmp: TBitmap;
i, bmpWidth, bmpHeight: integer;
begin
newbmp := TBitmap.Create;
newbmp.Width := image1.Width;
newbmp.Height := image1.Height;
bmpWidth := image1.Width;
bmpHeight := image1.Height;
for i := 0 to bmpWidth - 1 do
begin
newbmp.Canvas.Copyrect(rect(bmpWidth - 1 - i, 0, bmpWidth - i,
bmpheight), image1.canvas,
rect(bmpWidth - 1 - i, 0, bmpWidth - i, bmpheight));
self.Canvas.draw(image1.Left, image1.top, newbmp);
end;
sleep(2);
newbmp.Free;
end; //从右到左卷帘式显示图片

procedure TForm1.FadeInClick(Sender: TObject);
var
newbmp: TBitmap;
x, y, k: integer;
T: pByteArray;
const
step = 250;
begin
newbmp := TBitmap.Create;
newbmp.Width := image1.Width;
newbmp.Height := image1.Height;
newbmp.Assign(image1.Picture.Bitmap);
newbmp.PixelFormat := pf24bit;
for k := 0 to step do
begin
for x := 0 to newbmp.height - 1 do
begin
T := newbmp.ScanLine[x];
for y := 0 to newbmp.Width - 1 do
begin
T[3 * y + 2] := max(0, min(255, T[3 * y + 2] - 1));
T[3 * y + 1] := max(0, min(255, T[3 * y + 1] - 1));
T[3 * y] := max(0, min(255, T[3 * y] - 1));
end;
end;
self.Canvas.draw(image1.left, image1.top, newbmp);
sleep(5);
end;
InBMP.Assign(newbmp);
newbmp.Free;
messagedlg(‘请选择淡出操作!’, mtconfirmation, [mbok], 0);
end;

procedure TForm1.FadeoutClick(Sender: TObject);
var
newbmp, bitmap: TBitmap;
x, y, k: integer;
T, P: pByteArray;
const
step = 250;
begin
newbmp := TBitmap.Create;
bitmap := TBitmap.Create;
bitmap.Width := image1.Width;
bitmap.Height := image1.He

  • 28
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大龙软件研发

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值