Logic

Hello Eceryone,

Please help me with some logic here,i am trying to write a rotate driver
which would rotate the desktop in 90 degrees increments.Well,i have being
working with the rotate algorithm of it and have come up with these ideas
but somewhat dont know which would be more easier and logical to
implement.To Explain it with diagrams

This is my destop before rotation

(x,y)-----------(x1,y1)
| |
| |
| |
| |
| |
| |
(x2,y2)---------(x3,y3)

if i rotate it 90 degrees it will become lke this:

(x1,y1)----------(x3,y3)
| |
| |
| |
| |
| |
| |
(x,y)---------(x2,y2)

Now i know that the upper-leftmost pixel of the Desktop is given by the
coordinates (0,0) i.e x,y in the first diagram and (x1,y1) in the second
diagram should be (0,0).

so coming to the question of rotation,should i:

a)using mathematics and use Sin theta and cosine theta and implement
rotation like i would have done with normal bitmaps.

or

b)Since i am writing a Video/Display Driver and have access to the memory
implement rotation by changing the contents of the memory.i.e:if i have to
rotate by 90 degrees ,i change the contents of (x,y) by (x1,y1) and (x1,y1)
by (x3,y3).

I have a feeling that it is possible with the second approach but dont know
if its even possible or not.

Please mail me with ur sugestions and ideas.

Thanks & regards,

Nitin Kapoor