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. Load only rendered image
Forum Updated to NodeBB v4.3 + New Features

Load only rendered image

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 2 Posters 1.6k 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.
  • S Offline
    S Offline
    Sil20
    wrote on last edited by
    #1

    Hell,
    I am develloping a qml application. I use Qt 4.8.4, QtQuick 1.1 32bits

    I have a huge scene but only part of it is actually displayed. we reache the 32bit extended memmory limit, our process is 3Gb .

    There are many svg images which weigh is 1Gb in memmory (when replacing them by rectangle the process is only 2Gb).

    Is their a way to detect from a Qml "Image" object is rendered? so I could load dynamically the image only when render is required?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      It might be a better idea to render those SVGs into PNG and using that at runtime. This might not be possible - depending on your use case. This is also what the documentation recommends.

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sil20
        wrote on last edited by
        #3

        OK,
        What would be the reason?
        the Png rendering is more efficient than Svg?
        does it take less space in memory?

        We are using the Svg because of the vectorial format which allow to resize without loss

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          [quote author="Sil20" date="1416996964"]the Png rendering is more efficient than Svg?[/quote]

          Yes, massively. SVG parsing and rendering in Qt is very expensive and should be avoided as much as possible. Also, the QtSvg module does not support full SVG specification.

          (Z(:^

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sil20
            wrote on last edited by
            #5

            OK thancks.
            is there a tool to batch convert SVG to PNG ?
            Since our svg are size properly and I assume we should define a Dpi to render properly pngs...

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              I guess Phatch can do the job. I use it for JPEGs, but it may have SVG support.

              (Z(:^

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Sil20
                wrote on last edited by
                #7

                Actually I developed the following "MyImage.qml" which reallocate the rendering pixmap using a quality criteria.
                Since in my project the rendering quality may be reduce precisely on the process which is overloaded this might do the job.

                But I am wondering if i am not using a bug :

                • modifiing " sourceSize.width" => width is modified
                • modifiing " "width" => "sourceSize.width" is not modified

                Is there another way to reallocat the pixmap?
                Am I using a bug/feature?

                @
                Image {

                onStatusChanged: {recomputesmoothness();}
                //All SVG or other image files are rendered in a Pixmap which is allocated in  memmory
                //The code above allow to render a lower resolution pixmap in the same area
                function recomputesmoothness()
                {
                    if (status == Image.Ready)
                    {
                        //Reduce Pixmaresolution
                        if(SDCN.operatingMode !== SdcnOperatingMode.Suivi)
                        {
                           return
                        }
                
                        //DPI factor is used (considered befere below max resolution
                        var lDPIFacor=0.3
                     
                        var lw=width
                        var lh=height           
                        var lhwFacor=1.0
                
                        var lwTmp=0
                        var lhTmp=0
                        if(lDPIFacor !=1.0)
                        {
                            lhwFacor=lDPIFacor
                            lwTmp=Math.floor( width*lhwFacor)
                            lhTmp=Math.floor(height*lhwFacor)
                
                
                            console.log("-----------------------DPI factor is used----------------------------------------------")
                            console.log("Factor:",lhwFacor,"Width:",width,"SourceWidth:",sourceSize.width,"NewWidth:",lwTmp)
                            console.log("Factor:",lhwFacor,"Height:",height,"SourceHeight:",sourceSize.height,"NewHeight:",lhTmp)
                            console.log(".")
                        }          
                
                        //"Reallocate" the Pixmap
                        sourceSize.width=lwTmp
                        sourceSize.height=lhTmp
                
                        //Resize properly the image
                        width=lw
                        height=lh
                
                    }
                }
                

                }@

                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