Drawing vector graphics in js widgets

Mohamed Ikbel Boulabiar boulabiar at gmail.com
Thu Feb 25 00:35:36 CET 2010


Thanks for the answer and for the api errata you send yesterday.

I tried with the code below, but it only draws things without changing
the properties of the pen.


//////////////////
var painter = new QPainter
var pen = new QPen

pen.color = new QColor("red")
pen.width = 15
//painter.setbrush = pen.brush
//painter.pen = pen
painter.setpen = pen

plasmoid.paintInterface = function(painter)
{
  painter.drawEllipse(30, 40, 120, 113)
  painter.drawRect(22, 21, 20, 13)
}

//////////////////




On Wed, Feb 24, 2010 at 5:18 PM, Aaron J. Seigo <aseigo at kde.org> wrote:
> 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
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>


More information about the Plasma-devel mailing list