blob: e677813288484230e1dddc96f6cb03b4d6dc41b7 [file] [log] [blame]
senorblanco@chromium.org86fc2662013-05-31 17:49:12 +00001/*
2 * Copyright 2013 The Android Open Source Project
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 SkXfermodeImageFilter_DEFINED
9#define SkXfermodeImageFilter_DEFINED
10
Brian Salomon89cb8212017-01-09 10:48:23 -050011#include "SkArithmeticImageFilter.h"
reed374772b2016-10-05 17:33:02 -070012#include "SkBlendMode.h"
senorblanco@chromium.org86fc2662013-05-31 17:49:12 +000013#include "SkImageFilter.h"
14
Mike Reed667a0072016-09-23 11:43:54 -040015/**
Brian Salomon89cb8212017-01-09 10:48:23 -050016 * This filter takes a SkBlendMode, and uses it to composite the foreground over the background.
17 * If foreground or background is NULL, the input bitmap (src) is used instead.
Mike Reed667a0072016-09-23 11:43:54 -040018 */
19class SK_API SkXfermodeImageFilter {
senorblanco@chromium.org86fc2662013-05-31 17:49:12 +000020public:
reed374772b2016-10-05 17:33:02 -070021 static sk_sp<SkImageFilter> Make(SkBlendMode, sk_sp<SkImageFilter> background,
Mike Reed667a0072016-09-23 11:43:54 -040022 sk_sp<SkImageFilter> foreground,
23 const SkImageFilter::CropRect* cropRect);
reed374772b2016-10-05 17:33:02 -070024 static sk_sp<SkImageFilter> Make(SkBlendMode mode, sk_sp<SkImageFilter> background) {
25 return Make(mode, std::move(background), nullptr, nullptr);
reedcfb6bdf2016-03-29 11:32:50 -070026 }
robertphillips8c0326d2016-04-05 12:48:34 -070027
Mike Reed667a0072016-09-23 11:43:54 -040028 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();
senorblanco@chromium.org86fc2662013-05-31 17:49:12 +000029
senorblanco@chromium.org86fc2662013-05-31 17:49:12 +000030private:
Mike Reed667a0072016-09-23 11:43:54 -040031 SkXfermodeImageFilter(); // can't instantiate
senorblanco@chromium.org86fc2662013-05-31 17:49:12 +000032};
33
34#endif