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 #ifndef SkArithmeticMode_DEFINED | 8 #ifndef SkArithmeticMode_DEFINED |
9 #define SkArithmeticMode_DEFINED | 9 #define SkArithmeticMode_DEFINED |
10 | 10 |
11 #include "SkFlattenable.h" | 11 #include "SkFlattenable.h" |
12 #include "SkScalar.h" | 12 #include "SkScalar.h" |
13 | 13 |
14 class SkXfermode; | 14 class SkXfermode; |
15 | 15 |
16 class SK_API SkArithmeticMode { | 16 class SK_API SkArithmeticMode { |
17 public: | 17 public: |
18 /** | 18 /** |
19 * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4] | 19 * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4] |
20 * | 20 * |
21 * src and dst are treated as being [0.0 .. 1.0]. The polynomial is | 21 * src and dst are treated as being [0.0 .. 1.0]. The polynomial is |
22 * evaluated on their unpremultiplied components. | 22 * evaluated on their unpremultiplied components. |
23 * | 23 * |
24 * k1=k2=k3=0, k4=1.0 results in returning opaque white | 24 * k1=k2=k3=0, k4=1.0 results in returning opaque white |
25 * k1=k3=k4=0, k2=1.0 results in returning the src | 25 * k1=k3=k4=0, k2=1.0 results in returning the src |
26 * k1=k2=k4=0, k3=1.0 results in returning the dst | 26 * k1=k2=k4=0, k3=1.0 results in returning the dst |
27 */ | 27 */ |
28 static SkXfermode* Create(SkScalar k1, SkScalar k2, | 28 static SkXfermode* Create(SkScalar k1, SkScalar k2, |
29 SkScalar k3, SkScalar k4); | 29 SkScalar k3, SkScalar k4, |
| 30 bool validatePMColor = true); |
30 | 31 |
31 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); | 32 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); |
32 | 33 |
33 private: | 34 private: |
34 SkArithmeticMode(); // can't be instantiated | 35 SkArithmeticMode(); // can't be instantiated |
35 }; | 36 }; |
36 | 37 |
37 #endif | 38 #endif |
OLD | NEW |