If you use DirectDraw you lock surface with this
Dim dati As Integer(,)
Dim i As Integer
Dim j As Integer
dati = CType(superficie.Lock(LockFlags.Wait), Integer(,))
superficie.Unlock(dati)
where superficie is the surface and dati is an array(,) of integer
the dimensions of the array are the same of the surface. Every value is the color (use Color Class to convert).
With direct3D
Dim pitch As Integer
Dim dest As Byte() = CType(tex1.LockRectangle(GetType(Byte), 0, 0, pitch, dimeTot), Byte())
tex1.UnlockRectangle(0)
dimeTot is height x width x byte of color
with this you can lock surface and texture. Any modifies between lock and unlock ll be save in the image