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