OpenShot Library | libopenshot  0.7.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
openshot::FilmGrain::GetFrame
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
openshot::FilmGrain::color_variation
Keyframe color_variation
RGB channel independence.
Definition: FilmGrain.h:48
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:56
openshot::FilmGrain::clump
Keyframe clump
Even vs clustered irregular structure.
Definition: FilmGrain.h:43
openshot::FilmGrain::amount
Keyframe amount
Overall grain intensity.
Definition: FilmGrain.h:40
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: AnimatedCurve.h:24
openshot::FilmGrain::seed
int seed
Deterministic grain identity.
Definition: FilmGrain.h:51
openshot::FilmGrain::Json
std::string Json() const override
Generate JSON string of this object.
Definition: FilmGrain.cpp:378
openshot::FilmGrain::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: FilmGrain.cpp:425
openshot::FilmGrain
Creative film-inspired grain texture effect.
Definition: FilmGrain.h:34
openshot::FilmGrain::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: FilmGrain.cpp:382
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition: KeyFrame.h:53
openshot::FilmGrain::FilmGrain
FilmGrain()
Definition: FilmGrain.cpp:92
openshot::FilmGrain::highlights
Keyframe highlights
Grain strength in bright regions.
Definition: FilmGrain.h:46
openshot::FilmGrain::coherence
Keyframe coherence
Smoothness/stability between frames.
Definition: FilmGrain.h:50
openshot::FilmGrain::softness
Keyframe softness
Crisp vs soft organic grain.
Definition: FilmGrain.h:42
openshot::FilmGrain::shadows
Keyframe shadows
Grain strength in dark regions.
Definition: FilmGrain.h:44
openshot::FilmGrain::size
Keyframe size
Fine to coarse grain scale.
Definition: FilmGrain.h:41
openshot::FilmGrain::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: FilmGrain.cpp:400
openshot::FilmGrain::midtones
Keyframe midtones
Grain strength in middle tonal regions.
Definition: FilmGrain.h:45
openshot::FilmGrain::evolution
Keyframe evolution
How much the grain renews over time.
Definition: FilmGrain.h:49
openshot::FilmGrain::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: FilmGrain.cpp:409
openshot::FilmGrain::color_amount
Keyframe color_amount
Chroma contribution amount.
Definition: FilmGrain.h:47