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 xe6 android 查看电池信息

Delphi idhttp中设置非标准头信息和读写cookie

Delphi将n个相同字符提取到左边,m个相同字符提取到右边

Delphi开发的服务中调用指定应用程序

Delphi中setlength使用

Delphi leftstr 返回字符串左边指定个数的新字符(串)

Delphi正则表达式匹配中文

Delphi xe6 在两个图片切换的时候实现翻书效果

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



打赏

取消

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

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

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

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

评论

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