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. QPainter, QPixmap, drawPie and Transformations

QPainter, QPixmap, drawPie and Transformations

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.7k 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.
  • webzoidW Offline
    webzoidW Offline
    webzoid
    wrote on last edited by
    #1

    I have a PNG image which I've loaded into my application as a QPixmap.

    What I'm looking to do is to stretch this image into the shape of a pie slice and draw it using the QPainter::drawPie function.

    Having loaded a new QBrush instance with the QPixmap, I now need to somehow transform the brush to the shape of the pie.

    Any clues as to how this may be achieved? Thank you in advance for any hints

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      hi
      Hmm
      DrawPie will use any brush set to fill the pie.
      I assume you want it filled other than how brush does ?

      webzoidW 1 Reply Last reply
      0
      • mrjjM mrjj

        hi
        Hmm
        DrawPie will use any brush set to fill the pie.
        I assume you want it filled other than how brush does ?

        webzoidW Offline
        webzoidW Offline
        webzoid
        wrote on last edited by
        #3

        @mrjj You are indeed correct - I want the brush to be transformed so that the QPixmap is adjusted to fill the interior of the pie, assuming the shape of the pie.

        mrjjM 1 Reply Last reply
        0
        • webzoidW webzoid

          @mrjj You are indeed correct - I want the brush to be transformed so that the QPixmap is adjusted to fill the interior of the pie, assuming the shape of the pie.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @webzoid
          It does have
          void QBrush::setTransform(const QTransform & matrix)
          but its unclear how you mean it should be draw since
          it does brush does fill the interior but will do so in a reaping manner.

          webzoidW 1 Reply Last reply
          0
          • mrjjM mrjj

            @webzoid
            It does have
            void QBrush::setTransform(const QTransform & matrix)
            but its unclear how you mean it should be draw since
            it does brush does fill the interior but will do so in a reaping manner.

            webzoidW Offline
            webzoidW Offline
            webzoid
            wrote on last edited by
            #5

            @mrjj Sorry, I'm not explaining this very well...

            Imagine the point of the pie slice. The bitmap should be drawn such that the pixels on the bottom row are squashed into this point. Then imagine the curve of the pie slice, the top row of the bitmap (and nearby pixels) would be stretched and transformed to fit in the curve.

            All other pixels within the bitmap would also be transformed to fill the remaining area of the pie slice.

            Does that make any sense at all :)

            mrjjM 1 Reply Last reply
            0
            • webzoidW webzoid

              @mrjj Sorry, I'm not explaining this very well...

              Imagine the point of the pie slice. The bitmap should be drawn such that the pixels on the bottom row are squashed into this point. Then imagine the curve of the pie slice, the top row of the bitmap (and nearby pixels) would be stretched and transformed to fit in the curve.

              All other pixels within the bitmap would also be transformed to fill the remaining area of the pie slice.

              Does that make any sense at all :)

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @webzoid
              Hmm i think i get it now, like a perfect fit for the pixmap
              and not just filled as repeating fill.
              Something like
              https://stackoverflow.com/questions/30980484/qt-fill-circle-with-images
              ?

              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