delphi 简单的旋转图像角度代码


本文整理自网络,侵删。

 

uses Vcl.Imaging.jpeg;


procedure Rotate90(Source: TGraphic; Target: TJpegImage);

var
SourceBmp, TargetBmp: TBitmap;
r, c: Integer;
x, y: Integer;
begin
SourceBmp := TBitmap.Create;
SourceBmp.Assign(Source);
TargetBmp := TBitmap.Create;
TargetBmp.Width := SourceBmp.Height;
TargetBmp.Height := SourceBmp.Width;
for r := 0 to SourceBmp.Height - 1 do
begin
for c := 0 to SourceBmp.Width - 1 do
begin
//x := (SourceBmp.Height-1) - r; // -90
//y := c; //-90
x := r; //90
y := (SourceBmp.Width-1) - c; //90
// look into Bitmap.ScanLine for faster pixel access
TargetBmp.Canvas.Pixels[x, y] := SourceBmp.Canvas.Pixels[c, r];
end;
end;
Target.Assign(TargetBmp);
SourceBmp.Free;
TargetBmp.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Jpeg: TJPEGImage;
begin
Jpeg := TJPEGImage.Create;
Rotate90(Image1.Picture.Graphic, Jpeg);
Image1.Picture.Assign(Jpeg);
Jpeg.Free;
end;

相关阅读 >>

Delphi twebbrowser get html source after ajax load

Delphi services允许跨域访问

Delphi firedac 下的 sqlite [11] - 关于批量提交 sql 命令的测试

Delphi字符串拆分(字符数限制)

Delphi xe7实现获取程序是否已管理员模式运行以及运行的windows用户名

Delphi tstringlist的用法

Delphi 获取网络文件大小

Delphi创建证书密钥库文件

Delphi 限制窗体大小的最大值与最小值

Delphi控件adsl拨号和断开

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



打赏

取消

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

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

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

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

评论

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

    正在狠努力加载,请稍候...