]> git.sesse.net Git - movit/blob - luma_mix_effect.h
Add a inverse flag to LumaMixEffect.
[movit] / luma_mix_effect.h
1 #ifndef _MOVIT_LUMA_MIX_EFFECT_H
2 #define _MOVIT_LUMA_MIX_EFFECT_H 1
3
4 // Fade between two images based on a third monochrome one; lighter pixels
5 // will be faded before darker pixels (unless the inverse flag is set,
6 // in which case darker pixels will be faded before lighter pixels).
7 // This allows a wide range of different video wipes implemented using
8 // a single effect.
9 //
10 // Note that despite the name, the third input's _red_ channel is what's used
11 // for transitions; there is no luma calculation done. If you need that,
12 // put a SaturationEffect in front to desaturate (which calculates luma).
13
14 #include <string>
15
16 #include "effect.h"
17
18 namespace movit {
19
20 class LumaMixEffect : public Effect {
21 public:
22         LumaMixEffect();
23         virtual std::string effect_type_id() const { return "LumaMixEffect"; }
24         std::string output_fragment_shader();
25         virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
26
27         virtual bool needs_srgb_primaries() const { return false; }
28         virtual unsigned num_inputs() const { return 3; }
29         virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
30
31 private:
32         float transition_width, progress;
33         int inverse;  // 0 or 1.
34 };
35
36 }  // namespace movit
37
38 #endif // !defined(_MOVIT_MIX_EFFECT_H)