Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Zoom/Scale into a desired image mask
Qt 6.11 is out! See what's new in the release blog

Zoom/Scale into a desired image mask

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 433 Views 1 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.
  • A Offline
    A Offline
    abdesai
    wrote on last edited by
    #1

    Hi, I have an image being displayed within a rectangle viewport which allows the user to zoom-in and zoom-out using touch and mouse. When the page gets rendered currently the image is shown at scale with PreserveAspectFit setting![alt text](image url). Hence the image appears completely within the viewport rectangle.

    I have an image mask which is a rectangle coordinates in pixel value of image coordinate system covering a desired region in the image. I would like to zoom/scale into this region based on the rectangle coordinates upon the page being loaded.

    Is this possible? I have tried image transformations using scale and translate but havent had any success accurately focusing-in on the desired mask region.

    Rectangle {
                id: imagerect
                width: parent.width
                height: parent.height
    
                Image {
                    id: moveImages
                    source: "image.png"
                    width: parent.width
                    height: parent.height
                    fillMode: Image.PreserveAspectFit
                    anchors {
                        horizontalCenter: parent.horizontalCenter
                        top: parent.top
                    }
                }
            }
            PinchArea {
                id: pincharea
                anchors.fill: frame
                pinch.target: imagerect
                pinch.minimumScale: 0.5
                pinch.maximumScale: 10
           }
    }
    

    562abab0-73ae-4709-b75e-a95fc53b88b2-focus.png file:///home/allay.desai/Pictures/focus.png

    1 Reply Last reply
    0

    • Login

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