Adding SVG image operations?

Riccardo Iaconelli riccardo at kde.org
Sat May 17 17:39:24 CEST 2008


On Wednesday 16 April 2008 23:06:22 Rafał Miłecki wrote:
> Currently we use some hacks when using SVG images. Let me just call
> analog clock's code:
>
> 1) For drawing hand we use QPainter trick. We save current QPainter,
> then rotate it, then draw choosen hand only and after all we restore
> QPainter status. Isn't this little complex?
>
> 2) For drawing text with current time we use QPainter::drawText(...).
> This causes possibility of situation when text is in place which was
> designed by SVG author for sth else. What's more, we have no idea if
> style of font does fit to SVG image.
>
> I think it would be great if we could just modify (in buffer) some
> code of SVG and redraw it.  Some examples:
>
> 1) SVG author places simple line in image:
> <line id="MinuteHand" x1="50" y1="50" x2="50" y2="0" />
> which results in vertical hand. We just move it when needed:
> <line id="MinuteHand" x1="50" y1="50" x2="48" y2="5" />
>
> 2) Author places:
> <text id="TextTime" x="35" y="165">23:59</text>
> and we manage to update content of text element.
>
> In future we could do even more. We could define names of JavaScript
> functions building some kind of API. For example function
> "isTimeTextDisplayed(status)" that is called every time KDE user
> change displaying time as text. In that way we let SVG author adjust
> image depending on KDE user's settings. Example:
>
> function isTimeTextDisplayed(status) {
>   if (status) {
>     document.getElementById("foo").style.display="hidden";
>   }
>   else {
>     document.getElementById("foo").style.display="";
>   }
> }
>
> Opinions?

That's what I thought as a complicated example when thinking of Plasma
themes and Lua. =)
Summing up, I really think that something similar is really really
needed, to be able
to give more control to the theme authors who care.

I'm just thinking of different svgs loaded conditionally depending on
the formfactor, or on the size... that would make possible e.g. using
the analog clock in the panel, being still able to read it. =)

And, it wouldn't be mandatory to use, so it's just for those who care. =)

Bye,
-Riccardo
-- 
GPG key:
3D0F6376
When encrypting, please encrypt also for this subkey:
9EBD7FE1
-----
Pace Peace Paix Paz Frieden Pax Pokój Friður Fred Béke 和平
Hasiti Lapé Hetep Malu Mир Wolakota Santiphap Irini Peoch
Shanti Vrede Baris Rój Mír Taika Rongo Sulh Mir Py'guapy 평화


More information about the Panel-devel mailing list