The FMX.Types.TBitmap
class has the ScanLine
property in FMX (FireMonkey), but it seems this property was removed, and is missing in FMX2 (FireMonkey FM2).
Is there any workaround ? How do we supposed to access TBitmap
content directly in FMX2 ?
For direct access you are expect to use the Map
method. The documentation includes a number of examples, such as FMX.AlphaColorToScanline:
function TForm1.TestAlphaColorToScanline(ABitmap: TBitmap;
start, count: integer): TBitmap;
var
bitdata1, bitdata2: TBitmapData;
begin
Result := TBitmap.Create(Round(ABitmap.Width), Round(count));
if (ABitmap.Map(TMapAccess.maRead, bitdata1) and
Result.Map(TMapAccess.maWrite, bitdata2)) then
begin
try
AlphaColorToScanline(@PAlphaColorArray(bitdata1.Data)
[start * (bitdata1.Pitch div GetPixelFormatBytes(ABitmap.PixelFormat))],
bitdata2.Data, Round(Result.Height * Result.Width),
ABitmap.PixelFormat);
finally
ABitmap.Unmap(bitdata1);
Result.Unmap(bitdata2);
end;
end;
end;