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 "SkPaint.h" | 10 #include "SkPaint.h" |
11 #include "SkView.h" | 11 #include "SkView.h" |
12 | 12 |
13 #include "SkBlurMaskFilter.h" | 13 #include "SkBlurMaskFilter.h" |
14 #include "SkColorMatrixFilter.h" | 14 #include "SkColorMatrixFilter.h" |
15 #include "SkDiscretePathEffect.h" | 15 #include "SkDiscretePathEffect.h" |
16 #include "SkGradientShader.h" | 16 #include "SkGradientShader.h" |
17 | 17 |
18 //#define COLOR 0xFFFF8844 | 18 //#define COLOR 0xFFFF8844 |
19 #define COLOR 0xFF888888 | 19 #define COLOR 0xFF888888 |
20 | 20 |
21 static void paint_proc0(SkPaint*) { | 21 static void paint_proc0(SkPaint*) { |
22 } | 22 } |
23 | 23 |
24 static void paint_proc1(SkPaint* paint) { | 24 static void paint_proc1(SkPaint* paint) { |
25 paint->setMaskFilter(SkBlurMaskFilter::Create(2, | 25 paint->setMaskFilter(SkBlurMaskFilter::Create( |
26 SkBlurMaskFilter::kNormal_BlurStyle))->unref(); | 26 SkBlurMaskFilter::kNormal_BlurStyle, |
| 27 SkFloatToScalar(1.6547f)))->unref(); |
27 } | 28 } |
28 | 29 |
29 static void paint_proc2(SkPaint* paint) { | 30 static void paint_proc2(SkPaint* paint) { |
30 SkScalar dir[3] = { 1, 1, 1}; | 31 SkScalar dir[3] = { 1, 1, 1}; |
31 paint->setMaskFilter( | 32 paint->setMaskFilter( |
32 SkBlurMaskFilter::CreateEmboss(dir, 0.1f, 0.05f, 1))->unref
(); | 33 SkBlurMaskFilter::CreateEmboss(SkFloatToScalar(1.07735f), |
| 34 dir, |
| 35 SkFloatToScalar(0.1f), |
| 36 SkFloatToScalar(0.05f)))->un
ref(); |
33 } | 37 } |
34 | 38 |
35 static void paint_proc3(SkPaint* paint) { | 39 static void paint_proc3(SkPaint* paint) { |
36 SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE }; | 40 SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE }; |
37 SkPoint pts[] = { { 3, 0 }, { 7, 5 } }; | 41 SkPoint pts[] = { { 3, 0 }, { 7, 5 } }; |
38 paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_
COUNT(colors), | 42 paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_
COUNT(colors), |
39 SkShader::kMirror_TileMode))->unref(); | 43 SkShader::kMirror_TileMode))->unref(); |
40 } | 44 } |
41 | 45 |
42 static void paint_proc5(SkPaint* paint) { | 46 static void paint_proc5(SkPaint* paint) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 113 } |
110 | 114 |
111 private: | 115 private: |
112 typedef SampleView INHERITED; | 116 typedef SampleView INHERITED; |
113 }; | 117 }; |
114 | 118 |
115 /////////////////////////////////////////////////////////////////////////////// | 119 /////////////////////////////////////////////////////////////////////////////// |
116 | 120 |
117 static SkView* MyFactory() { return new EffectsView; } | 121 static SkView* MyFactory() { return new EffectsView; } |
118 static SkViewRegister reg(MyFactory); | 122 static SkViewRegister reg(MyFactory); |
OLD | NEW |