Couldn't you create a buffer that mapped over the array (using the Absolute directive), then initialise that in code?
From Delphi Help:-
Absolute Addresses
You can create a new variable that resides at the same address as another variable. To do so, put the directive absolute after the type name in the declaration of the new variable, followed by the name of an existing (previously declared) variable. For example,
var
Str: string[32];
StrLen: Byte absolute Str;
specifies that the variable StrLen should start at the same address as Str. Since the first byte of a short string contains the string's length, the value of StrLen is the length of Str.
You cannot initialize a variable in an absolute declaration or combine absolute with any other directives.
TFilter3D = array [1..3,1..3] of Real; TFilter4D = array [1..4,1..4] of Real; TFilter5D = array [1..5,1..5] of Real; TFilter6D = array [1..6,1..6] of Real; TFilter7D = array [1..7,1..7] of Real;const SampleFiler : TFilter3D = (( 0 , 0.2 , 0 ) , ( 0.2, 0.2, 0.2 ) , ( 0 , 0.2 , 0 ));// copy static array to dyn. array dim =6procedure LoadDynArrayFromStaticArray ( aFilter : TImageFilterReal; Dim : Integer; aStaticArray : TFilter6D ); overload;var i,j : Integer;begin setlength(AFilter, dim,dim); for i := 0 to dim -1 do for j := 0 to dim-1 do aFilter[i,j] := aStaticArray[i+1,j+1];end;// copy static array to dyn. array dim =5procedure LoadDynArrayFromStaticArray ( aFilter : TImageFilterReal; Dim : Integer; aStaticArray : TFilter5D ); overload;var i,j : Integer;begin setlength(AFilter, dim,dim); for i := 0 to dim -1 do for j := 0 to dim-1 do aFilter[i,j] := aStaticArray[i+1,j+1];end;// copy static array to dyn. array dim =4procedure LoadDynArrayFromStaticArray ( aFilter : TImageFilterReal; Dim : Integer; aStaticArray : TFilter4D ); overload;var i,j : Integer;begin setlength(AFilter, dim,dim); for i := 0 to dim -1 do for j := 0 to dim-1 do aFilter[i,j] := aStaticArray[i+1,j+1];end;// copy static array to dyn. array dim =3procedure LoadDynArrayFromStaticArray ( aFilter : TImageFilterReal; Dim : Integer; aStaticArray : TFilter3D ); overload;var i,j : Integer;begin setlength(AFilter, dim,dim); for i := 0 to dim -1 do for j := 0 to dim-1 do aFilter[i,j] := aStaticArray[i+1,j+1];end;procedure LoadImageFilterByIndex( aFilterNameIndex : integer; var aFilter : TImageFilterReal);var i ,j : Integer;begin case aFilterNameIndex of 0: LoadDynArrayFromStaticArray ( aFilter, 3 , BasicBlur ); 1: begin end; 2: begin end; 3: begin end; else end;end;
may be Delphi does not offer any more compact solution
0
Featured Post
Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.
Introduction
The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Linear search (searching each index in an array one by one) works almost everywhere but it is not optimal in many cases. Let's assume, we have a book which has 42949672960 pages. We also have a table of contents. Now we want to read the content on p…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.
https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt
https://filedb.experts-exchange.com/incoming/201…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…