how to use drawLine to draw special line

180 views
Skip to first unread message

啊源股

unread,
Jun 26, 2018, 4:42:48 AM6/26/18
to skia-discuss
HI  ,

    I want use drawLine function to draw a special line.
    
    as picture below, you can see, point 1 to point 2, this line is from coarseness to fineness。




 Thank you , best regard!



Cary Clark

unread,
Jun 26, 2018, 8:13:06 AM6/26/18
to skia-d...@googlegroups.com
Skia doesn't have this functionality as part of SkCanvas::drawLine. You'll need to describe the area to fill and call SkCanvas::drawPath.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

啊源股

unread,
Jun 27, 2018, 5:58:03 AM6/27/18
to skia-discuss
Thanks。

Hi Clark,

picture 1



picture 2




    I get touch pen pressure to draw two line, like picture 1 , it is not smooth.
so I want split this line like picture 2, and make it smooth.

please give me some advice to get coordinate data p1', p1'',p1''',p1''''. or maybe there has other way to make it smooth, please give me advice.

thank you.
best regard!








在 2018年6月26日星期二 UTC+8下午8:13:06,Cary Clark写道:

Cary Clark

unread,
Jun 27, 2018, 8:18:00 AM6/27/18
to skia-d...@googlegroups.com
There's nothing built-in to Skia to describe a variable width line from data generated by pen pressure. You could use SkCanvas::drawVertices if your data can be best approximated by a triangle mesh; drawPath as mentioned in the previous answer, or drawBitmap (or a variant like SkBitmapShader) if your data can be best approximated as a mask. 

啊源股

unread,
Jun 29, 2018, 1:51:31 AM6/29/18
to skia-discuss


Hi  Clark,

This template has only text effects, is there has line effects can do that? 







在 2018年6月27日星期三 UTC+8下午8:18:00,Cary Clark写道:

Cary Clark

unread,
Jun 29, 2018, 7:43:22 AM6/29/18
to skia-d...@googlegroups.com
You can call SkPaint::getFillPath() to get the path for a line.
The link above is to the documentation for that function.
Reply all
Reply to author
Forward
0 new messages