cairo-path-sink.cpp revision 76addc201c409e81eaaa73fe27cc0f79c4db097c
/**
* @file
* @brief Path sink for Cairo contexts
*//*
* Copyright 2014 Krzysztof KosiĆski
*
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, output to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
*/
#include <cairo.h>
namespace Geom {
{}
{
cairo_move_to(_cr, p[X], p[Y]);
_current_point = p;
}
{
cairo_line_to(_cr, p[X], p[Y]);
_current_point = p;
}
{
_current_point = p3;
}
{
// degree-elevate to cubic Bezier, since Cairo doesn't do quad Beziers
// google "Bezier degree elevation" for more info
// q3 = p2
_current_point = p2;
}
{
// Cairo only does circular arcs.
// To do elliptical arcs, we must use a temporary transform.
// TODO move Cairo-2Geom matrix conversion into a common location
if (sweep) {
} else {
}
_current_point = p;
/* Note that an extra linear segment will be inserted before the arc
* if Cairo considers the current point distinct from the initial point
* of the arc; we could partially alleviate this by not emitting
* linear segments that are followed by arc segments, but this would require
* buffering the input curves. */
}
void CairoPathSink::closePath()
{
}
void CairoPathSink::flush() {}
} // namespace Geom
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :