]> git.saurik.com Git - iphone-api.git/blob - WebCore/GraphicsContextPrivate.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / GraphicsContextPrivate.h
1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef GraphicsContextPrivate_h
27 #define GraphicsContextPrivate_h
28
29 #include "TransformationMatrix.h"
30 #include "Gradient.h"
31 #include "GraphicsContext.h"
32 #include "Pattern.h"
33
34 namespace WebCore {
35
36 // FIXME: This is a place-holder until we decide to add
37 // real color space support to WebCore. At that time, ColorSpace will be a
38 // class and instances will be held off of Colors. There will be
39 // special singleton Gradient and Pattern color spaces to mark when
40 // a fill or stroke is using a gradient or pattern instead of a solid color.
41 // https://bugs.webkit.org/show_bug.cgi?id=20558
42 enum ColorSpace {
43 SolidColorSpace,
44 PatternColorSpace,
45 GradientColorSpace
46 };
47
48 struct GraphicsContextState {
49 GraphicsContextState()
50 : textDrawingMode(cTextFill)
51 , strokeStyle(SolidStroke)
52 , strokeThickness(0)
53 #if PLATFORM(CAIRO)
54 , globalAlpha(1.0f)
55 #endif
56 , strokeColorSpace(SolidColorSpace)
57 , strokeColor(Color::black)
58 , fillRule(RULE_NONZERO)
59 , fillColorSpace(SolidColorSpace)
60 , fillColor(Color::black)
61 , shouldAntialias(true)
62 , paintingDisabled(false)
63 , shadowBlur(0)
64 , shadowsIgnoreTransforms(false)
65 , emojiDrawingEnabled(true)
66 {
67 }
68
69 int textDrawingMode;
70
71 StrokeStyle strokeStyle;
72 float strokeThickness;
73 #if PLATFORM(CAIRO)
74 float globalAlpha;
75 #elif PLATFORM(QT)
76 TransformationMatrix pathTransform;
77 #endif
78 ColorSpace strokeColorSpace;
79 Color strokeColor;
80 RefPtr<Gradient> strokeGradient;
81 RefPtr<Pattern> strokePattern;
82
83 WindRule fillRule;
84 GradientSpreadMethod spreadMethod;
85 ColorSpace fillColorSpace;
86 Color fillColor;
87 RefPtr<Gradient> fillGradient;
88 RefPtr<Pattern> fillPattern;
89
90 bool shouldAntialias;
91
92 bool paintingDisabled;
93
94 IntSize shadowSize;
95 unsigned shadowBlur;
96 Color shadowColor;
97
98 bool shadowsIgnoreTransforms;
99
100 bool emojiDrawingEnabled;
101 };
102
103 class GraphicsContextPrivate {
104 public:
105 GraphicsContextPrivate()
106 : m_focusRingWidth(0)
107 , m_focusRingOffset(0)
108 , m_updatingControlTints(false)
109 {
110 }
111
112 GraphicsContextState state;
113 Vector<GraphicsContextState> stack;
114 Vector<IntRect> m_focusRingRects;
115 int m_focusRingWidth;
116 int m_focusRingOffset;
117 bool m_updatingControlTints;
118 };
119
120 } // namespace WebCore
121
122 #endif // GraphicsContextPrivate_h