/*
 * Copyright 2013 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkXfermodeImageFilter_DEFINED
#define SkXfermodeImageFilter_DEFINED

#include "SkArithmeticImageFilter.h"
#include "SkBlendMode.h"
#include "SkImageFilter.h"

/**
 * This filter takes a SkBlendMode, and uses it to composite the foreground over the background.
 * If foreground or background is NULL, the input bitmap (src) is used instead.
 */
class SK_API SkXfermodeImageFilter {
public:
    static sk_sp<SkImageFilter> Make(SkBlendMode, sk_sp<SkImageFilter> background,
                                     sk_sp<SkImageFilter> foreground,
                                     const SkImageFilter::CropRect* cropRect);
    static sk_sp<SkImageFilter> Make(SkBlendMode mode, sk_sp<SkImageFilter> background) {
        return Make(mode, std::move(background), nullptr, nullptr);
    }

    // Need to update chrome to use SkArithmeticImageFilter instead...
    static sk_sp<SkImageFilter> MakeArithmetic(float k1, float k2, float k3, float k4,
                                               bool enforcePMColor, sk_sp<SkImageFilter> background,
                                               sk_sp<SkImageFilter> foreground,
                                               const SkImageFilter::CropRect* cropRect) {
        return SkArithmeticImageFilter::Make(k1, k2, k3, k4, enforcePMColor, std::move(background),
                                             std::move(foreground), cropRect);
    }

    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();

private:
    SkXfermodeImageFilter();    // can't instantiate
};

#endif

/*
 * Copyright 2013 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkXfermodeImageFilter_DEFINED
#define SkXfermodeImageFilter_DEFINED

#include "SkArithmeticImageFilter.h"
#include "SkBlendMode.h"
#include "SkImageFilter.h"

/**
 * This filter takes a SkBlendMode, and uses it to composite the foreground over the background.
 * If foreground or background is NULL, the input bitmap (src) is used instead.
 */
class SK_API SkXfermodeImageFilter {
public:
    static sk_sp<SkImageFilter> Make(SkBlendMode, sk_sp<SkImageFilter> background,
                                     sk_sp<SkImageFilter> foreground,
                                     const SkImageFilter::CropRect* cropRect);
    static sk_sp<SkImageFilter> Make(SkBlendMode mode, sk_sp<SkImageFilter> background) {
        return Make(mode, std::move(background), nullptr, nullptr);
    }

    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();

private:
    SkXfermodeImageFilter();    // can't instantiate
};

#endif

Revert "Revert "remove unused api on xfermodeimagefilter""
Revert "Revert "remove unused api on xfermodeimagefilter""

This reverts commit 369f7eaeb06f21b1cb15e3dd3204ed883c5376f5.

Reason for revert: google3 updated

Original change's description:
> Revert "remove unused api on xfermodeimagefilter"
> 
> This reverts commit fcc4a071d9dff4f3bac0bd55dab8f69a4436d15d.
> 
> Reason for revert: broke google3 roll.
> 
> Original change's description:
> > remove unused api on xfermodeimagefilter
> > 
> > Bug: skia:
> > Change-Id: If99ee7b4d959d728849a20ee43a0d0ec25196f58
> > Reviewed-on: https://skia-review.googlesource.com/20303
> > Reviewed-by: Mike Reed <f5cabf8735907151a446812c9875d6c0c712d847@google.com>
> > Commit-Queue: Mike Reed <f5cabf8735907151a446812c9875d6c0c712d847@google.com>
> 
> TBR=f5cabf8735907151a446812c9875d6c0c712d847@google.com
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> 
> Change-Id: I80e8b1e9009263a61230d22a988a9bb5ba7e162d
> Reviewed-on: https://skia-review.googlesource.com/20320
> Reviewed-by: Hal Canary <halcanary@google.com>
> Commit-Queue: Hal Canary <halcanary@google.com>

TBR=halcanary@google.com,f5cabf8735907151a446812c9875d6c0c712d847@google.com

Change-Id: Icaa72fe6b1586cb76b37ab88ee1950628048d4ac
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/20312
Reviewed-by: Mike Reed <f5cabf8735907151a446812c9875d6c0c712d847@google.com>
Commit-Queue: Mike Reed <f5cabf8735907151a446812c9875d6c0c712d847@google.com>
