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. Possible approach for SVG clipping
Forum Updated to NodeBB v4.3 + New Features

Possible approach for SVG clipping

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 3.8k 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.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    Hi,
    Clipping of SVG vectors could be useful for many users. At present Qt does not support clipping of these vectors, i.e. slicing of SVG images. Of course there are commercial tools that slice SVGs amazingly well.
    Below is one approach I had in mind for some time (with inputs from Gunnar) and thought better document here ...

    1. Use QSvgRenderer to read svg file
    2. Modified/extend QSvgGenerator's drawPath (or drawXXXX) methods to slice various vectors
    3. Use Qpainter with QSvgGenerator as the paint device, to generate svg, which now has the vectors sliced
    4. For complex shapes, one could use the QPathClipper class to help out

    Thoughts/comments?

    1 Reply Last reply
    1
    • A Offline
      A Offline
      aviral
      wrote on last edited by
      #2

      SVG clipping is more like buddy system....My point of view is data centric to add to above API centric info..

      SVG is a collection of drawn blocks..Now these blocks are drawn and can be clipped but clips are formed with nearby blocks combining together just like buddy system from memory allocation.
      http://en.wikipedia.org/wiki/Buddy_memory_allocation

      My thought is on to get data structure out for storing and forming clip so that if possible clips can be SVG or other desired format in the effecient way.

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        @aviral, qpainter allows u to clip regular raster images very well, I actually tried to use the same on a SVG image due to some requirement I had. Then noticed that svg clipping was not handled.

        Which other formats do you think we should target in the solution.

        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