rotate a frame buffer

I'm using an Embedded Artists development board for a ARM 9 processor (LPC3250).  The development board includes a simple 320 x 240 screen. I need to rotate everything on the screen 180 degrees.  Contacting the vendor there's no support in their driver for rotating, so it's left up to the user.

During setup of the display, you setup a frame buffer where 2 bytes is used to describe each pixel. The API has basic capability like write a line, box, text, etc.  The provided driver updates the screen by dereferencing the desired pixel address in the frame buffer and setting it equal to a 16 bit color. (this is the lpc swim library if that means much to someone)

*(framebuffer + offset) = pen_color;

Any suggestions on how to rotate the what is being displayed before ever writing it to the frame buffer?

I have plenty of memory and can create a second intermediate frame buffer if needed.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rotating over 180 degrees would mean that you place the pixel color for position (x, y) at (framebuffer + (319 - x) + ((239 - y) * 320)) instead of (framebuffer + x + (y * 320)) for every position (x, y) between (0, 0) and (319, 239).

So, it's just a matter of calculating the offset differently.

The use of an intermediate frame buffer, as you suggest, will greatly help with that.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnSantaFeAuthor Commented:
That was exactly it. Thanks for the pointer.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.