2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #ifndef GraphicsTypes_h
27 #define GraphicsTypes_h
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"
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,
54 InterpolationDefault = InterpolationHigh,
58 enum CompositeOperator {
65 CompositeDestinationOver,
66 CompositeDestinationIn,
67 CompositeDestinationOut,
68 CompositeDestinationAtop,
76 DrawShadowAndForeground,
80 enum GradientSpreadMethod {
87 ButtCap = SkPaint::kButt_Cap,
88 RoundCap = SkPaint::kRound_Cap,
89 SquareCap = SkPaint::kSquare_Cap
93 MiterJoin = SkPaint::kMiter_Join,
94 RoundJoin = SkPaint::kRound_Join,
95 BevelJoin = SkPaint::kBevel_Join
98 enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
100 enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
102 enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
104 enum TextDrawingMode {
105 TextModeFill = 1 << 0,
106 TextModeStroke = 1 << 1,
108 typedef unsigned TextDrawingModeFlags;
112 ColorFilterLuminanceToAlpha,
113 ColorFilterSRGBToLinearRGB,
114 ColorFilterLinearRGBToSRGB
118 RULE_NONZERO = SkPath::kWinding_FillType,
119 RULE_EVENODD = SkPath::kEvenOdd_FillType
122 PLATFORM_EXPORT String compositeOperatorName(CompositeOperator, WebBlendMode);
123 PLATFORM_EXPORT bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, WebBlendMode&);
125 PLATFORM_EXPORT String lineCapName(LineCap);
126 PLATFORM_EXPORT bool parseLineCap(const String&, LineCap&);
128 PLATFORM_EXPORT String lineJoinName(LineJoin);
129 PLATFORM_EXPORT bool parseLineJoin(const String&, LineJoin&);
131 PLATFORM_EXPORT String textAlignName(TextAlign);
132 PLATFORM_EXPORT bool parseTextAlign(const String&, TextAlign&);
134 PLATFORM_EXPORT String textBaselineName(TextBaseline);
135 PLATFORM_EXPORT bool parseTextBaseline(const String&, TextBaseline&);