• 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 "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 GradientSpreadMethod {
76     SpreadMethodPad,
77     SpreadMethodReflect,
78     SpreadMethodRepeat
79 };
80 
81 enum LineCap {
82     ButtCap = SkPaint::kButt_Cap,
83     RoundCap = SkPaint::kRound_Cap,
84     SquareCap = SkPaint::kSquare_Cap
85 };
86 
87 enum LineJoin {
88     MiterJoin = SkPaint::kMiter_Join,
89     RoundJoin = SkPaint::kRound_Join,
90     BevelJoin = SkPaint::kBevel_Join
91 };
92 
93 enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
94 
95 enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
96 
97 enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
98 
99 enum TextDrawingMode {
100     TextModeFill      = 1 << 0,
101     TextModeStroke    = 1 << 1,
102 };
103 typedef unsigned TextDrawingModeFlags;
104 
105 enum ColorFilter {
106     ColorFilterNone,
107     ColorFilterLuminanceToAlpha,
108     ColorFilterSRGBToLinearRGB,
109     ColorFilterLinearRGBToSRGB
110 };
111 
112 enum WindRule {
113     RULE_NONZERO = SkPath::kWinding_FillType,
114     RULE_EVENODD = SkPath::kEvenOdd_FillType
115 };
116 
117 PLATFORM_EXPORT String compositeOperatorName(CompositeOperator, WebBlendMode);
118 PLATFORM_EXPORT bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, WebBlendMode&);
119 
120 PLATFORM_EXPORT String lineCapName(LineCap);
121 PLATFORM_EXPORT bool parseLineCap(const String&, LineCap&);
122 
123 PLATFORM_EXPORT String lineJoinName(LineJoin);
124 PLATFORM_EXPORT bool parseLineJoin(const String&, LineJoin&);
125 
126 PLATFORM_EXPORT String textAlignName(TextAlign);
127 PLATFORM_EXPORT bool parseTextAlign(const String&, TextAlign&);
128 
129 PLATFORM_EXPORT String textBaselineName(TextBaseline);
130 PLATFORM_EXPORT bool parseTextBaseline(const String&, TextBaseline&);
131 
132 } // namespace blink
133 
134 #endif
135