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 "third_party/skia/include/core/SkPaint.h"
     30 
     31 #include "wtf/Forward.h"
     32 
     33 namespace WebCore {
     34 
     35 enum StrokeStyle {
     36     NoStroke,
     37     SolidStroke,
     38     DottedStroke,
     39     DashedStroke,
     40     DoubleStroke,
     41     WavyStroke,
     42 };
     43 
     44 enum InterpolationQuality {
     45     InterpolationDefault,
     46     InterpolationNone,
     47     InterpolationLow,
     48     InterpolationMedium,
     49     InterpolationHigh
     50 };
     51 
     52 enum CompositeOperator {
     53     CompositeClear,
     54     CompositeCopy,
     55     CompositeSourceOver,
     56     CompositeSourceIn,
     57     CompositeSourceOut,
     58     CompositeSourceAtop,
     59     CompositeDestinationOver,
     60     CompositeDestinationIn,
     61     CompositeDestinationOut,
     62     CompositeDestinationAtop,
     63     CompositeXOR,
     64     CompositePlusDarker,
     65     CompositePlusLighter,
     66     CompositeDifference
     67 };
     68 
     69 // keep it in sync with gMapBlendOpsToXfermodeModes array in SkiaUtils.h
     70 enum BlendMode {
     71     BlendModeNormal,
     72     BlendModeMultiply,
     73     BlendModeScreen,
     74     BlendModeOverlay,
     75     BlendModeDarken,
     76     BlendModeLighten,
     77     BlendModeColorDodge,
     78     BlendModeColorBurn,
     79     BlendModeHardLight,
     80     BlendModeSoftLight,
     81     BlendModeDifference,
     82     BlendModeExclusion,
     83     BlendModeHue,
     84     BlendModeSaturation,
     85     BlendModeColor,
     86     BlendModeLuminosity
     87 };
     88 
     89 enum GradientSpreadMethod {
     90     SpreadMethodPad,
     91     SpreadMethodReflect,
     92     SpreadMethodRepeat
     93 };
     94 
     95 enum LineCap {
     96     ButtCap = SkPaint::kButt_Cap,
     97     RoundCap = SkPaint::kRound_Cap,
     98     SquareCap = SkPaint::kSquare_Cap
     99 };
    100 
    101 enum LineJoin {
    102     MiterJoin = SkPaint::kMiter_Join,
    103     RoundJoin = SkPaint::kRound_Join,
    104     BevelJoin = SkPaint::kBevel_Join
    105 };
    106 
    107 enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
    108 
    109 enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
    110 
    111 enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
    112 
    113 enum TextDrawingMode {
    114     TextModeFill      = 1 << 0,
    115     TextModeStroke    = 1 << 1,
    116 };
    117 typedef unsigned TextDrawingModeFlags;
    118 
    119 String compositeOperatorName(CompositeOperator, BlendMode);
    120 bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, BlendMode&);
    121 
    122 String lineCapName(LineCap);
    123 bool parseLineCap(const String&, LineCap&);
    124 
    125 String lineJoinName(LineJoin);
    126 bool parseLineJoin(const String&, LineJoin&);
    127 
    128 String textAlignName(TextAlign);
    129 bool parseTextAlign(const String&, TextAlign&);
    130 
    131 String textBaselineName(TextBaseline);
    132 bool parseTextBaseline(const String&, TextBaseline&);
    133 
    134 } // namespace WebCore
    135 
    136 #endif
    137