Gabriel is correct. Use LockImage to allow pixel operations on an image. When you're done, use UnlockImage. I think the two commands basically move the image from VRAM into RAM and vice-versa.
If you need to do this sort of thing in real time you may need to think of an alternative way of achieving whatever it is you need to achieve, as this can be relatively slow - especially on large images.
If you need to do this sort of thing in real time you may need to think of an alternative way of achieving whatever it is you need to achieve, as this can be relatively slow - especially on large images.