Results 1 to 5 of 5

Thread: Vertically flipped QImage.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,330
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Vertically flipped QImage.

    The "for loop" for height takes in from "0" till the limit(height) and I can assume that the picture it reads in the limit, till "0".
    But everything seems to be in placed and correct. I'm lost to what I can do to correct this "wrong".
    QImage (and all other Qt objects with pixel-based coordinates) assign pixel (0, 0) to the upper left corner. Your map server apparently assumes that the (0, 0) map coordinate is in the lower left corner. This would make sense for a geographical map.

    You can fix this by assigning your scan lines from the top down:

    Qt Code:
    1. memcpy( mapImage->scanLine( height - i - 1 ), lineImage, width * 3 );
    To copy to clipboard, switch view to plain text mode 


    ------------------
    If the original designers of the oscilloscope (and its descendent, the television) had designed it to draw the scan lines from the bottom up, instead of from the top down, we wouldn't have this (0,0) at the top left corner problem. (0,0) would be at the bottom right where it makes sense, and we wouldn't be faced with having to flip y coordinates for everything we draw. It wouldn't have been hard - all they would have had to do is change the polarity on the CRT deflection plates. See how decisions made nearly a century ago still haunt us?
    Last edited by d_stranz; 8th August 2014 at 16:28.

  2. The following user says thank you to d_stranz for this useful post:

    xtrememoo (11th August 2014)

Similar Threads

  1. QCamera images flipped on Windows platform
    By jas67 in forum Qt Programming
    Replies: 4
    Last Post: 22nd March 2013, 12:21
  2. QScrollArea that only scrolls vertically
    By stephelton in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2013, 11:48
  3. Align vertically QwtPlot
    By Valsylver in forum Qwt
    Replies: 1
    Last Post: 4th August 2012, 12:44
  4. Rezizing the Qlabels vertically
    By anju123 in forum Qt Programming
    Replies: 3
    Last Post: 3rd January 2008, 15:35
  5. How can I write vertically in a QPushbutton ?
    By castorvert in forum Qt Programming
    Replies: 1
    Last Post: 2nd April 2006, 21:27

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.