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 百万次重复调用字符分割函数,不耗内存用法

Delphi 限制文本框中只接受数字

Delphi 反转字符串方法2

Delphi中datetimepicker控件同时输入日期和时间

Delphi 回车 选择下一个控件

Delphi 利用csidl打开特殊文件夹

Delphi 如何检测你的电脑日期或时间的变化

Delphixe win7、mssql2000、udl

Delphi memo1 字符串快速查找定位

Delphi 获取系统进程列表和进程所在路径

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



打赏

取消

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

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

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

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

评论

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