aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkAlphaThresholdFilter.h
blob: aee365f99986b8f996f699bc3433e4c5895a03f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkAlphaThresholdFilter_DEFINED
#define SkAlphaThresholdFilter_DEFINED

#include "SkImageFilter.h"
#include "SkRegion.h"

class SK_API SkAlphaThresholdFilter {
public:
    /**
     * Creates an image filter that samples a region. If the sample is inside the
     * region the alpha of the image is boosted up to a threshold value. If it is
     * outside the region then the alpha is decreased to the threshold value.
     * The 0,0 point of the region corresponds to the upper left corner of the
     * source image.
     */
    static sk_sp<SkImageFilter> Make(const SkRegion& region, SkScalar innerMin,
                                     SkScalar outerMax, sk_sp<SkImageFilter> input);


#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
    static SkImageFilter* Create(const SkRegion& region, SkScalar innerMin,
                                 SkScalar outerMax, SkImageFilter* input = nullptr) {
        return Make(region, innerMin, outerMax, sk_ref_sp<SkImageFilter>(input)).release();
    }
#endif

    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();
};

#endif