blob: e00ea32cc45b1f2f5203a01ed16b02ff493cd281 [file] [log] [blame]
mike@reedtribe.orge51755f2011-12-10 19:36:56 +00001/*
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.orgc0b7e102013-10-23 17:06:21 +000011#include "SkFlattenable.h"
12#include "SkScalar.h"
reedcfb6bdf2016-03-29 11:32:50 -070013#include "SkXfermode.h"
commit-bot@chromium.orgc0b7e102013-10-23 17:06:21 +000014
Mike Reed403d1542016-09-26 18:51:24 -040015#ifdef SK_SUPPORT_LEGACY_ARITHMETICMODE
16
commit-bot@chromium.orgc0b7e102013-10-23 17:06:21 +000017class SK_API SkArithmeticMode {
mike@reedtribe.orge51755f2011-12-10 19:36:56 +000018public:
19 /**
20 * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4]
21 *
mike@reedtribe.orge51755f2011-12-10 19:36:56 +000022 * k1=k2=k3=0, k4=1.0 results in returning opaque white
23 * k1=k3=k4=0, k2=1.0 results in returning the src
24 * k1=k2=k4=0, k3=1.0 results in returning the dst
25 */
reedcfb6bdf2016-03-29 11:32:50 -070026 static sk_sp<SkXfermode> Make(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4,
27 bool enforcePMColor = true);
robertphillips@google.comb83b6b42013-01-22 14:32:09 +000028
senorblanco@chromium.org9a6eb0e2013-05-29 20:55:09 +000029 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();
30
robertphillips@google.comb83b6b42013-01-22 14:32:09 +000031private:
commit-bot@chromium.orgc0b7e102013-10-23 17:06:21 +000032 SkArithmeticMode(); // can't be instantiated
mike@reedtribe.orge51755f2011-12-10 19:36:56 +000033};
34
35#endif
Mike Reed403d1542016-09-26 18:51:24 -040036
37#endif