aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrMorphologyEffect.h
blob: c784460819b69c20696c18002252e1ee0708a714 (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
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrMorphologyEffect_DEFINED
#define GrMorphologyEffect_DEFINED

#include "GrContext.h"
#include "Gr1DKernelEffect.h"

class GrGLMorphologyEffect;

/**
 * Morphology effects. Depending upon the type of morphology, either the
 * component-wise min (Erode_Type) or max (Dilate_Type) of all pixels in the
 * kernel is selected as the new color. The new color is modulated by the input
 * color.
 */
class GrMorphologyEffect : public Gr1DKernelEffect {

public:

    typedef GrContext::MorphologyType MorphologyType;

    GrMorphologyEffect(Direction, int radius, MorphologyType);
    virtual ~GrMorphologyEffect();

    MorphologyType type() const { return fType; }

    static const char* Name() { return "Morphology"; }

    typedef GrGLMorphologyEffect GLProgramStage;

    virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
    virtual bool isEqual(const GrCustomStage&) const SK_OVERRIDE;

protected:

    MorphologyType fType;

private:

    typedef Gr1DKernelEffect INHERITED;
};
#endif