Drawing vector graphics in js widgets

Aaron J. Seigo aseigo at kde.org
Wed Feb 24 17:18:05 CET 2010


On February 24, 2010, Mohamed Ikbel Boulabiar wrote:
> 1. I want to draw vector graphics in a javascript widget and specially
> ellipses then thick lines .
> Is there an easy way and rapid rendering way to do that ? I can't find

var pen = new QPen
pen.width = 5 // 5 pixels wide! wooo!
pen.color = new QColor(160, 24, 180) // some random color, 
							//could also be a named color like "red"
painter.pen = pen
painter.drawEllipse(...)

> 2. I want also to know how to access special elements in an svg item,
> then draw it inside the widget.

give the elements an id (this is a string), you can then use that id when 
painting the svg, e.g.:

svg.paint(painter, plasmoid.rect.x, plasmoid.rect.y, "elementId")

that will point the element named "elementId" in the top left corner of the 
plasmoid.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks


More information about the Plasma-devel mailing list