首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PngComponents:将32 bmp bmp转换为png

PngComponents:将32 bmp bmp转换为png
EN

Stack Overflow用户
提问于 2013-06-19 14:53:32
回答 1查看 757关注 0票数 3

此代码在PngImage组件上工作(来自G.Daud)。现在,在将PngImage替换为PngComponents for D7 (http://code.google.com/p/cubicexplorer/downloads/list)之后,它不再编译。

代码语言:javascript
复制
function Bmp32ToPng(bmp: TBitmap): TPngObject;
var
  x, y: integer;
  src, dst: PngImage.pByteArray;
begin
  Result:= nil;
  if bmp.PixelFormat<>pf32bit then
    Exit;

  Result:= TPngObject.CreateBlank(COLOR_RGBALPHA, 8, bmp.Width, bmp.Height);
  Result.Canvas.Draw(0, 0, bmp);
  for y:= 0 to bmp.Height-1 do begin
    src:= bmp.ScanLine[y];
    dst:= Result.AlphaScanLine[y];
    for x:= 0 to bmp.Width-1 do
      dst[x]:= src[x*4+3];
  end;
end;

PngComponents.中不存在Createblank方法不能用简单的Create替换它,然后设置Width/heightPngComponents.中的Width/height是R/O

如何将32 BMP (例如从32bpp 32.dll获得)转换为PNG?

EN

回答 1

Stack Overflow用户

发布于 2015-01-19 04:06:49

GraphicEx和PngComponents以及pngimage是相互冲突的。要解决这个问题:

( 1)始终将它们按特定的顺序放在uses子句中- GraphicEx或PngComponents,last。

2)建设工程。仅在uses子句更改后运行(或编译)项目是不够的。

与PNGcomponent包一起安装的pngimage,但是这个版本已经过时了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17194505

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档