rotate bmp (Xlib)

D

Dariusz.Donimirski

I must rotate bmp using Xlib without change bmp's memory. If someone
knows how I can do this, please help me.


dariusz
sorry about my english, I'm still learning
 
B

Ben Pfaff

I must rotate bmp using Xlib without change bmp's memory. If someone
knows how I can do this, please help me.

Perhaps you should ask about this in a newsgroup related to Xlib.
You are more likely to get correct responses if you ask there.
 
M

Malcolm McLean

I must rotate bmp using Xlib without change bmp's memory. If someone
knows how I can do this, please help me.
Load the bmp into memory.
I recently posted functions to do this.

Then apply the formula

ax = x - centralx;
ay = y - centraly;

(assuming you wnat to rotate about the centre)

theta is the angle to rotate by

bx = ax * cos(theta) - ay * sin(theta);
by = ax * sin(theta) + ay * cos(theta);

x = bx + centralx;
y = by + centraly;

Work from destination to source, or you will get missing pixel in the
destination image.
(For a very high quality rotate you need to do anti-alising as well).

Then you simply use Xlib to display the new image you have constructed. I'm
pretty sure it has no built-in rotate functions itself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top