program ideone;

uses SysUtils;

//const YSize=1080;
//const XSize=1920;
const YSize=3;
const XSize=4;
type TTestRecord=record Y,X,Idx:Integer; end;
type RGBTriple=record R,G,B:Byte; end;
type TTestTable=array[0..3] of TTestRecord;
type TBitMask=array[0..YSize-1,0..XSize-1] of RGBTriple;
type PBitMask=^TBitMask;
type TBits=array[0..YSize*XSize-1] of RGBTriple;
type PBits=^TBits;
function XY2Idx(X,Y:Integer):Integer; begin XY2Idx:=Y*XSize+X; end;

procedure test(const Bits:TBits;const BitMask:TBitMask);
var R:TTestRecord;
var Y,X,Idx:Integer;
begin
  for Y:=0 to YSize-1 do
  begin
    for X:=0 to XSize-1 do
    begin
      Idx:=XY2Idx(X,Y);
      WriteLn('Y:=',Y,'; X:=',X,'; Idx:=',Idx,' ',Int64(@Bits[Idx]),' - ',Int64(@BitMask[Y,X]));
    end;
  end;
end;

procedure go1;
var Bits:PBits;
var BitMask:TBitMask;
begin
  Bits:=@BitMask[0,0];
  test(Bits^,BitMask);
end;

procedure go2;
var Bits:TBits;
var BitMask:PBitMask;
begin
  BitMask:=@Bits[0];
  test(Bits,BitMask^);
end;

procedure go0;
var Bits:TBits;
var BitMask:TBitMask;
begin
  WriteLn(SizeOf(Bits),' => ',SizeOf(BitMask));
end;

begin
  go0;
  WriteLn;
  go1;
  WriteLn;
  go2;
end.