aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrColorTableEffect.h
blob: 16d76ade7f931ac94865950fd82cc0f86b9eb67b (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
/*
 * 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 GrColorTableEffect_DEFINED
#define GrColorTableEffect_DEFINED

#include "GrSingleTextureEffect.h"
#include "GrTexture.h"

class GrGLColorTableEffect;

/**
 * LUT-based color transformation effect. This class implements the Gr
 * counterpart to the SkTable_ColorFilter effect. A 256 * 4 (single-channel)
 * LUT is used to transform the input colors of the image. 
 */
class GrColorTableEffect : public GrSingleTextureEffect {

public:

    GrColorTableEffect(GrTexture* texture);
    virtual ~GrColorTableEffect();

    static const char* Name() { return "ColorTable"; }
    virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
    virtual bool isEqual(const GrCustomStage&) const SK_OVERRIDE;

    virtual const GrTextureAccess* textureAccess(unsigned int index) const SK_OVERRIDE;

    typedef GrGLColorTableEffect GLProgramStage;

private:

    GrTextureAccess fTextureAccess;

    typedef GrSingleTextureEffect INHERITED;
};
#endif