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

Supports rounded rectangle clip for MultiEffect

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • None

    Description

      The design philosophy of `MultiEffect` aims to process materials more comprehensively within a single rendering process rather than splitting it across multiple rendering passes. Cropping a material to a rounded rectangle is a common requirement, and I noticed that `ShapePath` has added relevant functionality: [ShapePath documentation](https://doc.qt.io/qt-6/qml-qtquick-shapes-shapepath.html#fillItem-prop).

      If you want to apply a blur effect to an `Image` and crop it into a rounded rectangle, there are two approaches: either enable a layer for `MultiEffect` and then fill it into the `ShapePath`, or do the reverse. In either case, achieving this effect requires two rendering passes. You might think that using `MultiEffect`'s mask could accomplish the same thing, but when the `Image` is large, using a mask is not an ideal choice (perhaps it could be improved by supporting stretching the mask like `BorderImage`?).

      So, can we leverage the `CurveRenderer` of `ShapePath` to maximize code reuse and add a `shapePathClip` feature to `MultiEffect`? The usage could look something like this:

      MultiEffect {
          source: Image {...}
          blurEnabled: true
          shapePathClipEnabled: true
          shapePathClip: ShapePath {
              PathRectangle {
                  topRightRadius: 10
                  topLeftRadius: 0
              }
          }
      } 

      This approach would allow `MultiEffect` to incorporate the clipping functionality directly, thus potentially eliminating the need for an additional rendering pass and improving performance, especially for larger images. This could also provide a more flexible and streamlined way to apply complex shapes and effects without excessive processing overhead.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.graphics.and.multimedia Qt Graphics Team
              zccrs JiDe Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes