Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / graphics / GraphicsTypes.h
1 /*
2  * Copyright (C) 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 GraphicsTypes_h
27 #define GraphicsTypes_h
28
29 #include "platform/PlatformExport.h"
30 #include "public/platform/WebBlendMode.h"
31 #include "third_party/skia/include/core/SkPaint.h"
32 #include "third_party/skia/include/core/SkPath.h"
33 #include "wtf/Forward.h"
34
35 namespace blink {
36
37 enum StrokeStyle {
38     NoStroke,
39     SolidStroke,
40     DottedStroke,
41     DashedStroke,
42     DoubleStroke,
43     WavyStroke,
44 };
45
46 enum InterpolationQuality {
47     InterpolationNone = SkPaint::kNone_FilterLevel,
48     InterpolationLow = SkPaint::kLow_FilterLevel,
49     InterpolationMedium = SkPaint::kMedium_FilterLevel,
50     InterpolationHigh = SkPaint::kHigh_FilterLevel,
51 #if USE(LOW_QUALITY_IMAGE_INTERPOLATION)
52     InterpolationDefault = InterpolationLow,
53 #else
54     InterpolationDefault = InterpolationHigh,
55 #endif
56 };
57
58 enum CompositeOperator {
59     CompositeClear,
60     CompositeCopy,
61     CompositeSourceOver,
62     CompositeSourceIn,
63     CompositeSourceOut,
64     CompositeSourceAtop,
65     CompositeDestinationOver,
66     CompositeDestinationIn,
67     CompositeDestinationOut,
68     CompositeDestinationAtop,
69     CompositeXOR,
70     CompositePlusDarker,
71     CompositePlusLighter,
72     CompositeDifference
73 };
74
75 enum ShadowMode {
76     DrawShadowAndForeground,
77     DrawShadowOnly,
78 };
79
80 enum GradientSpreadMethod {
81     SpreadMethodPad,
82     SpreadMethodReflect,
83     SpreadMethodRepeat
84 };
85
86 enum LineCap {
87     ButtCap = SkPaint::kButt_Cap,
88     RoundCap = SkPaint::kRound_Cap,
89     SquareCap = SkPaint::kSquare_Cap
90 };
91
92 enum LineJoin {
93     MiterJoin = SkPaint::kMiter_Join,
94     RoundJoin = SkPaint::kRound_Join,
95     BevelJoin = SkPaint::kBevel_Join
96 };
97
98 enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
99
100 enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
101
102 enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
103
104 enum TextDrawingMode {
105     TextModeFill      = 1 << 0,
106     TextModeStroke    = 1 << 1,
107 };
108 typedef unsigned TextDrawingModeFlags;
109
110 enum ColorFilter {
111     ColorFilterNone,
112     ColorFilterLuminanceToAlpha,
113     ColorFilterSRGBToLinearRGB,
114     ColorFilterLinearRGBToSRGB
115 };
116
117 enum WindRule {
118     RULE_NONZERO = SkPath::kWinding_FillType,
119     RULE_EVENODD = SkPath::kEvenOdd_FillType
120 };
121
122 PLATFORM_EXPORT String compositeOperatorName(CompositeOperator, WebBlendMode);
123 PLATFORM_EXPORT bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, WebBlendMode&);
124
125 PLATFORM_EXPORT String lineCapName(LineCap);
126 PLATFORM_EXPORT bool parseLineCap(const String&, LineCap&);
127
128 PLATFORM_EXPORT String lineJoinName(LineJoin);
129 PLATFORM_EXPORT bool parseLineJoin(const String&, LineJoin&);
130
131 PLATFORM_EXPORT String textAlignName(TextAlign);
132 PLATFORM_EXPORT bool parseTextAlign(const String&, TextAlign&);
133
134 PLATFORM_EXPORT String textBaselineName(TextBaseline);
135 PLATFORM_EXPORT bool parseTextBaseline(const String&, TextBaseline&);
136
137 } // namespace blink
138
139 #endif