OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkView.h" | 10 #include "SkView.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 return this->INHERITED::onQuery(evt); | 44 return this->INHERITED::onQuery(evt); |
45 } | 45 } |
46 | 46 |
47 virtual void onDrawContent(SkCanvas* canvas) { | 47 virtual void onDrawContent(SkCanvas* canvas) { |
48 SkPaint paint; | 48 SkPaint paint; |
49 | 49 |
50 paint.setAntiAlias(true); | 50 paint.setAntiAlias(true); |
51 paint.setStyle(SkPaint::kStroke_Style); | 51 paint.setStyle(SkPaint::kStroke_Style); |
52 paint.setStrokeWidth(SkIntToScalar(10)); | 52 paint.setStrokeWidth(SkIntToScalar(10)); |
53 paint.setMaskFilter(SkEmbossMaskFilter::Create( | 53 paint.setMaskFilter(SkEmbossMaskFilter::Make(SkBlurMask::ConvertRadiusTo
Sigma(4), fLight)); |
54 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)), fLight))->unref(
); | |
55 paint.setShader(SkShader::MakeColorShader(SK_ColorBLUE)); | 54 paint.setShader(SkShader::MakeColorShader(SK_ColorBLUE)); |
56 paint.setDither(true); | 55 paint.setDither(true); |
57 | 56 |
58 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), | 57 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), |
59 SkIntToScalar(30), paint); | 58 SkIntToScalar(30), paint); |
60 } | 59 } |
61 | 60 |
62 private: | 61 private: |
63 | 62 |
64 typedef SampleView INHERITED; | 63 typedef SampleView INHERITED; |
65 }; | 64 }; |
66 | 65 |
67 ////////////////////////////////////////////////////////////////////////////// | 66 ////////////////////////////////////////////////////////////////////////////// |
68 | 67 |
69 static SkView* MyFactory() { return new EmbossView; } | 68 static SkView* MyFactory() { return new EmbossView; } |
70 static SkViewRegister reg(MyFactory); | 69 static SkViewRegister reg(MyFactory); |
OLD | NEW |