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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 const SkColor colors[], const SkScalar pos[],
int count, | 73 const SkColor colors[], const SkScalar pos[],
int count, |
74 SkShader::TileMode mode, | 74 SkShader::TileMode mode, |
75 uint32_t flags, const SkMatrix* localMatrix); | 75 uint32_t flags, const SkMatrix* localMatrix); |
76 | 76 |
77 static SkShader* CreateRadial(const SkPoint& center, SkScalar radius, | 77 static SkShader* CreateRadial(const SkPoint& center, SkScalar radius, |
78 const SkColor colors[], const SkScalar pos[],
int count, | 78 const SkColor colors[], const SkScalar pos[],
int count, |
79 SkShader::TileMode mode) { | 79 SkShader::TileMode mode) { |
80 return CreateRadial(center, radius, colors, pos, count, mode, 0, NULL); | 80 return CreateRadial(center, radius, colors, pos, count, mode, 0, NULL); |
81 } | 81 } |
82 | 82 |
83 /** Returns a shader that generates a radial gradient given the start positi
on, start radius, end position and end radius. | |
84 <p /> | |
85 CreateTwoPointRadial returns a shader with a reference count of 1. | |
86 The caller should decrement the shader's reference count when done with
the shader. | |
87 It is an error for colorCount to be < 2, for startRadius or endRadius to
be < 0, or for | |
88 startRadius to be equal to endRadius. | |
89 @param start The center of the start circle for this gradient | |
90 @param startRadius Must be positive. The radius of the start circle f
or this gradient. | |
91 @param end The center of the end circle for this gradient | |
92 @param endRadius Must be positive. The radius of the end circle for th
is gradient. | |
93 @param colors The array[count] of colors, to be distributed between th
e center and edge of the circle | |
94 @param pos May be NULL. The array[count] of SkScalars, or NULL, of
the relative position of | |
95 each corresponding color in the colors array. If this is
NULL, | |
96 the the colors are distributed evenly between the center
and edge of the circle. | |
97 If this is not null, the values must begin with 0, end w
ith 1.0, and | |
98 intermediate values must be strictly increasing. | |
99 @param count Must be >= 2. The number of colors (and pos if not NULL)
entries | |
100 @param mode The tiling mode | |
101 */ | |
102 static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRa
dius, | |
103 const SkPoint& end, SkScalar endRadius
, | |
104 const SkColor colors[], const SkScalar
pos[], int count, | |
105 SkShader::TileMode mode, | |
106 uint32_t flags, const SkMatrix* localM
atrix); | |
107 | |
108 static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRa
dius, | |
109 const SkPoint& end, SkScalar endRadius
, | |
110 const SkColor colors[], const SkScalar
pos[], int count, | |
111 SkShader::TileMode mode) { | |
112 return CreateTwoPointRadial(start, startRadius, end, endRadius, colors,
pos, count, mode, | |
113 0, NULL); | |
114 } | |
115 | |
116 /** | 83 /** |
117 * Returns a shader that generates a conical gradient given two circles, or | 84 * Returns a shader that generates a conical gradient given two circles, or |
118 * returns NULL if the inputs are invalid. The gradient interprets the | 85 * returns NULL if the inputs are invalid. The gradient interprets the |
119 * two circles according to the following HTML spec. | 86 * two circles according to the following HTML spec. |
120 * http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient | 87 * http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient |
121 */ | 88 */ |
122 static SkShader* CreateTwoPointConical(const SkPoint& start, SkScalar startR
adius, | 89 static SkShader* CreateTwoPointConical(const SkPoint& start, SkScalar startR
adius, |
123 const SkPoint& end, SkScalar endRadiu
s, | 90 const SkPoint& end, SkScalar endRadiu
s, |
124 const SkColor colors[], const SkScala
r pos[], int count, | 91 const SkColor colors[], const SkScala
r pos[], int count, |
125 SkShader::TileMode mode, | 92 SkShader::TileMode mode, |
(...skipping 28 matching lines...) Expand all Loading... |
154 | 121 |
155 static SkShader* CreateSweep(SkScalar cx, SkScalar cy, | 122 static SkShader* CreateSweep(SkScalar cx, SkScalar cy, |
156 const SkColor colors[], const SkScalar pos[], i
nt count) { | 123 const SkColor colors[], const SkScalar pos[], i
nt count) { |
157 return CreateSweep(cx, cy, colors, pos, count, 0, NULL); | 124 return CreateSweep(cx, cy, colors, pos, count, 0, NULL); |
158 } | 125 } |
159 | 126 |
160 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 127 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
161 }; | 128 }; |
162 | 129 |
163 #endif | 130 #endif |
OLD | NEW |