aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-10 19:36:56 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-10 19:36:56 +0000
commite51755fc64bf5df4bed9d74f4bca4f70897d59a9 (patch)
tree26af873fcb5594d432df8aceea0c1b3df3459657 /include/effects
parent6b20c2ded4bc546853719c88d1cf13b36fd89bcb (diff)
add first cut at arithmetic mode
git-svn-id: http://skia.googlecode.com/svn/trunk@2849 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/effects')
-rw-r--r--include/effects/SkArithmeticMode.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/effects/SkArithmeticMode.h b/include/effects/SkArithmeticMode.h
new file mode 100644
index 0000000000..70d660f075
--- /dev/null
+++ b/include/effects/SkArithmeticMode.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkArithmeticMode_DEFINED
+#define SkArithmeticMode_DEFINED
+
+#include "SkXfermode.h"
+
+class SkArithmeticMode : public SkXfermode {
+public:
+ /**
+ * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4]
+ *
+ * src and dst are treated as being [0.0 .. 1.0]. The polynomial is
+ * evaluated on their unpremultiplied components.
+ *
+ * k1=k2=k3=0, k4=1.0 results in returning opaque white
+ * k1=k3=k4=0, k2=1.0 results in returning the src
+ * k1=k2=k4=0, k3=1.0 results in returning the dst
+ */
+ static SkXfermode* Create(SkScalar k1, SkScalar k2,
+ SkScalar k3, SkScalar k4);
+};
+
+#endif
+