Hi, I have this code which I think _should_ work (obviously) but it doesn't.
It does work if I dont set the buffer to ImageBuffer() and just draw the mainImage to the screen and then grab it. But I don't want to do that. I want to do it "behind the scenes" as it were. Looking at the documentation I should be able to set the current buffer to ImageBuffer(mainImage) and then use GrabImage(boardImage,x,y,framindex)
I'll post the code as it's not long.
It does work if I dont set the buffer to ImageBuffer() and just draw the mainImage to the screen and then grab it. But I don't want to do that. I want to do it "behind the scenes" as it were. Looking at the documentation I should be able to set the current buffer to ImageBuffer(mainImage) and then use GrabImage(boardImage,x,y,framindex)
I'll post the code as it's not long.
Const ROWS =4 Const COLS =4 Graphics 800,600,32,2 Dim board(ROWS,COLS) ;test.jpg is actually 800x600 mainImage=LoadImage("test.jpg") ResizeImage mainImage,640,480 boardImage = CreateImage (160,120,ROWS*COLS) ;set the current buffer to the image I want to grab frames from SetBuffer=ImageBuffer(mainImage) For row=0 To ROWS-1 For col= 0 To COLS-1 idx=4*row + col ;grab a portion of the mainImage into a frame of boardImage GrabImage (boardImage,row*160,col*120,idx) Next Next ;just use the front buffer as a test Text 0,500,"Press A Key" WaitKey Cls SetBuffer FrontBuffer() Text 0,500,"Press A Key" WaitKey ;recompile the mainImage using the grabbed frames in boardImage For row=0 To ROWS-1 For col= 0 To COLS-1 idx=4*row+col DrawImage boardImage,row*160,col*120,idx Next Next WaitKey