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 使用tmemorystream保存多张图片到文件,并读取

Delphi 任务管理器 获取窗口标题 获取窗口图标

Delphi tadocommand 中文使用说明

Delphi 三个消息函数的威力

Delphi android路径 tpath 文件路径,文件管理

Delphi调用外部程序并等待其运行结束

Delphi edit只能输入数字或小数点

Delphi char数组、string和pchar的相互转换

Delphi tms web core messagedlg对话框 yes no

ttreeview的两个事件ondragdrop、ondragover 实现自动拖放功能

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



打赏

取消

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

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

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

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

评论

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