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 "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkBlurMask.h" |
10 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
11 #include "Sk64.h" | 12 #include "Sk64.h" |
12 #include "SkCornerPathEffect.h" | 13 #include "SkCornerPathEffect.h" |
13 #include "SkGradientShader.h" | 14 #include "SkGradientShader.h" |
14 #include "SkGraphics.h" | 15 #include "SkGraphics.h" |
15 #include "SkImageDecoder.h" | 16 #include "SkImageDecoder.h" |
16 #include "SkKernel33MaskFilter.h" | 17 #include "SkKernel33MaskFilter.h" |
17 #include "SkPath.h" | 18 #include "SkPath.h" |
18 #include "SkRandom.h" | 19 #include "SkRandom.h" |
19 #include "SkRegion.h" | 20 #include "SkRegion.h" |
(...skipping 19 matching lines...) Expand all Loading... |
39 | 40 |
40 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; | 41 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; |
41 | 42 |
42 class XfermodesBlurView : public SampleView { | 43 class XfermodesBlurView : public SampleView { |
43 SkBitmap fBG; | 44 SkBitmap fBG; |
44 SkBitmap fSrcB, fDstB; | 45 SkBitmap fSrcB, fDstB; |
45 | 46 |
46 void draw_mode(SkCanvas* canvas, SkXfermode* mode, int alpha, | 47 void draw_mode(SkCanvas* canvas, SkXfermode* mode, int alpha, |
47 SkScalar x, SkScalar y) { | 48 SkScalar x, SkScalar y) { |
48 SkPaint p; | 49 SkPaint p; |
49 SkMaskFilter* mf = SkBlurMaskFilter::Create(5, SkBlurMaskFilter::kNormal
_BlurStyle, | 50 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl
urStyle, |
50 SkBlurMaskFilter::kNone_Blur
Flag); | 51 SkBlurMask::ConvertRadiusToSigma(SkIntToS
calar(5)), |
| 52 SkBlurMaskFilter::kNone_BlurFlag); |
51 p.setMaskFilter(mf)->unref(); | 53 p.setMaskFilter(mf)->unref(); |
52 | 54 |
53 SkScalar ww = SkIntToScalar(W); | 55 SkScalar ww = SkIntToScalar(W); |
54 SkScalar hh = SkIntToScalar(H); | 56 SkScalar hh = SkIntToScalar(H); |
55 | 57 |
56 // draw a circle covering the upper | 58 // draw a circle covering the upper |
57 // left three quarters of the canvas | 59 // left three quarters of the canvas |
58 p.setColor(0xFFCC44FF); | 60 p.setColor(0xFFCC44FF); |
59 SkRect r; | 61 SkRect r; |
60 r.set(0, 0, ww*3/4, hh*3/4); | 62 r.set(0, 0, ww*3/4, hh*3/4); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 204 } |
203 | 205 |
204 private: | 206 private: |
205 typedef SampleView INHERITED; | 207 typedef SampleView INHERITED; |
206 }; | 208 }; |
207 | 209 |
208 ////////////////////////////////////////////////////////////////////////////// | 210 ////////////////////////////////////////////////////////////////////////////// |
209 | 211 |
210 static SkView* MyFactory() { return new XfermodesBlurView; } | 212 static SkView* MyFactory() { return new XfermodesBlurView; } |
211 static SkViewRegister reg(MyFactory); | 213 static SkViewRegister reg(MyFactory); |
OLD | NEW |