OpenShot Library | libopenshot  0.4.0
ColorMap.h
Go to the documentation of this file.
1 
9 // Copyright (c) 2008-2025 OpenShot Studios, LLC
10 //
11 // SPDX-License-Identifier: LGPL-3.0-or-later
12 
13 #ifndef OPENSHOT_COLORMAP_EFFECT_H
14 #define OPENSHOT_COLORMAP_EFFECT_H
15 
16 #include "../EffectBase.h"
17 #include "../Json.h"
18 #include "../KeyFrame.h"
19 #include <QString>
20 #include <QFile>
21 #include <QTextStream>
22 #include <vector>
23 #include <string>
24 
25 namespace openshot
26 {
27 
34  class ColorMap : public EffectBase
35  {
36  private:
37  std::string lut_path;
38  int lut_size;
39  std::vector<float> lut_data;
40  bool needs_refresh;
41 
43  void init_effect_details();
44 
46  void load_cube_file();
47 
48  public:
53 
55  ColorMap();
56 
66  ColorMap(const std::string &path,
67  const Keyframe &i = Keyframe(1.0),
68  const Keyframe &iR = Keyframe(1.0),
69  const Keyframe &iG = Keyframe(1.0),
70  const Keyframe &iB = Keyframe(1.0));
71 
73  std::shared_ptr<openshot::Frame>
74  GetFrame(int64_t frame_number) override
75  { return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
76 
78  std::shared_ptr<openshot::Frame>
79  GetFrame(std::shared_ptr<openshot::Frame> frame,
80  int64_t frame_number) override;
81 
82  // JSON serialization
83  std::string Json() const override;
84  Json::Value JsonValue() const override;
85  void SetJson(const std::string value) override;
86  void SetJsonValue(const Json::Value root) override;
87 
89  std::string PropertiesJSON(int64_t requested_frame) const override;
90  };
91 
92 } // namespace openshot
93 
94 #endif // OPENSHOT_COLORMAP_EFFECT_H
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::ColorMap::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
Apply effect to a new frame.
Definition: ColorMap.h:74
openshot::ColorMap::ColorMap
ColorMap()
Blank constructor (used by JSON loader)
Definition: ColorMap.cpp:103
openshot::ColorMap::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: ColorMap.cpp:238
openshot::ColorMap::intensity
Keyframe intensity
Overall intensity 0–1 (affects all channels)
Definition: ColorMap.h:49
openshot::ColorMap::intensity_g
Keyframe intensity_g
Blend 0–1 for green channel.
Definition: ColorMap.h:51
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::ColorMap::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: ColorMap.cpp:261
openshot::ColorMap::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: ColorMap.cpp:250
openshot::ColorMap
Applies a 3D LUT (.cube) color transform to each frame.
Definition: ColorMap.h:34
path
path
Definition: FFmpegWriter.cpp:1476
openshot::ColorMap::Json
std::string Json() const override
Generate JSON string of this object.
Definition: ColorMap.cpp:233
openshot::ColorMap::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Expose properties (for UI)
Definition: ColorMap.cpp:279
openshot::ColorMap::intensity_b
Keyframe intensity_b
Blend 0–1 for blue channel.
Definition: ColorMap.h:52
openshot::ColorMap::intensity_r
Keyframe intensity_r
Blend 0–1 for red channel.
Definition: ColorMap.h:50