rotate bmp (Xlib)

Discussion in 'C Programming' started by Dariusz.Donimirski@gmail.com, Jan 17, 2008.

  1. Guest

    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, 2008
    #1
    1. Advertising

  2. Ben Pfaff Guest

    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,0xa67f6aaa,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;}}}
     
    Ben Pfaff, Jan 17, 2008
    #2
    1. Advertising

  3. <> wrote 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
     
    Malcolm McLean, Jan 17, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harry Simpson

    32 dpp BMP to 24dpp BMP??

    Harry Simpson, Oct 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    380
    Harry Simpson
    Oct 30, 2003
  2. Ferry Boender
    Replies:
    0
    Views:
    468
    Ferry Boender
    Dec 13, 2005
  3. RC
    Replies:
    1
    Views:
    944
    Bjoern Hoehrmann
    Aug 3, 2006
  4. IanJSparks
    Replies:
    0
    Views:
    1,224
    IanJSparks
    Jan 10, 2008
  5. Axis Sivitz
    Replies:
    2
    Views:
    208
Loading...

Share This Page