... type Tbgra = record b,g,r,a:byte; end; var temp:array of array of tbgra; x:integer; begin // round(k*setedbrush.w) = 150, round(setedbrush.h*k)=150 setlength(temp, round(k*setedbrush.w)+1); for x:=1 to round(k*setedbrush.w) do setlength(temp, round(setedbrush.h*k)+1); temp[1,1].r:=6; //Access violation at adress... ... 

By the way, there are a lot of variables in the procedure from which this section of the code (including arrays). Maybe because of this?

    1 answer 1

    You made a gross newcomer mistake here:

     for x:=1 to round(k*setedbrush.w) do setlength(temp, round(setedbrush.h*k)+1); 

    It turns out that you recreate one and the same "temp" array, but you need to specify its index (so that you create its second dimension in the loop, and not its a hundred times).

    It is necessary so:

      ... type Tbgra = record b,g,r,a:byte; end; var temp:array of array of tbgra; x:integer; begin // round(k*setedbrush.w) = 150, round(setedbrush.h*k)=150 setlength(temp, round(k*setedbrush.w)+1); for x:=1 to round(k*setedbrush.w) do setlength(temp[x], round(setedbrush.h*k)+1); temp[1,1].r:=6; 
    • I reproached a million times, but I did not notice such a fig. How am I now ashamed)). Probably in the evening the brain stopped thinking) ... - ololo
    • Yes, it happens at all, believe =) - AseN