From kde-panel-devel Sat May 17 15:39:24 2008 From: "Riccardo Iaconelli" Date: Sat, 17 May 2008 15:39:24 +0000 To: kde-panel-devel Subject: Re: Adding SVG image operations? Message-Id: X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=121103882625404 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: > > which results in vertical hand. We just move it when needed: > > > 2) Author places: > 23:59 > 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 평화 _______________________________________________ Panel-devel mailing list Panel-devel@kde.org https://mail.kde.org/mailman/listinfo/panel-devel