skia2/include/effects/SkArithmeticMode.h
Mike Reed 403d154591 Revert "Revert "replace Arithmetic xfermode with imagefilter""
This reverts commit 10ff5bfa78.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2680
TBR=
Change-Id: Iac2f4d48d227ff426ccf02b7eae280f382ad3580
Reviewed-on: https://skia-review.googlesource.com/2680
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2016-09-27 10:33:06 +00:00

45 lines
1.2 KiB
C++

/*
* 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 "SkFlattenable.h"
#include "SkScalar.h"
#include "SkXfermode.h"
#ifdef SK_SUPPORT_LEGACY_ARITHMETICMODE
class SK_API SkArithmeticMode {
public:
/**
* result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4]
*
* 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 sk_sp<SkXfermode> Make(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4,
bool enforcePMColor = true);
#ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR
static SkXfermode* Create(SkScalar k1, SkScalar k2,
SkScalar k3, SkScalar k4,
bool enforcePMColor = true) {
return Make(k1, k2, k3, k4, enforcePMColor).release();
}
#endif
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();
private:
SkArithmeticMode(); // can't be instantiated
};
#endif
#endif