OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkPathEffect_DEFINED | 10 #ifndef SkPathEffect_DEFINED |
(...skipping 11 matching lines...) Expand all Loading... |
22 /** \class SkPathEffect | 22 /** \class SkPathEffect |
23 | 23 |
24 SkPathEffect is the base class for objects in the SkPaint that affect | 24 SkPathEffect is the base class for objects in the SkPaint that affect |
25 the geometry of a drawing primitive before it is transformed by the | 25 the geometry of a drawing primitive before it is transformed by the |
26 canvas' matrix and drawn. | 26 canvas' matrix and drawn. |
27 | 27 |
28 Dashing is implemented as a subclass of SkPathEffect. | 28 Dashing is implemented as a subclass of SkPathEffect. |
29 */ | 29 */ |
30 class SK_API SkPathEffect : public SkFlattenable { | 30 class SK_API SkPathEffect : public SkFlattenable { |
31 public: | 31 public: |
32 SK_DECLARE_INST_COUNT(SkPathEffect) | |
33 | |
34 /** | 32 /** |
35 * Given a src path (input) and a stroke-rec (input and output), apply | 33 * Given a src path (input) and a stroke-rec (input and output), apply |
36 * this effect to the src path, returning the new path in dst, and return | 34 * this effect to the src path, returning the new path in dst, and return |
37 * true. If this effect cannot be applied, return false and ignore dst | 35 * true. If this effect cannot be applied, return false and ignore dst |
38 * and stroke-rec. | 36 * and stroke-rec. |
39 * | 37 * |
40 * The stroke-rec specifies the initial request for stroking (if any). | 38 * The stroke-rec specifies the initial request for stroking (if any). |
41 * The effect can treat this as input only, or it can choose to change | 39 * The effect can treat this as input only, or it can choose to change |
42 * the rec as well. For example, the effect can decide to change the | 40 * the rec as well. For example, the effect can decide to change the |
43 * stroke's width or join, or the effect can change the rec from stroke | 41 * stroke's width or join, or the effect can change the rec from stroke |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 virtual ~SkPairPathEffect(); | 159 virtual ~SkPairPathEffect(); |
162 | 160 |
163 protected: | 161 protected: |
164 SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1); | 162 SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1); |
165 | 163 |
166 void flatten(SkWriteBuffer&) const override; | 164 void flatten(SkWriteBuffer&) const override; |
167 | 165 |
168 // these are visible to our subclasses | 166 // these are visible to our subclasses |
169 SkPathEffect* fPE0, *fPE1; | 167 SkPathEffect* fPE0, *fPE1; |
170 | 168 |
171 SK_TO_STRING_OVERRIDE() | 169 SK_TO_STRING_OVERRIDE() |
172 | 170 |
173 private: | 171 private: |
174 typedef SkPathEffect INHERITED; | 172 typedef SkPathEffect INHERITED; |
175 }; | 173 }; |
176 | 174 |
177 /** \class SkComposePathEffect | 175 /** \class SkComposePathEffect |
178 | 176 |
179 This subclass of SkPathEffect composes its two arguments, to create | 177 This subclass of SkPathEffect composes its two arguments, to create |
180 a compound pathEffect. | 178 a compound pathEffect. |
181 */ | 179 */ |
182 class SkComposePathEffect : public SkPairPathEffect { | 180 class SkComposePathEffect : public SkPairPathEffect { |
183 public: | 181 public: |
184 /** Construct a pathEffect whose effect is to apply first the inner pathEffe
ct | 182 /** Construct a pathEffect whose effect is to apply first the inner pathEffe
ct |
185 and the the outer pathEffect (e.g. outer(inner(path))) | 183 and the the outer pathEffect (e.g. outer(inner(path))) |
186 The reference counts for outer and inner are both incremented in the con
structor, | 184 The reference counts for outer and inner are both incremented in the con
structor, |
187 and decremented in the destructor. | 185 and decremented in the destructor. |
188 */ | 186 */ |
189 static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner)
{ | 187 static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner)
{ |
190 return SkNEW_ARGS(SkComposePathEffect, (outer, inner)); | 188 return SkNEW_ARGS(SkComposePathEffect, (outer, inner)); |
191 } | 189 } |
192 | 190 |
193 virtual bool filterPath(SkPath* dst, const SkPath& src, | 191 virtual bool filterPath(SkPath* dst, const SkPath& src, |
194 SkStrokeRec*, const SkRect*) const override; | 192 SkStrokeRec*, const SkRect*) const override; |
195 | 193 |
196 SK_TO_STRING_OVERRIDE() | 194 SK_TO_STRING_OVERRIDE() |
197 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) | 195 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) |
198 | 196 |
199 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 197 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
200 bool exposedInAndroidJavaAPI() const override { return true; } | 198 bool exposedInAndroidJavaAPI() const override { return true; } |
201 #endif | 199 #endif |
202 | 200 |
203 protected: | 201 protected: |
204 SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) : INHERITED(ou
ter, inner) {} | 202 SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) : INHERITED(ou
ter, inner) {} |
205 | 203 |
206 private: | 204 private: |
(...skipping 16 matching lines...) Expand all Loading... |
223 The reference counts for first and second are both incremented in the co
nstructor, | 221 The reference counts for first and second are both incremented in the co
nstructor, |
224 and decremented in the destructor. | 222 and decremented in the destructor. |
225 */ | 223 */ |
226 static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { | 224 static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { |
227 return SkNEW_ARGS(SkSumPathEffect, (first, second)); | 225 return SkNEW_ARGS(SkSumPathEffect, (first, second)); |
228 } | 226 } |
229 | 227 |
230 virtual bool filterPath(SkPath* dst, const SkPath& src, | 228 virtual bool filterPath(SkPath* dst, const SkPath& src, |
231 SkStrokeRec*, const SkRect*) const override; | 229 SkStrokeRec*, const SkRect*) const override; |
232 | 230 |
233 SK_TO_STRING_OVERRIDE() | 231 SK_TO_STRING_OVERRIDE() |
234 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) | 232 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) |
235 | 233 |
236 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 234 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
237 bool exposedInAndroidJavaAPI() const override { return true; } | 235 bool exposedInAndroidJavaAPI() const override { return true; } |
238 #endif | 236 #endif |
239 | 237 |
240 protected: | 238 protected: |
241 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) : INHERITED(first
, second) {} | 239 SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) : INHERITED(first
, second) {} |
242 | 240 |
243 private: | 241 private: |
244 // illegal | 242 // illegal |
245 SkSumPathEffect(const SkSumPathEffect&); | 243 SkSumPathEffect(const SkSumPathEffect&); |
246 SkSumPathEffect& operator=(const SkSumPathEffect&); | 244 SkSumPathEffect& operator=(const SkSumPathEffect&); |
247 | 245 |
248 typedef SkPairPathEffect INHERITED; | 246 typedef SkPairPathEffect INHERITED; |
249 }; | 247 }; |
250 | 248 |
251 #endif | 249 #endif |
OLD | NEW |