Home > Back-end >  Delphi using pngimage unit load PNG, problem
Delphi using pngimage unit load PNG, problem

Time:10-07

If inscribe delphi7 pngimage when the unit load PNG images, can appear error,
Out of the question, the code directly to

TPngObject. DrawPartialTrans
The

Case Header. BitmapInfo. BmiHeader. BiBitCount of
{R, G, and B images}
24:
FOR j: H=1 TO DO
The begin
{the Process all the pixels in this line}
FOR I:=0 TO DO W - 1
The begin
If Stretch then i2:=trunc (I/FactorX) else i2:=I;
{Optmize the when we don 磘 have transparency}
If (AlphaSource [i2] <> 0) then
If (AlphaSource [i2]=255) then
ImageData: [I]=pRGBQuad (@ ImageSource [i2 * 3]) ^ - jump straight to here,
"The else
With ImageData [I] do
The begin
RgbRed:=(255 + ImageSource AlphaSource [2 + i2 * 3] * [i2] + rgbRed *
8 SHR (not AlphaSource [i2]));
RgbGreen:=(255 + ImageSource AlphaSource [1 + i2 * 3] * [i2] +
RgbGreen * (not AlphaSource [i2])) 8 SHR;
RgbBlue:=(255 + ImageSource AlphaSource [i2 * 3] * [i2] + rgbBlue *
8 SHR (not AlphaSource [i2]));
end;
end;

Then go down after the image cannot be loaded,
To solve the

CodePudding user response:

To load a map is not a PNG?


D7 upgrade to 2010 will bring.

CodePudding user response:

To have pngimage this thing,

CodePudding user response:

reference 1st floor response:
load a map is not a PNG?


D7 to upgrade to the 2010 shipped.


To load all PNG images, I think excuse me this code specific is stem what of,

CodePudding user response:

Using gdiplus?

CodePudding user response:

Don't need to use pngimage, teach you a simple way to achieve the Delphi 7 load PNG transparent images, the need to use Microsoft Visio software,
The first step is to build a visio empty file, insert want PNG images visio, then the file save as, save for Windows map file, WMF format type, or enhanced metafile emf format,
The second part, the WMF directly or emf format images added to the image, the image of the Delphi 7 is to support the WMF and emf format files, and can realize transparent, according to

CodePudding user response:

The fifth floor of the way is really practical, useful

CodePudding user response:

Have been using PNG, found no problem,
Can use photoshop to turn, to regenerate the PNG

Fifth floor under method I tried, can use, but two shortcomings:
1, into the emf, much larger
2. Generated sawtooth, did not have the alpha

CodePudding user response:

The fifth floor of the methods were strong, thank you

CodePudding user response:

Can use the white background of BMP graph, the form. The transparentColor is set to True, transparentColorvalue set as ClWihite can achieve the same effect,

CodePudding user response:

The
reference
loading a map is not a PNG?


D7 to upgrade to the 2010 shipped.


Delphi 2007 will bring the

CodePudding user response:

There are many kinds of formats, PNG TPNGIMAGE according to color depth, not transparent, is there any Alpha channel decided to use which function to map,
You said this function is used to plot with the Alpha channel, didn't met you said problems in actual application, you check whether to use the latest version,

CodePudding user response:

We use PNG general for watermarking, sometimes go wrong