OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkParsePath.h" | 10 #include "SkParsePath.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 canvas->translate(10, 30); | 161 canvas->translate(10, 30); |
162 | 162 |
163 static const SkBlurMaskFilter::BlurStyle gStyle[] = { | 163 static const SkBlurMaskFilter::BlurStyle gStyle[] = { |
164 SkBlurMaskFilter::kNormal_BlurStyle, | 164 SkBlurMaskFilter::kNormal_BlurStyle, |
165 SkBlurMaskFilter::kInner_BlurStyle, | 165 SkBlurMaskFilter::kInner_BlurStyle, |
166 SkBlurMaskFilter::kOuter_BlurStyle, | 166 SkBlurMaskFilter::kOuter_BlurStyle, |
167 SkBlurMaskFilter::kSolid_BlurStyle, | 167 SkBlurMaskFilter::kSolid_BlurStyle, |
168 }; | 168 }; |
169 for (int x = 0; x < 5; x++) { | 169 for (int x = 0; x < 5; x++) { |
170 SkMaskFilter* mf; | 170 SkMaskFilter* mf; |
171 SkScalar radius = 4; | 171 SkScalar sigma = SkFloatToScalar(2.8094f); |
172 for (int y = 0; y < 10; y++) { | 172 for (int y = 0; y < 10; y++) { |
173 if (x) { | 173 if (x) { |
174 mf = SkBlurMaskFilter::Create(radius, gStyle[x - 1]); | 174 mf = SkBlurMaskFilter::Create(gStyle[x - 1], sigma); |
175 paint.setMaskFilter(mf)->unref(); | 175 paint.setMaskFilter(mf)->unref(); |
176 } | 176 } |
177 canvas->drawText("Title Bar", 9, x*SkIntToScalar(100), y*SkI
ntToScalar(30), paint); | 177 canvas->drawText("Title Bar", 9, x*SkIntToScalar(100), y*SkI
ntToScalar(30), paint); |
178 radius *= 0.75f; | 178 sigma *= 0.75f; |
179 } | 179 } |
180 | 180 |
181 } | 181 } |
182 return; | 182 return; |
183 } | 183 } |
184 | 184 |
185 paint.setColor(SK_ColorBLUE); | 185 paint.setColor(SK_ColorBLUE); |
186 | 186 |
187 #if 1 | 187 #if 1 |
188 SkPath p; | 188 SkPath p; |
(...skipping 26 matching lines...) Expand all Loading... |
215 return this->INHERITED::onFindClickHandler(x, y, modi); | 215 return this->INHERITED::onFindClickHandler(x, y, modi); |
216 } | 216 } |
217 private: | 217 private: |
218 typedef SampleView INHERITED; | 218 typedef SampleView INHERITED; |
219 }; | 219 }; |
220 | 220 |
221 ////////////////////////////////////////////////////////////////////////////// | 221 ////////////////////////////////////////////////////////////////////////////// |
222 | 222 |
223 static SkView* MyFactory() { return new StrokePathView; } | 223 static SkView* MyFactory() { return new StrokePathView; } |
224 static SkViewRegister reg(MyFactory); | 224 static SkViewRegister reg(MyFactory); |
OLD | NEW |