Chromium Code Reviews| 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 "SkXfermode.h" | 11 #include "SkXfermode.h" |
| 12 | 12 |
| 13 class SK_API SkArithmeticMode : public SkXfermode { | 13 class SK_API SkArithmeticMode : public SkXfermode { |
| 14 public: | 14 public: |
| 15 /** | 15 /** |
| 16 * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4] | 16 * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4] |
| 17 * | 17 * |
| 18 * src and dst are treated as being [0.0 .. 1.0]. The polynomial is | 18 * src and dst are treated as being [0.0 .. 1.0]. The polynomial is |
| 19 * evaluated on their unpremultiplied components. | 19 * evaluated on their unpremultiplied components. |
| 20 * | 20 * |
| 21 * k1=k2=k3=0, k4=1.0 results in returning opaque white | 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 | 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 | 23 * k1=k2=k4=0, k3=1.0 results in returning the dst |
| 24 * | |
| 25 * unpremultiply causes the rgb values to be unpremultiplied by their | |
| 26 * alpha before compositing, and remultiplied after. | |
| 24 */ | 27 */ |
| 25 static SkXfermode* Create(SkScalar k1, SkScalar k2, | 28 static SkXfermode* Create(SkScalar k1, SkScalar k2, |
| 26 SkScalar k3, SkScalar k4); | 29 SkScalar k3, SkScalar k4, bool unpremultiply); |
|
reed1
2013/06/11 21:45:40
If we want a runtime param (which is fine with me)
| |
| 27 | 30 |
| 28 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); | 31 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); |
| 29 | 32 |
| 30 private: | 33 private: |
| 31 typedef SkXfermode INHERITED; | 34 typedef SkXfermode INHERITED; |
| 32 }; | 35 }; |
| 33 | 36 |
| 34 #endif | 37 #endif |
| OLD | NEW |