| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2006 The Android Open Source Project | 2  * Copyright 2006 The Android Open Source Project | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #ifndef SkGradientShader_DEFINED | 8 #ifndef SkGradientShader_DEFINED | 
| 9 #define SkGradientShader_DEFINED | 9 #define SkGradientShader_DEFINED | 
| 10 | 10 | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 45         @param  mode    The tiling mode | 45         @param  mode    The tiling mode | 
| 46         @param  mapper  May be NULL. Callback to modify the spread of the colors
     . | 46         @param  mapper  May be NULL. Callback to modify the spread of the colors
     . | 
| 47     */ | 47     */ | 
| 48     static SkShader* CreateLinear(const SkPoint pts[2], | 48     static SkShader* CreateLinear(const SkPoint pts[2], | 
| 49                                   const SkColor colors[], const SkScalar pos[], 
     int count, | 49                                   const SkColor colors[], const SkScalar pos[], 
     int count, | 
| 50                                   SkShader::TileMode mode, | 50                                   SkShader::TileMode mode, | 
| 51                                   SkUnitMapper* mapper = NULL, | 51                                   SkUnitMapper* mapper = NULL, | 
| 52                                   uint32_t flags = 0, | 52                                   uint32_t flags = 0, | 
| 53                                   const SkMatrix* localMatrix = NULL); | 53                                   const SkMatrix* localMatrix = NULL); | 
| 54 | 54 | 
|  | 55     static SkShader* CreateLinear(const SkPoint pts[2], | 
|  | 56                                   const SkColor colors[], const SkScalar pos[], 
     int count, | 
|  | 57                                   SkShader::TileMode mode, | 
|  | 58                                   uint32_t flags, | 
|  | 59                                   const SkMatrix* localMatrix) { | 
|  | 60         return CreateLinear(pts, colors, pos, count, mode, NULL, flags, localMat
     rix); | 
|  | 61     } | 
|  | 62 | 
| 55     /** Returns a shader that generates a radial gradient given the center and r
     adius. | 63     /** Returns a shader that generates a radial gradient given the center and r
     adius. | 
| 56         <p /> | 64         <p /> | 
| 57         CreateRadial returns a shader with a reference count of 1. | 65         CreateRadial returns a shader with a reference count of 1. | 
| 58         The caller should decrement the shader's reference count when done with 
     the shader. | 66         The caller should decrement the shader's reference count when done with 
     the shader. | 
| 59         It is an error for colorCount to be < 2, or for radius to be <= 0. | 67         It is an error for colorCount to be < 2, or for radius to be <= 0. | 
| 60         @param  center  The center of the circle for this gradient | 68         @param  center  The center of the circle for this gradient | 
| 61         @param  radius  Must be positive. The radius of the circle for this grad
     ient | 69         @param  radius  Must be positive. The radius of the circle for this grad
     ient | 
| 62         @param  colors  The array[count] of colors, to be distributed between th
     e center and edge of the circle | 70         @param  colors  The array[count] of colors, to be distributed between th
     e center and edge of the circle | 
| 63         @param  pos     May be NULL. The array[count] of SkScalars, or NULL, of 
     the relative position of | 71         @param  pos     May be NULL. The array[count] of SkScalars, or NULL, of 
     the relative position of | 
| 64                         each corresponding color in the colors array. If this is
      NULL, | 72                         each corresponding color in the colors array. If this is
      NULL, | 
| 65                         the the colors are distributed evenly between the center
      and edge of the circle. | 73                         the the colors are distributed evenly between the center
      and edge of the circle. | 
| 66                         If this is not null, the values must begin with 0, end w
     ith 1.0, and | 74                         If this is not null, the values must begin with 0, end w
     ith 1.0, and | 
| 67                         intermediate values must be strictly increasing. | 75                         intermediate values must be strictly increasing. | 
| 68         @param  count   Must be >= 2. The number of colors (and pos if not NULL)
      entries | 76         @param  count   Must be >= 2. The number of colors (and pos if not NULL)
      entries | 
| 69         @param  mode    The tiling mode | 77         @param  mode    The tiling mode | 
| 70         @param  mapper  May be NULL. Callback to modify the spread of the colors
     . | 78         @param  mapper  May be NULL. Callback to modify the spread of the colors
     . | 
| 71     */ | 79     */ | 
| 72     static SkShader* CreateRadial(const SkPoint& center, SkScalar radius, | 80     static SkShader* CreateRadial(const SkPoint& center, SkScalar radius, | 
| 73                                   const SkColor colors[], const SkScalar pos[], 
     int count, | 81                                   const SkColor colors[], const SkScalar pos[], 
     int count, | 
| 74                                   SkShader::TileMode mode, | 82                                   SkShader::TileMode mode, | 
| 75                                   SkUnitMapper* mapper = NULL, | 83                                   SkUnitMapper* mapper = NULL, | 
| 76                                   uint32_t flags = 0, | 84                                   uint32_t flags = 0, | 
| 77                                   const SkMatrix* localMatrix = NULL); | 85                                   const SkMatrix* localMatrix = NULL); | 
| 78 | 86 | 
|  | 87     static SkShader* CreateRadial(const SkPoint& center, SkScalar radius, | 
|  | 88                                   const SkColor colors[], const SkScalar pos[], 
     int count, | 
|  | 89                                   SkShader::TileMode mode, | 
|  | 90                                   uint32_t flags, | 
|  | 91                                   const SkMatrix* localMatrix) { | 
|  | 92         return CreateRadial(center, radius, colors, pos, count, mode, NULL, flag
     s, localMatrix); | 
|  | 93     } | 
|  | 94 | 
| 79     /** Returns a shader that generates a radial gradient given the start positi
     on, start radius, end position and end radius. | 95     /** Returns a shader that generates a radial gradient given the start positi
     on, start radius, end position and end radius. | 
| 80         <p /> | 96         <p /> | 
| 81         CreateTwoPointRadial returns a shader with a reference count of 1. | 97         CreateTwoPointRadial returns a shader with a reference count of 1. | 
| 82         The caller should decrement the shader's reference count when done with 
     the shader. | 98         The caller should decrement the shader's reference count when done with 
     the shader. | 
| 83         It is an error for colorCount to be < 2, for startRadius or endRadius to
      be < 0, or for | 99         It is an error for colorCount to be < 2, for startRadius or endRadius to
      be < 0, or for | 
| 84         startRadius to be equal to endRadius. | 100         startRadius to be equal to endRadius. | 
| 85         @param  start   The center of the start circle for this gradient | 101         @param  start   The center of the start circle for this gradient | 
| 86         @param  startRadius  Must be positive.  The radius of the start circle f
     or this gradient. | 102         @param  startRadius  Must be positive.  The radius of the start circle f
     or this gradient. | 
| 87         @param  end     The center of the end circle for this gradient | 103         @param  end     The center of the end circle for this gradient | 
| 88         @param  endRadius  Must be positive. The radius of the end circle for th
     is gradient. | 104         @param  endRadius  Must be positive. The radius of the end circle for th
     is gradient. | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 100                                           SkScalar startRadius, | 116                                           SkScalar startRadius, | 
| 101                                           const SkPoint& end, | 117                                           const SkPoint& end, | 
| 102                                           SkScalar endRadius, | 118                                           SkScalar endRadius, | 
| 103                                           const SkColor colors[], | 119                                           const SkColor colors[], | 
| 104                                           const SkScalar pos[], int count, | 120                                           const SkScalar pos[], int count, | 
| 105                                           SkShader::TileMode mode, | 121                                           SkShader::TileMode mode, | 
| 106                                           SkUnitMapper* mapper = NULL, | 122                                           SkUnitMapper* mapper = NULL, | 
| 107                                           uint32_t flags = 0, | 123                                           uint32_t flags = 0, | 
| 108                                           const SkMatrix* localMatrix = NULL); | 124                                           const SkMatrix* localMatrix = NULL); | 
| 109 | 125 | 
|  | 126     static SkShader* CreateTwoPointRadial(const SkPoint& start, | 
|  | 127                                           SkScalar startRadius, | 
|  | 128                                           const SkPoint& end, | 
|  | 129                                           SkScalar endRadius, | 
|  | 130                                           const SkColor colors[], | 
|  | 131                                           const SkScalar pos[], int count, | 
|  | 132                                           SkShader::TileMode mode, | 
|  | 133                                           uint32_t flags, | 
|  | 134                                           const SkMatrix* localMatrix) { | 
|  | 135         return CreateTwoPointRadial(start, startRadius, end, endRadius, colors, 
     pos, count, mode, | 
|  | 136                                     NULL, flags, localMatrix); | 
|  | 137     } | 
|  | 138 | 
| 110     /** | 139     /** | 
| 111      *  Returns a shader that generates a conical gradient given two circles, or | 140      *  Returns a shader that generates a conical gradient given two circles, or | 
| 112      *  returns NULL if the inputs are invalid. The gradient interprets the | 141      *  returns NULL if the inputs are invalid. The gradient interprets the | 
| 113      *  two circles according to the following HTML spec. | 142      *  two circles according to the following HTML spec. | 
| 114      *  http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient | 143      *  http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient | 
| 115      */ | 144      */ | 
| 116     static SkShader* CreateTwoPointConical(const SkPoint& start, | 145     static SkShader* CreateTwoPointConical(const SkPoint& start, | 
| 117                                            SkScalar startRadius, | 146                                            SkScalar startRadius, | 
| 118                                            const SkPoint& end, | 147                                            const SkPoint& end, | 
| 119                                            SkScalar endRadius, | 148                                            SkScalar endRadius, | 
| 120                                            const SkColor colors[], | 149                                            const SkColor colors[], | 
| 121                                            const SkScalar pos[], int count, | 150                                            const SkScalar pos[], int count, | 
| 122                                            SkShader::TileMode mode, | 151                                            SkShader::TileMode mode, | 
| 123                                            SkUnitMapper* mapper = NULL, | 152                                            SkUnitMapper* mapper = NULL, | 
| 124                                            uint32_t flags = 0, | 153                                            uint32_t flags = 0, | 
| 125                                            const SkMatrix* localMatrix = NULL); | 154                                            const SkMatrix* localMatrix = NULL); | 
| 126 | 155 | 
|  | 156     static SkShader* CreateTwoPointConical(const SkPoint& start, | 
|  | 157                                            SkScalar startRadius, | 
|  | 158                                            const SkPoint& end, | 
|  | 159                                            SkScalar endRadius, | 
|  | 160                                            const SkColor colors[], | 
|  | 161                                            const SkScalar pos[], int count, | 
|  | 162                                            SkShader::TileMode mode, | 
|  | 163                                            uint32_t flags, | 
|  | 164                                            const SkMatrix* localMatrix) { | 
|  | 165         return CreateTwoPointConical(start, startRadius, end, endRadius, colors,
      pos, count, mode, | 
|  | 166                                      NULL, flags, localMatrix); | 
|  | 167     } | 
|  | 168 | 
| 127     /** Returns a shader that generates a sweep gradient given a center. | 169     /** Returns a shader that generates a sweep gradient given a center. | 
| 128         <p /> | 170         <p /> | 
| 129         CreateSweep returns a shader with a reference count of 1. | 171         CreateSweep returns a shader with a reference count of 1. | 
| 130         The caller should decrement the shader's reference count when done with 
     the shader. | 172         The caller should decrement the shader's reference count when done with 
     the shader. | 
| 131         It is an error for colorCount to be < 2. | 173         It is an error for colorCount to be < 2. | 
| 132         @param  cx      The X coordinate of the center of the sweep | 174         @param  cx      The X coordinate of the center of the sweep | 
| 133         @param  cx      The Y coordinate of the center of the sweep | 175         @param  cx      The Y coordinate of the center of the sweep | 
| 134         @param  colors  The array[count] of colors, to be distributed around the
      center. | 176         @param  colors  The array[count] of colors, to be distributed around the
      center. | 
| 135         @param  pos     May be NULL. The array[count] of SkScalars, or NULL, of 
     the relative position of | 177         @param  pos     May be NULL. The array[count] of SkScalars, or NULL, of 
     the relative position of | 
| 136                         each corresponding color in the colors array. If this is
      NULL, | 178                         each corresponding color in the colors array. If this is
      NULL, | 
| 137                         the the colors are distributed evenly between the center
      and edge of the circle. | 179                         the the colors are distributed evenly between the center
      and edge of the circle. | 
| 138                         If this is not null, the values must begin with 0, end w
     ith 1.0, and | 180                         If this is not null, the values must begin with 0, end w
     ith 1.0, and | 
| 139                         intermediate values must be strictly increasing. | 181                         intermediate values must be strictly increasing. | 
| 140         @param  count   Must be >= 2. The number of colors (and pos if not NULL)
      entries | 182         @param  count   Must be >= 2. The number of colors (and pos if not NULL)
      entries | 
| 141         @param  mapper  May be NULL. Callback to modify the spread of the colors
     . | 183         @param  mapper  May be NULL. Callback to modify the spread of the colors
     . | 
| 142     */ | 184     */ | 
| 143     static SkShader* CreateSweep(SkScalar cx, SkScalar cy, | 185     static SkShader* CreateSweep(SkScalar cx, SkScalar cy, | 
| 144                                  const SkColor colors[], const SkScalar pos[], | 186                                  const SkColor colors[], const SkScalar pos[], | 
| 145                                  int count, SkUnitMapper* mapper = NULL, | 187                                  int count, SkUnitMapper* mapper = NULL, | 
| 146                                  uint32_t flags = 0, | 188                                  uint32_t flags = 0, | 
| 147                                  const SkMatrix* localMatrix = NULL); | 189                                  const SkMatrix* localMatrix = NULL); | 
| 148 | 190 | 
|  | 191     static SkShader* CreateSweep(SkScalar cx, SkScalar cy, | 
|  | 192                                  const SkColor colors[], const SkScalar pos[], i
     nt count, | 
|  | 193                                  uint32_t flags, const SkMatrix* localMatrix) { | 
|  | 194         return CreateSweep(cx, cy, colors, pos, count, NULL, flags, localMatrix)
     ; | 
|  | 195     } | 
|  | 196 | 
| 149     SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 197     SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 
| 150 }; | 198 }; | 
| 151 | 199 | 
| 152 #endif | 200 #endif | 
| OLD | NEW | 
|---|