how do I manipulate the pixel data to, say, change all the white pixels to red?
Of course some pixels might be very close to white but not exactly white, and they won't be changed by this instruction. So you might want to change the condition to something like
if (pixel[i] == 0xffffffff) then pixel[i] = 0xffff0000
if (Math.abs(pixel[i] - 0xffffffff) < aThreshold)
That depends on the portion. You'll need a formula to determine if a certain pixel is in the area. For example if you want to change all the pixels in a circle of radius 10 with it's center in (30,30) to white then you could do:
How about changing the color of a certain portion of the image (not necessarily rectangular in shape)?
if ((x - 30) * (y - 30) < 100) then pixel[x + y * width] = 0xffffffff