Here, I have a code snippet:
function copyPart(fMemblock, tMemblock,fx,fy,fw,fh,tx,ty)
`copies the part of image fmemblock in a box defined by (fx,fy),(fx+fw,fy+fh) and pastes it to image tMemblock starting at tx,ty
for x=0 to fw-1
for y=0 to fh-1
setPixel(tMemblock,tx+x,ty+y,getPixel(fMemblock,fx+x,fy+y))
next y
next x
endfunction
function getPixel(memblock,x,y)
color as dword
color=memblock dword(memblock,memgridnum(x,y,memblock dword(memblock,0),4,12))
endfunction color
function setPixel(memblock,x,y,color as dword)
write memblock dword memblock,memgridnum(x,y,memblock dword(memblock,0),4,12),color
endfunction
function memgridnum(x,y,width,multiplier,base)
n=((y-1)*width+x-1)*multiplier+base
endfunction base
Errm, it's untested. I had copied it for use in c++ code, lost the code in DBPro, and just copied it back over and edited some stuff, but it should work fine as-is.
I've used this method real-time fine.
Here's a video of a map-maker thingy, the ground used this method to change the texture of each tile. Thats a single 400x400 image on the ground.
just tried it now with a 100x100 tile map (20 by 20 pixels per tile), which is a plane being textured by a 2000x2000 image, using this memblock technique (make image from memblock each update), and its working fine! definitely speedy enough.