1/*
2 * Copyright (C) 2004, 2005, 2006 Apple 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 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 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#pragma once
27
28#include "WindRule.h"
29#include <wtf/Forward.h>
30
31namespace WTF {
32class TextStream;
33}
34
35namespace WebCore {
36
37enum CompositeOperator {
38 CompositeClear,
39 CompositeCopy,
40 CompositeSourceOver,
41 CompositeSourceIn,
42 CompositeSourceOut,
43 CompositeSourceAtop,
44 CompositeDestinationOver,
45 CompositeDestinationIn,
46 CompositeDestinationOut,
47 CompositeDestinationAtop,
48 CompositeXOR,
49 CompositePlusDarker,
50 CompositePlusLighter,
51 CompositeDifference
52};
53
54enum class BlendMode {
55 Normal = 1, // Start with 1 to match SVG's blendmode enumeration.
56 Multiply,
57 Screen,
58 Darken,
59 Lighten,
60 Overlay,
61 ColorDodge,
62 ColorBurn,
63 HardLight,
64 SoftLight,
65 Difference,
66 Exclusion,
67 Hue,
68 Saturation,
69 Color,
70 Luminosity,
71 PlusDarker,
72 PlusLighter
73};
74
75enum GradientSpreadMethod {
76 SpreadMethodPad,
77 SpreadMethodReflect,
78 SpreadMethodRepeat
79};
80
81enum InterpolationQuality {
82 InterpolationDefault,
83 InterpolationNone,
84 InterpolationLow,
85 InterpolationMedium,
86 InterpolationHigh
87};
88
89enum LineCap {
90 ButtCap,
91 RoundCap,
92 SquareCap
93};
94
95enum LineJoin {
96 MiterJoin,
97 RoundJoin,
98 BevelJoin
99};
100
101enum HorizontalAlignment {
102 AlignLeft,
103 AlignRight,
104 AlignHCenter
105};
106
107enum TextBaseline {
108 AlphabeticTextBaseline,
109 TopTextBaseline,
110 MiddleTextBaseline,
111 BottomTextBaseline,
112 IdeographicTextBaseline,
113 HangingTextBaseline
114};
115
116enum TextAlign {
117 StartTextAlign,
118 EndTextAlign,
119 LeftTextAlign,
120 CenterTextAlign,
121 RightTextAlign
122};
123
124enum RenderingMode {
125 Unaccelerated,
126 UnacceleratedNonPlatformBuffer, // Use plain memory allocation rather than platform API to allocate backing store.
127 Accelerated
128};
129
130enum class AlphaPremultiplication {
131 Premultiplied,
132 Unpremultiplied
133};
134
135String compositeOperatorName(CompositeOperator, BlendMode);
136String blendModeName(BlendMode);
137bool parseBlendMode(const String&, BlendMode&);
138bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, BlendMode&);
139
140WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, BlendMode);
141WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, CompositeOperator);
142WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, WindRule);
143WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, LineCap);
144WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, LineJoin);
145WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, AlphaPremultiplication);
146
147} // namespace WebCore
148
149