By Martin Elsman, DIKU
This application demonstrates the use of the flattening by expansion technique [1] for drawing cubic bezier curves. The application is written in Futhark and builds on the Futhark Lys Library.
The implementation also supports antialiased drawing of linear bezier curves (i.e., lines) with partly support for antialiased drawing of cubic bezier curves; we still need to perform some calculations on the derivative, which should be easy to do; see the screen capture below, which demonstrates how antialiasing improves the visual appearance.
To build and run the application, do as follows:
$ cd src
$ futhark pkg sync
$ make
$ ./bezier -i
Copyright (c) Martin Elsman, DIKU
MIT License
By splitting the curves appropriately, we may be able to predict better the exact number of pixels required to draw a continuous cubic bezier curve. It would also be great to understand how we should blend two crossing antialised lines.
[1] Martin Elsman, Troels Henriksen, and Niels G. W. Serup. Data-Parallel Flattening by Expansion. In Proceedings of the 6th ACM SIGPLAN International Workshop on Libraries, Languages and Compilers for Array Programming (ARRAY ‘19). Phoenix, AZ, USA. June, 2019. PDF