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. Image of InnerShadow

Image of InnerShadow

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

    Hi,

    Long story short:
    how to get image (png) of InnerShadow - but just the shadow part, without content of the effect.

    I have a component which contains arc shape with InnerShadow:
    db15fa06-e2d0-445f-895b-9cd91e9670cb-image.png b5f60888-ad54-4ce9-9968-8f1f94485f08-image.png
    But the InnerShadow it is expensive - it increases creation time and I need dozen or more of them on not much capable device.
    So I would like to replace InnerShadow with image of it, but I don't know how to generate/grab it.
    When I'm trying to use grabToImage() I'm getting the arc with the shadow, but I need only the shadow.
    Please help.
    Good thing is that all dimensions are static (width, height, stroke width, angels).

    Below is the code for above images:

    import QtQuick 2.14
    import QtQuick.Shapes 1.14
    import QtGraphicalEffects 1.14
    
    
    Rectangle {
      width: 140; height: 140
    
      Shape {
        id: dialShape
        anchors.centerIn: parent
        width: 116; height: 116
        visible: false
        antialiasing: true
        smooth: true
        
        ShapePath {
          strokeColor: "#f5f5f5"
          fillColor: "transparent"
          capStyle: Qt.RoundCap
          strokeWidth: 8
          
          PathAngleArc {
            radiusX: 40; radiusY: 40
            centerX: dialShape.width / 2
            centerY: dialShape.height / 2 - 6
            startAngle: 140
            sweepAngle: 260
          }
        }
        ShapePath {
          strokeColor: "yellow"
          fillColor: "transparent"
          capStyle: Qt.RoundCap
          strokeWidth: 8
          
          PathAngleArc {
            radiusX: 40; radiusY: 40
            centerX: dialShape.width / 2
            centerY: dialShape.height / 2 - 6
            startAngle: 140
            sweepAngle: 260 * 0.4 // 0.4 is coefficient - it can change
          }
        }
      }
      
      InnerShadow {
        anchors.fill: dialShape
        horizontalOffset: 2; verticalOffset: 2
        radius: 4
        samples: 32
        color: Qt.rgba(0, 0, 0, 0.24)
        source: dialShape
      }
    }
    
    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