OpenShot Library | libopenshot  1.0.0
FilmGrain.h
Go to the documentation of this file.
1 
9 // Copyright (c) 2008-2026 OpenShot Studios, LLC
10 //
11 // SPDX-License-Identifier: LGPL-3.0-or-later
12 
13 #ifndef OPENSHOT_FILM_GRAIN_EFFECT_H
14 #define OPENSHOT_FILM_GRAIN_EFFECT_H
15 
16 #include "../EffectBase.h"
17 #include "../Frame.h"
18 #include "../Json.h"
19 #include "../KeyFrame.h"
20 
21 #include <memory>
22 #include <string>
23 
24 namespace openshot
25 {
34  class FilmGrain : public EffectBase
35  {
36  private:
37  void init_effect_details();
38 
39  public:
51  int seed;
52 
53  FilmGrain();
54 
55  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override {
56  return GetFrame(std::make_shared<openshot::Frame>(), frame_number);
57  }
58  std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
59 
60  std::string Json() const override;
61  void SetJson(const std::string value) override;
62  Json::Value JsonValue() const override;
63  void SetJsonValue(const Json::Value root) override;
64  std::string PropertiesJSON(int64_t requested_frame) const override;
65  };
66 }
67 
68 #endif
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:57
Creative film-inspired grain texture effect.
Definition: FilmGrain.h:35
std::string Json() const override
Generate JSON string of this object.
Definition: FilmGrain.cpp:378
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: FilmGrain.cpp:425
Keyframe clump
Even vs clustered irregular structure.
Definition: FilmGrain.h:43
Keyframe shadows
Grain strength in dark regions.
Definition: FilmGrain.h:44
Keyframe softness
Crisp vs soft organic grain.
Definition: FilmGrain.h:42
int seed
Deterministic grain identity.
Definition: FilmGrain.h:51
Keyframe highlights
Grain strength in bright regions.
Definition: FilmGrain.h:46
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: FilmGrain.cpp:409
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: FilmGrain.cpp:382
Keyframe color_amount
Chroma contribution amount.
Definition: FilmGrain.h:47
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object...
Definition: FilmGrain.h:55
Keyframe amount
Overall grain intensity.
Definition: FilmGrain.h:40
Keyframe coherence
Smoothness/stability between frames.
Definition: FilmGrain.h:50
Keyframe color_variation
RGB channel independence.
Definition: FilmGrain.h:48
Keyframe evolution
How much the grain renews over time.
Definition: FilmGrain.h:49
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: FilmGrain.cpp:400
Keyframe size
Fine to coarse grain scale.
Definition: FilmGrain.h:41
Keyframe midtones
Grain strength in middle tonal regions.
Definition: FilmGrain.h:45
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition: KeyFrame.h:53
This namespace is the default namespace for all code in the openshot library.
Definition: AnimatedCurve.h:24