delphi 图像翻转


本文整理自网络,侵删。

 代码:

//旋转90度

procedure Rotate90(const Bitmap: TBitmap);
var
i, j: Integer;
rowIn, rowOut: pRGBTriple;
Bmp: TBitmap;
Width, Height: Integer;
begin
Bmp := TBitmap.Create;
Bmp.Width := Bitmap.Height;
Bmp.Height := Bitmap.Width;
Bmp.PixelFormat := pf24bit;

Width := Bitmap.Width - 1;
Height := Bitmap.Height - 1;

for j := 0 to Height do
begin
rowIn := Bitmap.ScanLine[j];

for i := 0 to Width do
begin
rowOut := Bmp.ScanLine[i];

Inc(rowOut, Height - j);

rowOut^ := rowIn^;

Inc(rowIn);
end;
end;

Bitmap.Assign(Bmp);
end;


//旋转180度

procedure Rotate180(const Bitmap:TBitmap);

var

i,j:Integer;

rowIn,rowOut:pRGBTriple;

Bmp:TBitmap;

Width,Height:Integer;

begin

Bmp:=TBitmap.Create;

Bmp.Width := Bitmap.Width;

Bmp.Height := Bitmap.Height;

Bmp.PixelFormat := pf24bit;

Width:=Bitmap.Width-1;

Height:=Bitmap.Height-1;

for j := 0 to Height do

begin

rowIn := Bitmap.ScanLine[j];

for i := 0 to Width do

begin

rowOut := Bmp.ScanLine[Height - j];

Inc(rowOut,Width - i);

rowOut^ := rowIn^;

Inc(rowIn);

end;

end;

Bitmap.Assign(Bmp);

end;

相关阅读 >>

Delphi 简单方法搜索定位treeview项

Delphi 用firedac处理sqlite的日期型

Delphi 释放res资源文件

Delphi的常用条件编译指令

Delphi字符串加密解密

Delphi 屏幕整体拉出源代码

Delphi 读文件到十六进制的函数(Delphi 7 下可用)

Delphi 提取字符串左侧内容

Delphi eof 判断文件指针是否移动到了文件未尾

Delphi api �c multibytetowidechar的用法

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...