Bezier curves

249 views
Skip to first unread message

occult...@yahoo.co.uk

unread,
Apr 4, 2014, 11:21:42 PM4/4/14
to skia-d...@googlegroups.com
I'm trying to get Skia to draw Bezier curves and solid shapes bounded by Bezier curves.  I've built SampleApp using Visual C++ 2010 express.  Right-arrow goes through lots of different samples, but the 3 bezier samples don't display anything (they're called bezier_cubic_effects, bezier_conic_effects, and bezier_quad_effects).  How can I get them working?

Cary Clark

unread,
Apr 5, 2014, 12:12:11 AM4/5/14
to skia-d...@googlegroups.com
Hi

To get this sample to draw, press 'D' a couple of times. This will switch to using opengl instead of the default raster engine.

The program 'SampleApp' is a misnomer. While it does contain a lot of samples, its main purpose is to verify that different components of Skia draw the way they are supposed to, not so much to demonstrate how to use Skia to draw something. The samples you mentioned test the subcomponent of Skia that uses OpenGL to draw, which is why they draw nothing when the default raster engine is used.

To draw Bezier curves in Skia, add the quadratic or cubic curves to a path, using the interfaces in include/SkPath.h. 
SkPath::quadTo() and SkPath::cubicTo() are probably what you want. After you construct your path, draw it using a SkCanvas.

tests/DrawPathTest.cpp and tests/PaintTest.cpp have examples of constructing and drawing paths that work on all device backends.

Hope that helps.

Cary



On Fri, Apr 4, 2014 at 9:21 PM, <occult...@yahoo.co.uk> wrote:
I'm trying to get Skia to draw Bezier curves and solid shapes bounded by Bezier curves.  I've built SampleApp using Visual C++ 2010 express.  Right-arrow goes through lots of different samples, but the 3 bezier samples don't display anything (they're called bezier_cubic_effects, bezier_conic_effects, and bezier_quad_effects).  How can I get them working?

--
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 http://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

occult...@yahoo.co.uk

unread,
Apr 6, 2014, 6:10:31 AM4/6/14
to skia-d...@googlegroups.com
Thanks, that's looking very good.  I have been trying to use Anti-Grain Geometry to draw shapes bounded by bezier curves, but I gave up because I found the software incomprehensible and the documentation almost non-existent.  Skia looks much more promising.
Reply all
Reply to author
Forward
0 new messages