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