470,572 Members | 2,601 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,572 developers. It's quick & easy.

rotate bmp (Xlib)

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
Jan 17 '08 #1
2 3062
Da****************@gmail.com writes:
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.
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}
Jan 17 '08 #2
<Da****************@gmail.comwrote in
>
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.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm
Jan 17 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Artificial Life | last post: by
3 posts views Thread by byrd48 | last post: by
reply views Thread by Ferry Boender | last post: by
17 posts views Thread by santel_helvis | last post: by
8 posts views Thread by lovecreatesbeauty | last post: by
8 posts views Thread by Samuel Shulman | last post: by
10 posts views Thread by Joey_Stacks | last post: by
reply views Thread by jubi | last post: by
1 post views Thread by giovanni.iovino | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.