Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Image Quadrant Flipping in QT 5.0 running on Windows-7-64

    General and Desktop
    1
    1
    826
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      Gary W. Sherwin last edited by

      I am having issues with trying to load image data from a buffer, modifying specified pixels via setPixel(),
      displaying it via a QGraphicsView and picking up mouse clicks from said view. For some reason, all my
      images seem to double flip exchange the image into diagonally flipped quadrants, i.e. the data that
      should be arranged as:

      @_ 0,0 0,1 0,2 0,3 | 0,4 0,5 0,6 0,7
      _ 1,0 1,1 1,2 1,3 | 1,4 1,5 1,6 1,7
      _ 2,0 2,1 2,2 2,3 | 2,4 2,5 2,6 2,7
      _ 3,0 3,1 3,2 3,3 | 3,4 3,5 3,6 3,7
      __----------------|----------------
      _ 4,0 4,1 4,2 4,3 | 4,4 4,5 4,6 4,7
      _ 5,0 5,1 5,2 5,3 | 5,4 5,5 5,6 5,7
      _ 6,0 6,1 6,2 6,3 | 6,4 6,5 6,6 6,7
      _ 7,0 7,1 7,2 7,3 | 7,4 7,5 7,6 7,7@

      is instead arranged, displayed and mouse position indicated as:

      @_ 4,4 4,5 4,6 4,7 | 4,0 4,1 4,2 4,3
      _ 5,4 5,5 5,6 5,7 | 5,0 5,1 5,2 5,3
      _ 6,4 6,5 6,6 6,7 | 6,0 6,1 6,2 6,3
      _ 7,4 7,5 7,6 7,7 | 7,0 7,1 7,2 7,3
      __----------------|----------------
      _ 0,4 0,5 0,6 0,7 | 0,0 0,1 0,2 0,3
      _ 1,4 1,5 1,6 1,7 | 1,0 1,1 1,2 1,3
      _ 2,4 2,5 2,6 2,7 | 2,0 2,1 2,2 2,3
      _ 3,4 3,5 3,6 3,7 | 3,0 3,1 3,2 3,3@

      So for example, if I try to set pixel (7,7) it will instead set (3,3), or
      (4,4) will set (0,0) and the opposite as well.

      I have had to write logical code to flip the pixels to the correct
      viewing location and to flip the mouse clicks as well. This happens
      regardless of the size of the image, always vertically and horizontally
      exchanging image halves. It makes for very confusing code and is quite
      prone to errors. Am I missing something? Is there a setting somewhere
      to account for this?

      I suspect that there is some setting that I am missing. I doubt that it
      is a bug, since images loaded from files don't seem to have this problem.

      Tanks

      Gary

      Thank you

      Gary

      Gary W. Sherwin
      Sherwin Family Enterprises
      http://garywsherwin.com

      1 Reply Last reply Reply Quote 0
      • First post
        Last post