1/* 2 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> 3 * 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 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. 14 * 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. 26 */ 27 28#include "config.h" 29#include "Path.h" 30 31#include "AffineTransform.h" 32#include "FloatRect.h" 33#include "NotImplemented.h" 34#include "PlatformString.h" 35#include <Region.h> 36 37 38namespace WebCore { 39 40Path::Path() 41 : m_path(new BRegion()) 42{ 43} 44 45Path::~Path() 46{ 47 delete m_path; 48} 49 50Path::Path(const Path& other) 51 : m_path(new BRegion(*other.platformPath())) 52{ 53} 54 55Path& Path::operator=(const Path& other) 56{ 57 if (&other != this) 58 m_path = other.platformPath(); 59 60 return *this; 61} 62 63bool Path::hasCurrentPoint() const 64{ 65 return !isEmpty(); 66} 67 68bool Path::contains(const FloatPoint& point, WindRule rule) const 69{ 70 return m_path->Contains(point); 71} 72 73void Path::translate(const FloatSize& size) 74{ 75 notImplemented(); 76} 77 78FloatRect Path::boundingRect() const 79{ 80 return m_path->Frame(); 81} 82 83void Path::moveTo(const FloatPoint& point) 84{ 85 // FIXME: Use OffsetBy? 86 notImplemented(); 87} 88 89void Path::addLineTo(const FloatPoint& p) 90{ 91 notImplemented(); 92} 93 94void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p) 95{ 96 notImplemented(); 97} 98 99void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p) 100{ 101 notImplemented(); 102} 103 104void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) 105{ 106 notImplemented(); 107} 108 109void Path::closeSubpath() 110{ 111 notImplemented(); 112} 113 114void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise) 115{ 116 notImplemented(); 117} 118 119void Path::addRect(const FloatRect& r) 120{ 121 m_path->Include(r); 122} 123 124void Path::addEllipse(const FloatRect& r) 125{ 126 notImplemented(); 127} 128 129void Path::clear() 130{ 131 m_path->MakeEmpty(); 132} 133 134bool Path::isEmpty() const 135{ 136 return !m_path->Frame().IsValid(); 137} 138 139String Path::debugString() const 140{ 141 notImplemented(); 142 return String(); 143} 144 145void Path::apply(void* info, PathApplierFunction function) const 146{ 147 notImplemented(); 148} 149 150void Path::transform(const AffineTransform& transform) 151{ 152 notImplemented(); 153} 154 155FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) 156{ 157 notImplemented(); 158 return FloatRect(); 159} 160 161} // namespace WebCore 162 163