Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Rotate a Memblock?!

Author
Message
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 13th Jun 2017 03:02
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!

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 13th Jun 2017 04:09
I used an agk logo so you'll need to download the attached image (or use any image and change the name in the code).

Essentially i go row by row across the source image and place the pixels column by column down (from the right edge) of the target image.

Hope that helps

Attachments

Login to view attachments
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 13th Jun 2017 13:04
blink0k,

THANKS!

I was able to adapt your example to fit my code.

I was reading/writing bytes, and trying to calculate offsets in a different way.

Your method is much simpler, and works great.

THANKS!

Bob

Login to post a reply

Server time is: 2024-11-24 14:46:09
Your offset time is: 2024-11-24 14:46:09