English 中文(简体)
2007年德尔菲向全国过渡政府提供透明度的“拯救比图”
原标题:Save Bitmap with transparency to PNG in Delphi 2007

我有一份有透明度信息的德尔菲比图(32Bit)。 在保持透明度的同时,我需要将其转换为巴布亚新几内亚的档案。

我目前拥有的工具是图形32图书馆、GE32_PNG(由 Christian布德编辑)和PNGImage(由古斯塔沃德编辑)。

这样做的最佳方式是什么?

EDIT 1: 我的比图中不仅有一色,它具有透明度,而且具有不同程度的透明度,需要加以维护。

EDIT 2:我用甲型六氯环己烷信息绘制了我的比照图,把图像的背景描述给我只剩一个空的甲型六氯环己烷。 然后,我写上反索马里的案文。 然后,我挽救了蓝图。 简而言之,如果开张,就会显示出透明度,而且你一心一意,就会看到反索马里的影响。

最佳回答

我无法得到另外两个工作的答复。 他们可以为其他人工作,但这里是我所做的。

  1. I created the bitmap with transparency.
  2. Assigned it to a TBitmap32 from the Graphics 32 library.
  3. Assigned it to a TPortableNetworkGraphics32 from Christian Budde s GR32_PNG for Graphics32
  4. Called the TPortableNetworkGraphics32.SaveToFile method
问题回答

利用PNGImage。 在德尔菲尝试:

function ConvertToPNG(oBMPSrc: TBitmap; sFilename: String);
var
  oPNGDest: TPNGObject;
begin
  oPNGDest := TPNGObject.Create;
  try
    oPNGDest.Assign(oBMPSrc);
    oPNGDest.SaveToFile(sFilename); 
  finally
    oPNGDest.Free;
  end;
end;

如果你不工作,你可能不得不单独复制甲型六氯环己烷和中型六氯环己烷的价值。

function ConvertToPNG(oBMPSrc: TBitmap; sFilename: String);
var
  oPNGDest: TPNGObject;
begin
  oPNGDest := TPNGObject.CreateBlank(COLOR_RGBALPHA, 8, oBMPSrc.Width, oBMPSrc.Height);
  try
    oPNGDest.CreateAlpha;
    // Copy over RGB
    ..
    // Copy over Alpha
    ..
    // Save to file
    oPNGDest.SaveToFile(sFilename); 
  finally
    oPNGDest.Free;
  end;
end;




相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签