Home | History | Annotate | Download | only in graphics
      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     InterpolationNone = SkPaint::kNone_FilterLevel,
     47     InterpolationLow = SkPaint::kLow_FilterLevel,
     48     InterpolationMedium = SkPaint::kMedium_FilterLevel,
     49     InterpolationHigh = SkPaint::kHigh_FilterLevel,
     50 #if USE(LOW_QUALITY_IMAGE_INTERPOLATION)
     51     InterpolationDefault = InterpolationLow,
     52 #else
     53     InterpolationDefault = InterpolationHigh,
     54 #endif
     55 };
     56 
     57 enum CompositeOperator {
     58     CompositeClear,
     59     CompositeCopy,
     60     CompositeSourceOver,
     61     CompositeSourceIn,
     62     CompositeSourceOut,
     63     CompositeSourceAtop,
     64     CompositeDestinationOver,
     65     CompositeDestinationIn,
     66     CompositeDestinationOut,
     67     CompositeDestinationAtop,
     68     CompositeXOR,
     69     CompositePlusDarker,
     70     CompositePlusLighter,
     71     CompositeDifference
     72 };
     73 
     74 enum GradientSpreadMethod {
     75     SpreadMethodPad,
     76     SpreadMethodReflect,
     77     SpreadMethodRepeat
     78 };
     79 
     80 enum LineCap {
     81     ButtCap = SkPaint::kButt_Cap,
     82     RoundCap = SkPaint::kRound_Cap,
     83     SquareCap = SkPaint::kSquare_Cap
     84 };
     85 
     86 enum LineJoin {
     87     MiterJoin = SkPaint::kMiter_Join,
     88     RoundJoin = SkPaint::kRound_Join,
     89     BevelJoin = SkPaint::kBevel_Join
     90 };
     91 
     92 enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
     93 
     94 enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
     95 
     96 enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
     97 
     98 enum TextDrawingMode {
     99     TextModeFill      = 1 << 0,
    100     TextModeStroke    = 1 << 1,
    101 };
    102 typedef unsigned TextDrawingModeFlags;
    103 
    104 enum ColorFilter {
    105     ColorFilterNone,
    106     ColorFilterLuminanceToAlpha,
    107     ColorFilterSRGBToLinearRGB,
    108     ColorFilterLinearRGBToSRGB
    109 };
    110 
    111 PLATFORM_EXPORT String compositeOperatorName(CompositeOperator, blink::WebBlendMode);
    112 PLATFORM_EXPORT bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, blink::WebBlendMode&);
    113 
    114 PLATFORM_EXPORT String lineCapName(LineCap);
    115 PLATFORM_EXPORT bool parseLineCap(const String&, LineCap&);
    116 
    117 PLATFORM_EXPORT String lineJoinName(LineJoin);
    118 PLATFORM_EXPORT bool parseLineJoin(const String&, LineJoin&);
    119 
    120 PLATFORM_EXPORT String textAlignName(TextAlign);
    121 PLATFORM_EXPORT bool parseTextAlign(const String&, TextAlign&);
    122 
    123 PLATFORM_EXPORT String textBaselineName(TextBaseline);
    124 PLATFORM_EXPORT bool parseTextBaseline(const String&, TextBaseline&);
    125 
    126 } // namespace WebCore
    127 
    128 #endif
    129