Hi, I'm back again with another question...
I am working on image manipulation with memblocks, and i can't seem to figure out how to rotate a memblock.
so lets say i have a 400x300 image, and i want to rotate it clockwise. It then becomes a 300x400 image, and what started as the top left is now the top right.
How can i set up my x,y loop to transfer the data from the old memblock (400x300) into a new memblock (300x400), and ensure that everything goes in the right place?
Code help please!
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "draw" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
`SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
global wid
global hit
wid=300
hit=200
CreateMemblock(1,16+((wid+1)*(hit+1)*4))
SetMemblockInt(1,0,wid)
SetMemblockInt(1,4,hit)
SetMemblockInt(1,8,32)
p=12
for y=1 to hit
for x=1 to wid
r=x
if r>255 then r=255
b=y
if b>255 then b=255
R=255
B=255
SetMemblockByte(1,p,r)
inc p
SetMemblockByte(1,p,255)
inc p
SetMemblockByte(1,p,b)
inc p
SetMemblockByte(1,p,255)
inc p
next x
next y
CreateImageFromMemblock(1,1)
CreateSprite(1,1)
SETSPRITEPOSITION(1,512-wid/2,384-hit/2)
` now, i would like to rotate that image clockwise using its memblock data.
` ???