InfoHasAlpha example for Delphi
var
RasterIO: LEADRasterIO;
RasterProc: LEADRasterProcess;
begin
RasterIO:= CreateComObject (CLASS_LEADRasterIO) as LEADRasterIO;
RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;
RasterIO.Load (LEADRasterView1.Raster, 'v:\images\1.jpg', 24, 1, 1); //load a 24-bit image
LEADRasterView2.Raster.Bitmap := LEADRasterView1.Raster.Bitmap;
RasterProc.ColorRes (LEADRasterView1.Raster, 8, 0, 0, 0); //just make it 8-bit
//now set an alpha channel
LEADRasterView1.Raster.BitmapAlpha := LEADRasterView2.Raster.Bitmap;
//save and free
RasterIO.Save (LEADRasterView1.Raster, 'c:\temp\32.png', FILE_PNG, 32, 0, 0);
LEADRasterView1.Raster.Bitmap := 0;
LEADRasterView2.Raster.Bitmap := 0;
ShowMessage('Pause');
//re-load
RasterIO.GetFileInfo (LEADRasterView1.Raster, 'c:\temp\32.png', 0, 0);
if (RasterIO.InfoHasAlpha <> False) then
RasterIO.Load (LEADRasterView1.Raster, 'c:\temp\32.png', 0, 1, 1);
LEADRasterView2.Raster.Bitmap := LEADRasterView1.Raster.BitmapAlpha;
end;