• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "wtf/Forward.h"
33 
34 namespace WebCore {
35 
36 enum StrokeStyle {
37     NoStroke,
38     SolidStroke,
39     DottedStroke,
40     DashedStroke,
41     DoubleStroke,
42     WavyStroke,
43 };
44 
45 enum InterpolationQuality {
46     InterpolationDefault,
47     InterpolationNone,
48     InterpolationLow,
49     InterpolationMedium,
50     InterpolationHigh
51 };
52 
53 enum CompositeOperator {
54     CompositeClear,
55     CompositeCopy,
56     CompositeSourceOver,
57     CompositeSourceIn,
58     CompositeSourceOut,
59     CompositeSourceAtop,
60     CompositeDestinationOver,
61     CompositeDestinationIn,
62     CompositeDestinationOut,
63     CompositeDestinationAtop,
64     CompositeXOR,
65     CompositePlusDarker,
66     CompositePlusLighter,
67     CompositeDifference
68 };
69 
70 enum GradientSpreadMethod {
71     SpreadMethodPad,
72     SpreadMethodReflect,
73     SpreadMethodRepeat
74 };
75 
76 enum LineCap {
77     ButtCap = SkPaint::kButt_Cap,
78     RoundCap = SkPaint::kRound_Cap,
79     SquareCap = SkPaint::kSquare_Cap
80 };
81 
82 enum LineJoin {
83     MiterJoin = SkPaint::kMiter_Join,
84     RoundJoin = SkPaint::kRound_Join,
85     BevelJoin = SkPaint::kBevel_Join
86 };
87 
88 enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
89 
90 enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
91 
92 enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
93 
94 enum TextDrawingMode {
95     TextModeFill      = 1 << 0,
96     TextModeStroke    = 1 << 1,
97 };
98 typedef unsigned TextDrawingModeFlags;
99 
100 enum ColorFilter {
101     ColorFilterNone,
102     ColorFilterLuminanceToAlpha,
103     ColorFilterSRGBToLinearRGB,
104     ColorFilterLinearRGBToSRGB
105 };
106 
107 PLATFORM_EXPORT String compositeOperatorName(CompositeOperator, blink::WebBlendMode);
108 PLATFORM_EXPORT bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, blink::WebBlendMode&);
109 
110 PLATFORM_EXPORT String lineCapName(LineCap);
111 PLATFORM_EXPORT bool parseLineCap(const String&, LineCap&);
112 
113 PLATFORM_EXPORT String lineJoinName(LineJoin);
114 PLATFORM_EXPORT bool parseLineJoin(const String&, LineJoin&);
115 
116 PLATFORM_EXPORT String textAlignName(TextAlign);
117 PLATFORM_EXPORT bool parseTextAlign(const String&, TextAlign&);
118 
119 PLATFORM_EXPORT String textBaselineName(TextBaseline);
120 PLATFORM_EXPORT bool parseTextBaseline(const String&, TextBaseline&);
121 
122 } // namespace WebCore
123 
124 #endif
125