mike@reedtribe.org | e51755f | 2011-12-10 19:36:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkArithmeticMode_DEFINED |
| 9 | #define SkArithmeticMode_DEFINED |
| 10 | |
commit-bot@chromium.org | c0b7e10 | 2013-10-23 17:06:21 +0000 | [diff] [blame] | 11 | #include "SkFlattenable.h" |
| 12 | #include "SkScalar.h" |
mike@reedtribe.org | e51755f | 2011-12-10 19:36:56 +0000 | [diff] [blame] | 13 | |
commit-bot@chromium.org | c0b7e10 | 2013-10-23 17:06:21 +0000 | [diff] [blame] | 14 | class SkXfermode; |
| 15 | |
| 16 | class SK_API SkArithmeticMode { |
mike@reedtribe.org | e51755f | 2011-12-10 19:36:56 +0000 | [diff] [blame] | 17 | public: |
| 18 | /** |
| 19 | * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4] |
| 20 | * |
mike@reedtribe.org | e51755f | 2011-12-10 19:36:56 +0000 | [diff] [blame] | 21 | * k1=k2=k3=0, k4=1.0 results in returning opaque white |
| 22 | * k1=k3=k4=0, k2=1.0 results in returning the src |
| 23 | * k1=k2=k4=0, k3=1.0 results in returning the dst |
| 24 | */ |
| 25 | static SkXfermode* Create(SkScalar k1, SkScalar k2, |
commit-bot@chromium.org | 51a11b7 | 2014-04-02 19:32:15 +0000 | [diff] [blame] | 26 | SkScalar k3, SkScalar k4, |
| 27 | bool enforcePMColor = true); |
robertphillips@google.com | b83b6b4 | 2013-01-22 14:32:09 +0000 | [diff] [blame] | 28 | |
senorblanco@chromium.org | 9a6eb0e | 2013-05-29 20:55:09 +0000 | [diff] [blame] | 29 | SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); |
| 30 | |
robertphillips@google.com | b83b6b4 | 2013-01-22 14:32:09 +0000 | [diff] [blame] | 31 | private: |
commit-bot@chromium.org | c0b7e10 | 2013-10-23 17:06:21 +0000 | [diff] [blame] | 32 | SkArithmeticMode(); // can't be instantiated |
mike@reedtribe.org | e51755f | 2011-12-10 19:36:56 +0000 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | #endif |