Added explicit support for quadratic and cubic bezier curves, should be faster than general method