I wanted to try your code but recieved an error on pRGBTripleArray.
Does it require D7? I've tried it using D5.