This code is intended to be used with an image manipulation library that I'm working on, and the goal is to take the raw byte[] data from an image, and transform it into a 2D array where each position on the array has a value corresponding to the pixel coordinates of the image.
Comments concerning how to do this faster or more aligned with F# standards, or concerning style and formatting, are very much appreciated. I'm still learning F# so I need all the help I can get.
let Transform2D (pArrayWidth:int) (pArray:byte[]) =
let tHeight = pArray.Length / pArrayWidth
let tImageArray = Array.zeroCreate<byte[]> tHeight
let mutable tStart = 0
let mutable tFinish = tStart + pArrayWidth - 1 // 0 indexed array
for tRowIndex in [ 0 .. tHeight ] do
tImageArray.[tRowIndex] <- pArray.[tStart .. tFinish]
tStart <- tStart + pArrayWidth
tFinish <- tFinish + pArrayWidth
tImageArray