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 "SkBlurMask.h" |
9 #include "SkView.h" | 10 #include "SkView.h" |
10 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
11 #include "Sk64.h" | 12 #include "Sk64.h" |
12 #include "SkColorShader.h" | 13 #include "SkColorShader.h" |
13 #include "SkEmbossMaskFilter.h" | 14 #include "SkEmbossMaskFilter.h" |
14 #include "SkGradientShader.h" | 15 #include "SkGradientShader.h" |
15 #include "SkGraphics.h" | 16 #include "SkGraphics.h" |
16 #include "SkImageDecoder.h" | 17 #include "SkImageDecoder.h" |
17 #include "SkKernel33MaskFilter.h" | 18 #include "SkKernel33MaskFilter.h" |
18 #include "SkPath.h" | 19 #include "SkPath.h" |
(...skipping 27 matching lines...) Expand all Loading... |
46 } | 47 } |
47 return this->INHERITED::onQuery(evt); | 48 return this->INHERITED::onQuery(evt); |
48 } | 49 } |
49 | 50 |
50 virtual void onDrawContent(SkCanvas* canvas) { | 51 virtual void onDrawContent(SkCanvas* canvas) { |
51 SkPaint paint; | 52 SkPaint paint; |
52 | 53 |
53 paint.setAntiAlias(true); | 54 paint.setAntiAlias(true); |
54 paint.setStyle(SkPaint::kStroke_Style); | 55 paint.setStyle(SkPaint::kStroke_Style); |
55 paint.setStrokeWidth(SkIntToScalar(10)); | 56 paint.setStrokeWidth(SkIntToScalar(10)); |
56 paint.setMaskFilter(new SkEmbossMaskFilter(fLight, SkIntToScalar(4)))->u
nref(); | 57 paint.setMaskFilter(new SkEmbossMaskFilter( |
| 58 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)), fLight))->unref(
); |
57 paint.setShader(new SkColorShader(SK_ColorBLUE))->unref(); | 59 paint.setShader(new SkColorShader(SK_ColorBLUE))->unref(); |
58 paint.setDither(true); | 60 paint.setDither(true); |
59 | 61 |
60 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), | 62 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), |
61 SkIntToScalar(30), paint); | 63 SkIntToScalar(30), paint); |
62 } | 64 } |
63 | 65 |
64 private: | 66 private: |
65 | 67 |
66 typedef SampleView INHERITED; | 68 typedef SampleView INHERITED; |
67 }; | 69 }; |
68 | 70 |
69 ////////////////////////////////////////////////////////////////////////////// | 71 ////////////////////////////////////////////////////////////////////////////// |
70 | 72 |
71 static SkView* MyFactory() { return new EmbossView; } | 73 static SkView* MyFactory() { return new EmbossView; } |
72 static SkViewRegister reg(MyFactory); | 74 static SkViewRegister reg(MyFactory); |
OLD | NEW |