1#include <boost/python.hpp>
7#include <pycairo/pycairo.h>
36 if(ch.
empty())
return;
38 for(
unsigned i = 0; i < ch.
size(); i++) {
45 cairo_line_to(cr, (*line_segment)[1][0], (*line_segment)[1][1]);
48 std::vector<Point> points = quadratic_bezier->controlPoints();
49 Point b1 = points[0] + (2./3) * (points[1] - points[0]);
50 Point b2 = b1 + (1./3) * (points[2] - points[0]);
53 points[2][0], points[2][1]);
56 std::vector<Point> points = cubic_bezier->controlPoints();
57 cairo_curve_to(cr, points[1][0], points[1][1], points[2][0], points[2][1], points[3][0], points[3][1]);
92 for ( iter = p.
begin() ; iter != p.
end() ; ++iter ) {
110 for(it = p.
begin(); it != p.
end(); ++it) {
117 for ( it = p.
begin() ; it != p.
end() ; ++it ) {
132 for(
unsigned i = 0; i < p.size(); i++)
136#if PY_MAJOR_VERSION < 3
141#if PY_MAJOR_VERSION < 3
147 PycairoContext* pcc = (PycairoContext*)cr.ptr();
148 assert(PyObject_TypeCheck(pcc, &PycairoContext_Type));
149 return PycairoContext_GET(pcc);
Various utility functions.
void cairo_curve(cairo_t *cr, Curve const &c)
void cairo_line_to(cairo_t *cr, Geom::Point p1)
cairo_t * cairo_t_from_object(boost::python::object cr)
void cairo_path_stitches(cairo_t *cr, Path const &p)
static Pycairo_CAPI_t * Pycairo_CAPI
void cairo_d2_pw_sb(cairo_t *cr, D2< Piecewise< SBasis > > const &p)
void cairo_pw_d2_sb(cairo_t *cr, Piecewise< D2< SBasis > > const &p)
void cairo_path(cairo_t *cr, Path const &p)
void cairo_convex_hull(cairo_t *cr, ConvexHull const &ch)
void cairo_move_to(cairo_t *cr, Geom::Point p1)
void cairo_d2_sb(cairo_t *cr, D2< SBasis > const &B)
void cairo_rectangle(cairo_t *cr, Rect const &r)
void cairo_curve_to(cairo_t *cr, Geom::Point p1, Geom::Point p2, Geom::Point p3)
Convex hull based on the Andrew's monotone chain algorithm.
bool empty() const
Check for emptiness.
Point const & back() const
Get the penultimate point of the lower hull.
size_t size() const
Get the number of points in the hull.
Abstract continuous curve on a plane defined on [0,1].
Adaptor that creates 2D functions from 1D ones.
C top() const
Return top coordinate of the rectangle (+Y is downwards).
C left() const
Return leftmost coordinate of the rectangle (+X is to the right).
C height() const
Get the vertical extent of the rectangle.
C width() const
Get the horizontal extent of the rectangle.
Sequence::const_iterator const_iterator
Sequence of contiguous curves, aka spline.
bool closed() const
Check whether the path is closed.
Point finalPoint() const
Get the last point in the path.
const_iterator end() const
Point initialPoint() const
Get the first point in the path.
size_type size() const
Natural size of the path.
const_iterator begin() const
Function defined as discrete pieces.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Various utility functions.
Path path_from_sbasis(D2< SBasis > const &B, double tol, bool only_cubicbeziers=false)
Make a path from a d2 sbasis.
Piecewise< D2< SBasis > > sectionize(D2< Piecewise< SBasis > > const &a)
Path cubicbezierpath_from_sbasis(D2< SBasis > const &B, double tol)
Conversion between SBasis and Bezier basis polynomials.