July 31, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

Possible approach for SVG clipping

 

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?

2 replies

August 2, 2010

aviral aviral
Lab Rat
11 posts

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.

August 3, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

@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.

 
  ‹‹ Phonon: Move disk access off the main thread      Problems connecting to oracle database ››

You must log in to post a reply. Not a member yet? Register here!