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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GRAPHICS_TYPES_H_ 27 #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GRAPHICS_TYPES_H_ 28 29 #include "third_party/blink/renderer/platform/platform_export.h" 30 #include "third_party/blink/renderer/platform/wtf/forward.h" 31 #include "third_party/skia/include/core/SkFilterQuality.h" 32 #include "third_party/skia/include/core/SkPaint.h" 33 #include "third_party/skia/include/core/SkPath.h" 34 35 namespace blink { 36 37 enum AlphaDisposition { 38 kPremultiplyAlpha, 39 kUnpremultiplyAlpha, 40 kDontChangeAlpha, 41 }; 42 43 enum DataU8ColorType { 44 kRGBAColorType, 45 kN32ColorType, 46 }; 47 48 enum ImageDataStorageFormat { 49 kUint8ClampedArrayStorageFormat, 50 kUint16ArrayStorageFormat, 51 kFloat32ArrayStorageFormat, 52 }; 53 54 enum ImageEncodingMimeType { 55 kMimeTypePng, 56 kMimeTypeJpeg, 57 kMimeTypeWebp, 58 }; 59 60 enum StrokeStyle { 61 kNoStroke, 62 kSolidStroke, 63 kDottedStroke, 64 kDashedStroke, 65 kDoubleStroke, 66 kWavyStroke, 67 }; 68 69 enum InterpolationQuality { 70 kInterpolationNone = kNone_SkFilterQuality, 71 kInterpolationLow = kLow_SkFilterQuality, 72 kInterpolationMedium = kMedium_SkFilterQuality, 73 #if defined(WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION) 74 kInterpolationDefault = kInterpolationLow, 75 #else 76 kInterpolationDefault = kInterpolationMedium, 77 #endif 78 }; 79 80 enum CompositeOperator { 81 kCompositeClear, 82 kCompositeCopy, 83 kCompositeSourceOver, 84 kCompositeSourceIn, 85 kCompositeSourceOut, 86 kCompositeSourceAtop, 87 kCompositeDestinationOver, 88 kCompositeDestinationIn, 89 kCompositeDestinationOut, 90 kCompositeDestinationAtop, 91 kCompositeXOR, 92 kCompositePlusLighter 93 }; 94 95 enum class BlendMode { 96 kNormal, 97 kMultiply, 98 kScreen, 99 kOverlay, 100 kDarken, 101 kLighten, 102 kColorDodge, 103 kColorBurn, 104 kHardLight, 105 kSoftLight, 106 kDifference, 107 kExclusion, 108 kHue, 109 kSaturation, 110 kColor, 111 kLuminosity, 112 }; 113 114 enum OpacityMode { 115 kNonOpaque, 116 kOpaque, 117 }; 118 119 enum AccelerationHint { 120 kPreferAcceleration, 121 // The PreferAccelerationAfterVisibilityChange hint suggests we should switch 122 // back to acceleration in the context of the canvas becoming visible again. 123 kPreferAccelerationAfterVisibilityChange, 124 kPreferNoAcceleration, 125 }; 126 127 enum MailboxSyncMode { 128 kVerifiedSyncToken, 129 kUnverifiedSyncToken, 130 kOrderingBarrier, 131 }; 132 133 enum class DarkModeClassification { 134 kNotClassified, 135 kApplyFilter, 136 kDoNotApplyFilter, 137 }; 138 139 // TODO(junov): crbug.com/453113 Relocate ShadowMode to 140 // CanvasRenderingContext2DState.h once GraphicsContext no longer uses it. 141 enum ShadowMode { 142 kDrawShadowAndForeground, 143 kDrawShadowOnly, 144 kDrawForegroundOnly 145 }; 146 147 enum AntiAliasingMode { kNotAntiAliased, kAntiAliased }; 148 149 enum GradientSpreadMethod { 150 kSpreadMethodPad, 151 kSpreadMethodReflect, 152 kSpreadMethodRepeat 153 }; 154 155 enum LineCap { 156 kButtCap = SkPaint::kButt_Cap, 157 kRoundCap = SkPaint::kRound_Cap, 158 kSquareCap = SkPaint::kSquare_Cap 159 }; 160 161 enum LineJoin { 162 kMiterJoin = SkPaint::kMiter_Join, 163 kRoundJoin = SkPaint::kRound_Join, 164 kBevelJoin = SkPaint::kBevel_Join 165 }; 166 167 enum HorizontalAlignment { kAlignLeft, kAlignRight, kAlignHCenter }; 168 169 enum TextBaseline { 170 kAlphabeticTextBaseline, 171 kTopTextBaseline, 172 kMiddleTextBaseline, 173 kBottomTextBaseline, 174 kIdeographicTextBaseline, 175 kHangingTextBaseline 176 }; 177 178 enum TextAlign { 179 kStartTextAlign, 180 kEndTextAlign, 181 kLeftTextAlign, 182 kCenterTextAlign, 183 kRightTextAlign 184 }; 185 186 enum TextDrawingMode { 187 kTextModeFill = 1 << 0, 188 kTextModeStroke = 1 << 1, 189 }; 190 typedef unsigned TextDrawingModeFlags; 191 192 enum ColorFilter { 193 kColorFilterNone, 194 kColorFilterLuminanceToAlpha, 195 kColorFilterSRGBToLinearRGB, 196 kColorFilterLinearRGBToSRGB 197 }; 198 199 enum WindRule { 200 RULE_NONZERO = static_cast<int>(SkPathFillType::kWinding), 201 RULE_EVENODD = static_cast<int>(SkPathFillType::kEvenOdd) 202 }; 203 204 PLATFORM_EXPORT String CompositeOperatorName(CompositeOperator, BlendMode); 205 PLATFORM_EXPORT bool ParseCompositeAndBlendMode(const String&, 206 CompositeOperator&, 207 BlendMode&); 208 209 PLATFORM_EXPORT String ImageEncodingMimeTypeName(ImageEncodingMimeType); 210 PLATFORM_EXPORT bool ParseImageEncodingMimeType(const String&, 211 ImageEncodingMimeType&); 212 213 PLATFORM_EXPORT String LineCapName(LineCap); 214 PLATFORM_EXPORT bool ParseLineCap(const String&, LineCap&); 215 216 PLATFORM_EXPORT String LineJoinName(LineJoin); 217 PLATFORM_EXPORT bool ParseLineJoin(const String&, LineJoin&); 218 219 PLATFORM_EXPORT String TextAlignName(TextAlign); 220 PLATFORM_EXPORT bool ParseTextAlign(const String&, TextAlign&); 221 222 PLATFORM_EXPORT String TextBaselineName(TextBaseline); 223 PLATFORM_EXPORT bool ParseTextBaseline(const String&, TextBaseline&); 224 225 } // namespace blink 226 227 #endif 228