senorblanco@chromium.org | 86fc266 | 2013-05-31 17:49:12 +0000 | [diff] [blame] | 1 | /* |
| 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 Salomon | 89cb821 | 2017-01-09 10:48:23 -0500 | [diff] [blame] | 11 | #include "SkArithmeticImageFilter.h" |
reed | 374772b | 2016-10-05 17:33:02 -0700 | [diff] [blame] | 12 | #include "SkBlendMode.h" |
senorblanco@chromium.org | 86fc266 | 2013-05-31 17:49:12 +0000 | [diff] [blame] | 13 | #include "SkImageFilter.h" |
| 14 | |
Mike Reed | 667a007 | 2016-09-23 11:43:54 -0400 | [diff] [blame] | 15 | /** |
Brian Salomon | 89cb821 | 2017-01-09 10:48:23 -0500 | [diff] [blame] | 16 | * 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 Reed | 667a007 | 2016-09-23 11:43:54 -0400 | [diff] [blame] | 18 | */ |
| 19 | class SK_API SkXfermodeImageFilter { |
senorblanco@chromium.org | 86fc266 | 2013-05-31 17:49:12 +0000 | [diff] [blame] | 20 | public: |
reed | 374772b | 2016-10-05 17:33:02 -0700 | [diff] [blame] | 21 | static sk_sp<SkImageFilter> Make(SkBlendMode, sk_sp<SkImageFilter> background, |
Mike Reed | 667a007 | 2016-09-23 11:43:54 -0400 | [diff] [blame] | 22 | sk_sp<SkImageFilter> foreground, |
| 23 | const SkImageFilter::CropRect* cropRect); |
reed | 374772b | 2016-10-05 17:33:02 -0700 | [diff] [blame] | 24 | static sk_sp<SkImageFilter> Make(SkBlendMode mode, sk_sp<SkImageFilter> background) { |
| 25 | return Make(mode, std::move(background), nullptr, nullptr); |
reed | cfb6bdf | 2016-03-29 11:32:50 -0700 | [diff] [blame] | 26 | } |
robertphillips | 8c0326d | 2016-04-05 12:48:34 -0700 | [diff] [blame] | 27 | |
Mike Klein | fa5f6ce | 2018-10-20 08:21:31 -0400 | [diff] [blame] | 28 | static void RegisterFlattenables(); |
senorblanco@chromium.org | 86fc266 | 2013-05-31 17:49:12 +0000 | [diff] [blame] | 29 | |
senorblanco@chromium.org | 86fc266 | 2013-05-31 17:49:12 +0000 | [diff] [blame] | 30 | private: |
Mike Reed | 667a007 | 2016-09-23 11:43:54 -0400 | [diff] [blame] | 31 | SkXfermodeImageFilter(); // can't instantiate |
senorblanco@chromium.org | 86fc266 | 2013-05-31 17:49:12 +0000 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | #endif |