Qt SVG renderer

Richard Dale rdale at foton.es
Thu Jul 31 21:17:37 BST 2008


On Thursday 31 July 2008 20:42:28 Maksim Orlovich wrote:
> On Thursday 31 July 2008 15:16:12 Richard Dale wrote:
> > On Thursday 31 July 2008 19:31:46 Matthew Woehlke wrote:
> > > Thiago Macieira wrote:
> > > > On Thursday 31 July 2008 13:54:22 Rafael Fernández López wrote:
> > > >> Matthew Woehlke wrote:
> > > >>> @ereslibre:
> > > >>> It would be REALLY helpful if you could somehow provide the
> > > >>> mis-rendering svg's as well (link to websvn is probably ok); I'm
> > > >>> sure this would be a tremendous help to the Qt folk.
> > > >>
> > > >> Hmm, yes... let's see if I can do it ASAP.
> > > >
> > > > There's no rush for us.
> > >
> > > Well *I'm* still curious. So I dug out where in svn the .svg's are...
> > > and at least for media-flash-memory-stick, there is indeed *not* junk
> > > in the file... all the background garbage is indeed the fault of the
> > > renderer, not the svg. (I wonder if Ariya might be onto something, if
> > > maybe something is being reused without being cleared, rather than a Qt
> > > problem. I must admit, it's hard to imagine how Qt would manage to
> > > render bunches of other icons behind the 'right' one.)
> >
> > I think the images were generated with a QtRuby program as I helped ruphy
> > get it working on the #plasma irc channel. Sorry this has only just
> > occured to me, although I've been reading the thread.
> >
> > It renders all the "*.svg"s in a directory to .pngs. However, if I've
> > just run it with just a single svg at a time, and I get different
> > results. So I suspect this a more likely a bug in QtRuby than Qt itself.
> >
> > Here is the QtRuby program:
> >
> > require 'Qt4'
> >
> > class Renderer
> >   def initialize
> >     @renderer = Qt::SvgRenderer.new
> >   end
> >
> >   def render(file)
> >     pic = Qt::Image.new(256, 256, Qt::Image::Format_ARGB32_Premultiplied)
>
> You meed to call fill on the image to initialize it here.
Yes, you're right that's all it was. If I add pic.fill(0) it works fine. 

I converted the program to C++ and it behaves identically, failing to work 
without the fill() call - so at least this isn't some kind of QtRuby bug 
anyway.

-- Richard






More information about the kde-core-devel mailing list