Results 1 to 20 of 21

Thread: QImage Rotation and Translation & Invert Specific Colors

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2013
    Posts
    46
    Thanks
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Question QImage Rotation and Translation & Invert Specific Colors

    Good Day,

    Part 1 of 2

    Im superimposing 2 images(Overlaying images, with the 2nd image having a 50% opacity)

    Now I have a rotation angle, a Row Offset & Column Offset Value.

    When I rotate the 2nd image... it works
    When a call the TRANSLATE function nothing happens!

    Overlay Images Function:
    Qt Code:
    1. primaryImage.load(imageFileName1);
    2.  
    3. secondaryImage.load(imageFileName2);
    4. secondaryImage.invertPixels(); //Inverting Grayscale Image
    5.  
    6. QTransform rotating;
    7. rotating.rotate(RotationAngle);
    8. secondaryImage = secondaryImage.transformed(rotating); // Works
    9. QTransform translating;
    10. translating.translate(RowOffset, ColOffset);
    11. secondaryImage = secondaryImage.transformed(translating); // Does not work
    12.  
    13. paintScreen = true;
    14. update();
    To copy to clipboard, switch view to plain text mode 


    this is what I got:
    Qt Code:
    1. //Paint Function
    2. if(paintScreen = true){
    3.  
    4. //Repaint Primary Image
    5. painter.drawImage(QPoint(0, 0), primaryImage);
    6. painter.setOpacity(0.5);// drawn at n% opacity
    7. painter.drawImage(QPoint(0, 0), secondaryImage); }
    To copy to clipboard, switch view to plain text mode 

    Ideas Please
    Solutions welcome


    Part 2 of 2

    Also Instead of inverting colors of 2nd image(grayscale)
    Is there a way to convert the whole image into like a "Red Scale" or any other color of different shades

    Solution
    Kind Regards
    Last edited by 2lights; 14th August 2013 at 09:22. Reason: updated contents

Similar Threads

  1. Replies: 0
    Last Post: 23rd July 2013, 13:19
  2. Graph rotation
    By jomarin in forum Qwt
    Replies: 2
    Last Post: 16th August 2010, 09:21
  3. Ellipse and rotation
    By navi1084 in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2009, 10:43
  4. Rotation on Qframe
    By Pharell in forum Qt Programming
    Replies: 11
    Last Post: 2nd April 2008, 16:31
  5. Replies: 3
    Last Post: 15th March 2006, 11:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.