Advertisement Jump to content
Sign in to follow this  
saman_artorious

rotate a bitmap image

This topic is 1873 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I do not know how to rotate bitmap BGR image of size 800 * 600 * 3 by 90 degrees. If it was an image with a header, the solution would be:

    QImage srcImg(":/icon.png");
    QPoint center = srcImg.rect().center();
    QMatrix matrix;
    matrix.translate(center.x(), center.y());
    matrix.rotate(90);
    QImage dstImg = srcImge.transformed(matrix);
    QPixmap dstPix = QPixmap::fromImage(dstImg);

I read the whole image in a 800 * 600 * 3 image. Next, before I render it to the screen, I need to rotate it by 90 degrees.

Share this post


Link to post
Share on other sites
Advertisement

If you want to physically rotate the image, then load the image, swap the dimensions in the header, and output the pixels column-by-column instead of row-by-row.

If you just want to render it rotated, use a rotation world matrix.

 

 

L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!