OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
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 #ifndef SkColorMatrixFilter_DEFINED | 8 #ifndef SkColorMatrixFilter_DEFINED |
9 #define SkColorMatrixFilter_DEFINED | 9 #define SkColorMatrixFilter_DEFINED |
10 | 10 |
11 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
12 #include "SkColorMatrix.h" | 12 #include "SkColorMatrix.h" |
13 | 13 |
14 class SK_API SkColorMatrixFilter : public SkColorFilter { | 14 class SK_API SkColorMatrixFilter : public SkColorFilter { |
15 public: | 15 public: |
16 static SkColorFilter* Create(const SkColorMatrix& cm) { | |
17 return SkColorFilter::CreateMatrixFilterRowMajor255(cm.fMat); | |
18 } | |
19 static SkColorFilter* Create(const SkScalar array[20]) { | |
20 return SkColorFilter::CreateMatrixFilterRowMajor255(array); | |
21 } | |
22 | |
23 /** | 16 /** |
24 * Create a colorfilter that multiplies the RGB channels by one color, and | 17 * Create a colorfilter that multiplies the RGB channels by one color, and |
25 * then adds a second color, pinning the result for each component to | 18 * then adds a second color, pinning the result for each component to |
26 * [0..255]. The alpha components of the mul and add arguments | 19 * [0..255]. The alpha components of the mul and add arguments |
27 * are ignored. | 20 * are ignored. |
28 */ | 21 */ |
29 static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add); | 22 static sk_sp<SkColorFilter> MakeLightingFilter(SkColor mul, SkColor add); |
| 23 |
| 24 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR |
| 25 static SkColorFilter* Create(const SkColorMatrix& cm) { |
| 26 return SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat).release(); |
| 27 } |
| 28 static SkColorFilter* Create(const SkScalar array[20]) { |
| 29 return SkColorFilter::MakeMatrixFilterRowMajor255(array).release(); |
| 30 } |
| 31 static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add) { |
| 32 return MakeLightingFilter(mul, add).release(); |
| 33 } |
| 34 #endif |
30 }; | 35 }; |
31 | 36 |
32 #endif | 37 #endif |
OLD | NEW |