2 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "AffineTransform.h"
32 #include "FloatRect.h"
33 #include "NotImplemented.h"
34 #include "PlatformString.h"
41 : m_path(new BRegion())
50 Path::Path(const Path& other)
51 : m_path(new BRegion(*other.platformPath()))
55 Path& Path::operator=(const Path& other)
58 m_path = other.platformPath();
63 bool Path::hasCurrentPoint() const
68 FloatPoint Path::currentPoint() const
70 // FIXME: implement safe way to return current point of subpath.
72 float quietNaN = std::numeric_limits<float>::quiet_NaN();
73 return FloatPoint(quietNaN, quietNaN);
76 bool Path::contains(const FloatPoint& point, WindRule rule) const
78 return m_path->Contains(point);
81 void Path::translate(const FloatSize& size)
86 FloatRect Path::boundingRect() const
88 return m_path->Frame();
91 void Path::moveTo(const FloatPoint& point)
93 // FIXME: Use OffsetBy?
97 void Path::addLineTo(const FloatPoint& p)
102 void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p)
107 void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p)
112 void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
117 void Path::closeSubpath()
122 void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise)
127 void Path::addRect(const FloatRect& r)
132 void Path::addEllipse(const FloatRect& r)
142 bool Path::isEmpty() const
144 return !m_path->Frame().IsValid();
147 void Path::apply(void* info, PathApplierFunction function) const
152 void Path::transform(const AffineTransform& transform)
157 FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
163 } // namespace WebCore