FireMonkey (FMX) code not compiling for Linux, works well on Win64

  

I want to extract pixel color values from a bitmap into a 2-dimensional array of floating point values for later post processing.

This code works fine for me on Win64, but I can’t compile this code now for Linux using the FMX framework.

type
TMyFunction = array of array of Real;

var
X, Y: Integer;
CurrentData : TBitmapData;
Color: TAlphaColor;
afct : TMyFunction;
abmp : TBitmap;

if (abmp.Map(TMapAccess.Read, CurrentData)) then
begin
try
for X := 0 to abmp.Width – 1 do
for Y := 0 to abmp.Height – 1 do
begin
Color := CurrentData.GetPixel(X, Y);
afct[X, Y] := TColorRec.ColorToRGB(Color).ToSingle;
end;
finally
abmp.Unmap(CurrentData);
end;
end;

The error message goes like this:

[DCC Error] numeric.pas(444): E2018 Record, object or class type required

I can’t change the TMyFunction as used in many places in my project.

Why does the assignment / .ToSingle require something different between Windows and Linux?

Comments are closed.