Hi again,
I'm working in a goverment corporation in gis (formerly a part of the Land Survey of Sweden) and have written an object-code that is handling a custom format for maps. Want to be able to use this in android app as part in a system for customers. The custom format is built up from small z-lib compressed map-blocks and a 256 color palette. I use TBGRABitmap to fill scanline data like in the code below:
row := 0;
while row < FInfo.BlockSizeNorth do
begin
if FInfo.ZLibPackad then
p := BGRABitmap.ScanLine[(row - StartRow + 1) * FInfo.BlockSizeNorth - 1 - row]
else
p := BGRABitmap.ScanLine[row * FInfo.BlockSizeNorth + row];
p := p + (col - StartCol) * FInfo.BlockSizeEast;
col := 0;
while kol < FInfo.BlockSizeEast do
begin
index := FBlockData[col + row * FInfo.BlockSizeNorth];
try
p^.red:=FInfo.Palette[index].Red;
p^.green:=FInfo.Palette[index].Green;
p^.blue:=FInfo.Palette[index].Blue;
p^.alpha:=255;
except
on E:Exception do
MessageDlg(E.Message, mtError, [mbOK], 0);
end;
Inc(p);
Inc(col);
end;
Inc(row);
end;
BGRABitmap.InvalidateBitmap;
To display in a TImage on android screen I use:
lazImage.SetSize(BGRABitmap.Width,BGRABitmap.Height);
lazImage.Assign(BGRABitmap);
Image1.Picture.Bitmap.LoadFromIntfImage(lazImage);
Could this be still optimized?
Could one in some way skip the step with lazImage?
/stab