Forum > Graphics

Can't display a PNG image

(1/1)

Neuromancer:
Hi,

I'm trying to display PNG images using a TImage component (tiles for a pseudo-3D isometric map). Only one image (ocean.png) is displayed. I don't understand why.


--- Code: ---Ocean := TPNGImage.Create;
Ocean.LoadFromFile(CurrentDir + '/images/ocean.png');
Grass := TPNGImage.Create;
Grass.LoadFromFile(CurrentDir + '/images/grass.png');
Mountains := TPNGImage.Create;
Mountains.LoadFromFile(CurrentDir + '/images/mountains.png');
Desert := TPNGImage.Create;
Desert.LoadFromFile(CurrentDir + '/images/desert.png');
 
imgMap.Canvas.Draw(i, j, Ocean);
imgMap.Canvas.Draw(i, j, Grass); // Ne s'affiche pas
imgMap.Canvas.Draw(i, j, Mountains); // Ne s'affiche pas
--- End code ---

theo:
The images have different formats.
ocean is 32bit Alpha RGB
mountains etc are 8bit Palette.

Either convert them all to 32bit Alpha RGB or upgrade
to an fpc version later than 2.4.0 (and probably upgraded Lazarus too) or use OpBitmap to load them.

Navigation

[0] Message Index

Go to full version