• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

Path.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
00003  *                     2006 Rob Buis <buis@kde.org>
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00015  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00018  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00025  */
00026 
00027 #ifndef Path_h
00028 #define Path_h
00029 
00030 #include "wtf/Platform.h"
00031 
00032 #if PLATFORM(CG)
00033 typedef struct CGPath PlatformPath;
00034 #elif PLATFORM(QT)
00035 #include <qglobal.h>
00036 QT_BEGIN_NAMESPACE
00037 class QPainterPath;
00038 QT_END_NAMESPACE
00039 typedef QPainterPath PlatformPath;
00040 #elif PLATFORM(WX) && USE(WXGC)
00041 class wxGraphicsPath;
00042 typedef wxGraphicsPath PlatformPath;
00043 #elif PLATFORM(CAIRO)
00044 namespace WebCore {
00045     struct CairoPath;
00046 }
00047 typedef WebCore::CairoPath PlatformPath;
00048 #else
00049 typedef void PlatformPath;
00050 #endif
00051 
00052 // for class String
00053 #include "Document.h"
00054 
00055 namespace WebCore {
00056 
00057     class AffineTransform;
00058     class FloatPoint;
00059     class FloatSize;
00060     class FloatRect;
00061     //class String;
00062 
00063     enum WindRule {
00064         RULE_NONZERO = 0,
00065         RULE_EVENODD = 1
00066     };
00067 
00068     enum PathElementType {
00069         PathElementMoveToPoint,
00070         PathElementAddLineToPoint,
00071         PathElementAddQuadCurveToPoint,
00072         PathElementAddCurveToPoint,
00073         PathElementCloseSubpath
00074     };
00075 
00076     struct PathElement {
00077         PathElementType type;
00078         FloatPoint* points;
00079     };
00080 
00081     typedef void (*PathApplierFunction) (void* info, const PathElement*);
00082 
00083     class Path {
00084     public:
00085         Path();
00086         ~Path();
00087 
00088         Path(const Path&);
00089         Path& operator=(const Path&);
00090 
00091         bool contains(const FloatPoint&, WindRule rule = RULE_NONZERO) const;
00092         FloatRect boundingRect() const;
00093         
00094         float length();
00095         FloatPoint pointAtLength(float length, bool& ok);
00096         float normalAngleAtLength(float length, bool& ok);
00097 
00098         void clear();
00099         bool isEmpty() const;
00100 
00101         void moveTo(const FloatPoint&);
00102         void addLineTo(const FloatPoint&);
00103         void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& point);
00104         void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint&);
00105         void addArcTo(const FloatPoint&, const FloatPoint&, float radius);
00106         void closeSubpath();
00107 
00108         void addArc(const FloatPoint&, float radius, float startAngle, float endAngle, bool anticlockwise);
00109         void addRect(const FloatRect&);
00110         void addEllipse(const FloatRect&);
00111 
00112         void translate(const FloatSize&);
00113 
00114         void setWindingRule(WindRule rule) { m_rule = rule; }
00115         WindRule windingRule() const { return m_rule; }
00116 
00117         String debugString() const;
00118 
00119         PlatformPath* platformPath() const { return m_path; }
00120 
00121         static Path createRoundedRectangle(const FloatRect&, const FloatSize& roundingRadii);
00122         static Path createRoundedRectangle(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
00123         static Path createRectangle(const FloatRect&);
00124         static Path createEllipse(const FloatPoint& center, float rx, float ry);
00125         static Path createCircle(const FloatPoint& center, float r);
00126         static Path createLine(const FloatPoint&, const FloatPoint&);
00127 
00128         void apply(void* info, PathApplierFunction) const;
00129         void transform(const AffineTransform&);
00130 
00131     private:
00132         PlatformPath* m_path;
00133         WindRule m_rule;
00134     };
00135 
00136 }
00137 
00138 #endif

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal