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

KHTML

GraphicsTypes.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  * 1. Redistributions of source code must retain the above copyright
00008  *    notice, this list of conditions and the following disclaimer.
00009  * 2. Redistributions in binary form must reproduce the above copyright
00010  *    notice, this list of conditions and the following disclaimer in the
00011  *    documentation and/or other materials provided with the distribution.
00012  *
00013  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00014  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00015  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00017  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00018  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00019  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00020  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00021  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00022  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00023  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00024  */
00025 
00026 #include "config.h"
00027 #include "GraphicsTypes.h"
00028 
00029 #include "PlatformString.h"
00030 #include <wtf/Assertions.h>
00031 
00032 namespace khtml {
00033 
00034 static const char* const compositeOperatorNames[] = {
00035     "clear",
00036     "copy",
00037     "source-over",
00038     "source-in",
00039     "source-out",
00040     "source-atop",
00041     "destination-over",
00042     "destination-in",
00043     "destination-out",
00044     "destination-atop",
00045     "xor",
00046     "darker",
00047     "highlight",
00048     "lighter"
00049 };
00050 const int numCompositeOperatorNames = sizeof(compositeOperatorNames) / sizeof(compositeOperatorNames[0]);
00051 
00052 bool parseCompositeOperator(const DOM::DOMString& s, CompositeOperator& op)
00053 {
00054     for (int i = 0; i < numCompositeOperatorNames; i++)
00055         if (s == compositeOperatorNames[i]) {
00056             op = static_cast<CompositeOperator>(i);
00057             return true;
00058         }
00059     return false;
00060 }
00061 
00062 DOM::DOMString compositeOperatorName(CompositeOperator op)
00063 {
00064     ASSERT(op >= 0);
00065     ASSERT(op < numCompositeOperatorNames);
00066     return compositeOperatorNames[op];
00067 }
00068 
00069 bool parseLineCap(const DOM::DOMString& s, LineCap& cap)
00070 {
00071     if (s == "butt") {
00072         cap = ButtCap;
00073         return true;
00074     }
00075     if (s == "round") {
00076         cap = RoundCap;
00077         return true;
00078     }
00079     if (s == "square") {
00080         cap = SquareCap;
00081         return true;
00082     }
00083     return false;
00084 }
00085 
00086 DOM::DOMString lineCapName(LineCap cap)
00087 {
00088     ASSERT(cap >= 0);
00089     ASSERT(cap < 3);
00090     const char* const names[3] = { "butt", "round", "square" };
00091     return names[cap];
00092 }
00093 
00094 bool parseLineJoin(const DOM::DOMString& s, LineJoin& join)
00095 {
00096     if (s == "miter") {
00097         join = MiterJoin;
00098         return true;
00099     }
00100     if (s == "round") {
00101         join = RoundJoin;
00102         return true;
00103     }
00104     if (s == "bevel") {
00105         join = BevelJoin;
00106         return true;
00107     }
00108     return false;
00109 }
00110 
00111 DOM::DOMString lineJoinName(LineJoin join)
00112 {
00113     ASSERT(join >= 0);
00114     ASSERT(join < 3);
00115     const char* const names[3] = { "miter", "round", "bevel" };
00116     return names[join];
00117 }
00118 
00119 }

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
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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