Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is this right or wrong?
Forum Updated to NodeBB v4.3 + New Features

Is this right or wrong?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 328 Views 2 Watching
  • 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by SPlatten
    #1

    I have an offscreen image, I have inverted the coordinates in the vertical axis so 0,0 is bottom left. I have a visible area that uses the normal coordinate system.

    I have a slider that enables me to change the section of the image to transfer from offscreen to the visible area and min and max spinners to set the maximum and minimum areas to captured from the offscreen. The offscreen image is 81 pixels wide and 2000 pixels high. The visible area is 81 wide and 492 high.

    The image from is transferred from offscreen to visible with:

        QPainter objVisible(this);
        QRect rctSection(0, intOnViewMin, rctOffscreen.width(), intSpanOnView);
        QSize szSource(rctWorking.width(), rctWorking.height());
        QImage imgStrip(mpOffscreen->toImage()),
               imgSection(imgStrip.copy(rctSection).scaled(szSource));
        objVisible.drawImage(QPoint(0, 0), imgSection);
    

    As far as I can see the image is initially perfect and scaled correctly, if I change the maximum spinner taking 10 off it, it seems that the image transferred is not from the bottom but from the top. I've tried inverting rctSection this doesn't work.

    As an example, when I start before changing anything:
    The max spinner is set to 2000 and the min spinner is set to 0.
    rctSection is x: 0, y: 0, width: 86, height: 2000
    szSource width: 86, height: 492
    At this stage the image transferred is perfect.

    If I change the max spinner to 1990.
    rctSection is x: 0, y: 0, width: 86, height: 1990
    szSource width: 86, height: 492
    But now the image is copied not from the bottom up but from the top down.

    I can see where the problem is, its because the coordinate system of the original image is inverted and when I'm copying the image its copying from top down with 0,0 at top left instead of at the bottom. Now I have to figure out what to do.

    I have to offset rctSection by the delta which will be the difference between the height of the offscreen image and the maximum value in the spinner.

    Kind Regards,
    Sy

    SPlattenS 1 Reply Last reply
    1
    • SPlattenS SPlatten

      I have an offscreen image, I have inverted the coordinates in the vertical axis so 0,0 is bottom left. I have a visible area that uses the normal coordinate system.

      I have a slider that enables me to change the section of the image to transfer from offscreen to the visible area and min and max spinners to set the maximum and minimum areas to captured from the offscreen. The offscreen image is 81 pixels wide and 2000 pixels high. The visible area is 81 wide and 492 high.

      The image from is transferred from offscreen to visible with:

          QPainter objVisible(this);
          QRect rctSection(0, intOnViewMin, rctOffscreen.width(), intSpanOnView);
          QSize szSource(rctWorking.width(), rctWorking.height());
          QImage imgStrip(mpOffscreen->toImage()),
                 imgSection(imgStrip.copy(rctSection).scaled(szSource));
          objVisible.drawImage(QPoint(0, 0), imgSection);
      

      As far as I can see the image is initially perfect and scaled correctly, if I change the maximum spinner taking 10 off it, it seems that the image transferred is not from the bottom but from the top. I've tried inverting rctSection this doesn't work.

      As an example, when I start before changing anything:
      The max spinner is set to 2000 and the min spinner is set to 0.
      rctSection is x: 0, y: 0, width: 86, height: 2000
      szSource width: 86, height: 492
      At this stage the image transferred is perfect.

      If I change the max spinner to 1990.
      rctSection is x: 0, y: 0, width: 86, height: 1990
      szSource width: 86, height: 492
      But now the image is copied not from the bottom up but from the top down.

      I can see where the problem is, its because the coordinate system of the original image is inverted and when I'm copying the image its copying from top down with 0,0 at top left instead of at the bottom. Now I have to figure out what to do.

      I have to offset rctSection by the delta which will be the difference between the height of the offscreen image and the maximum value in the spinner.

      SPlattenS Offline
      SPlattenS Offline
      SPlatten
      wrote on last edited by
      #2

      @SPlatten , problem solved.

      Kind Regards,
      Sy

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mchinand
        wrote on last edited by
        #3

        What was the solution?

        SPlattenS 1 Reply Last reply
        1
        • M mchinand

          What was the solution?

          SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #4

          @mchinand , the solution is in my edited post. The last line.

          Kind Regards,
          Sy

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved