OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "SkArithmeticMode.h" | 10 #include "SkArithmeticMode.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 SkPaint paint; | 146 SkPaint paint; |
147 paint.setImageFilter(blendColor); | 147 paint.setImageFilter(blendColor); |
148 DrawClippedImage(canvas, fImage, paint); | 148 DrawClippedImage(canvas, fImage, paint); |
149 canvas->translate(SkIntToScalar(100), 0); | 149 canvas->translate(SkIntToScalar(100), 0); |
150 } | 150 } |
151 { | 151 { |
152 SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0, | 152 SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0, |
153 0, SK_Scalar1, 0, 0, 0, | 153 0, SK_Scalar1, 0, 0, 0, |
154 0, 0, SK_Scalar1, 0, 0, | 154 0, 0, SK_Scalar1, 0, 0, |
155 0, 0, 0, 0.5f, 0 }; | 155 0, 0, 0, 0.5f, 0 }; |
156 SkAutoTUnref<SkColorMatrixFilter> matrixCF(SkColorMatrixFilter::Crea
te(matrix)); | 156 SkAutoTUnref<SkColorFilter> matrixCF(SkColorMatrixFilter::Create(mat
rix)); |
157 SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::C
reate(matrixCF)); | 157 SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::C
reate(matrixCF)); |
158 SkAutoTUnref<SkImageFilter> offsetFilter( | 158 SkAutoTUnref<SkImageFilter> offsetFilter( |
159 SimpleOffsetFilter::Create(10.0f, 10.f, matrixFilter)); | 159 SimpleOffsetFilter::Create(10.0f, 10.f, matrixFilter)); |
160 | 160 |
161 SkAutoTUnref<SkXfermode> arith(SkArithmeticMode::Create(0, SK_Scalar
1, SK_Scalar1, 0)); | 161 SkAutoTUnref<SkXfermode> arith(SkArithmeticMode::Create(0, SK_Scalar
1, SK_Scalar1, 0)); |
162 SkAutoTUnref<SkXfermodeImageFilter> arithFilter( | 162 SkAutoTUnref<SkImageFilter> arithFilter( |
163 SkXfermodeImageFilter::Create(arith, matrixFilter, offsetFilter)
); | 163 SkXfermodeImageFilter::Create(arith, matrixFilter, offsetFilter)
); |
164 | 164 |
165 SkPaint paint; | 165 SkPaint paint; |
166 paint.setImageFilter(arithFilter); | 166 paint.setImageFilter(arithFilter); |
167 DrawClippedImage(canvas, fImage, paint); | 167 DrawClippedImage(canvas, fImage, paint); |
168 canvas->translate(SkIntToScalar(100), 0); | 168 canvas->translate(SkIntToScalar(100), 0); |
169 } | 169 } |
170 { | 170 { |
171 SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create( | 171 SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create( |
172 SkIntToScalar(10), SkIntToScalar(10))); | 172 SkIntToScalar(10), SkIntToScalar(10))); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 | 212 |
213 SkAutoTUnref<SkImage> fImage; | 213 SkAutoTUnref<SkImage> fImage; |
214 | 214 |
215 typedef GM INHERITED; | 215 typedef GM INHERITED; |
216 }; | 216 }; |
217 | 217 |
218 /////////////////////////////////////////////////////////////////////////////// | 218 /////////////////////////////////////////////////////////////////////////////// |
219 | 219 |
220 DEF_GM(return new ImageFiltersGraphGM;) | 220 DEF_GM(return new ImageFiltersGraphGM;) |
OLD | NEW |