Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-30337

BorderImage clip does not work properly

    XMLWordPrintable

Details

    Description

      I wanted to support Android-like 9-patch images (like those produced with Draw 9-patch: http://developer.android.com/tools/help/draw9patch.html) in BorderImage, so I made such an Item:

      Item {
          property url source
      
          clip: true
          onSourceChanged: {
              var borders = readBorders(source); // C++ code that analize QImage and returns QVariantMap with borders
              // set set bi borders
          }
      
          BorderImage {
              id: bi
              anchors.fill: parent
              anchors.margins: -1
          }
      }
      

      The idea is to draw the image 1 pixel lager each side and cut out the "meta-data" border with clip set to true. But it is not working properly. It seems that the borders are also somehow scaled, because sometimes those black lines are visible on the edges like them would be blurred to the "real image" pixels. It works better with smooth set to false, but not always and of course I would like to have the smooth property set to true.

      Summarizing:

      • it looks like borders, which shouldn't be scaled at least in one direction are somehow scaled or processed
      • as a suggestion: as this 9-patch images are widely used in Android the idea is rather platform independent so maybe it should be implemented as BorderImage new functionality (or some new NinePatchImage item if BorderImage is not suitable). With some help and suggestions I would pick up the gauntlet.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sletta Gunnar Sletta
            faldżip Filip Piechocki
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes