Delphi XE7 的 Android Bitmap转JPG图的参数问题


本文整理自网络,侵删。

 
TBitmapCodecManager.SaveToStream的最后一个参数为 PBitmapCodecSaveParams,但是在使用时,如果定义

parms:PBitmapCodecSaveParams;

设置

parms.Quality := 10; 则Android程序闪退,所以改用该指针的指向,

parms:TBitmapCodecSaveParams,运行正常。



procedure TForm5.BitmapToJPEG(input_bp: TBitmap; output_fn: string);

var

  Surf: TBitmapSurface;

  Stream: TMemoryStream;

  parms:TBitmapCodecSaveParams; 

begin

  Surf := TBitmapSurface.Create;

  Surf.Assign(input_bp);

  Stream := TMemoryStream.Create;

  try

    parms.Quality:=10;

    TBitmapCodecManager.SaveToStream(Stream, Surf, '.jpg', @parms);

    Stream.SaveToFile(ExpandFileName(output_fn));

  finally

    Stream.Free;

    Surf.Free;

  end;

end;

相关阅读 >>

Delphi tchart 的使用

Delphi的idhttp报508 loop detected错误的原因

Delphi xe2 将域名转ip

Delphi 获取文件大小方法

Delphi中操作olevariant、variant和stream

Delphi程序禁止结束进程

Delphi net.httpclient用最精简的代码获取网页数据

Delphi 横竖屏代码控制

Delphi windows 编程[16] - 添加与删除菜单项:getmenu、appendmenu、deletemenu、drawmenubar

Delphi isleapyear、isinleapyear - 是否是闰年

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



打赏

取消

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

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

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

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

评论

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