[Kde-games-devel] Unify pixmap caching across card games

Luciano Montanaro mikelima at gmail.com
Fri Jan 11 09:58:37 CET 2008


Il Thursday 10 January 2008 21:12:03 Andreas Pakulat ha scritto:
> On 10.01.08 17:58:41, Luciano Montanaro wrote:
> > Il Wednesday 09 January 2008 20:51:29 Andreas Pakulat ha scritto:
> > > > > And what about the raster decks?
> > > >
> > > > SVG has an <img> tag too. Non svg decks could be trivially converted
> > > > to svg decks by shipping the images together with a .svg wrapper
> > > > containing something like
> > > > <svg>
> > > > <img id="4_hearts" href="4_hearts.png" />
> > > > </svg>
> > > >
> > > > I did not look up the SVG specs, so the syntax may be a little
> > > > different...
> > >
> > > That would simplify a _lot_ of code. Especially it would remove the
> > > need for a mapping between combinations of card and suite to the actual
> > > png names. So +1 from my side if you can find somebody/some people to
> > > do it. Unfortunately I have close to 0 ide about SVG or how to edit it
> > > :)
> >
> > Then it's quite easy. I tried putting together an svg wrapper the other
> > night. It is missing the backs, but it works. Just put it in the default
> > deck directory, and test it with inkview or gwenview (or the Qt
> > svgviewer)
>
> I'll have a try later on and I'll also post the latest version of the
> code then, hopefully with some improvements to the structure of the
> maps..
>
> > The same file would basically work for all the Pixmap themes, the only
> > needed change is to adapt to the card size.
>
> Does that mean the Pixmap from QSvgRenderer would need to be resized to
> the requested size even if I tell the renderer the size of the pixmap?
>

No, the sizes are needed to render correctly the base size, you can ask for 
any size you like. The desktop file contains the card size, so you can use 
that to have the "preferred" size, or scale it as you whish. That information 
is redundant, actually, since you can also use 
QSvgRenderer::boundsOnElement(name) 
to obtain the design size of any card. 

> > I can put togeether a perl script to generate the files in 20 minutes,
> > if needed.
>
> That would be cool.

Ok, I'll put it together this weekend, then.

Luciano





More information about the kde-games-devel mailing list