OpenShot Library | libopenshot  0.7.0
ColorGrade.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_COLOR_GRADE_EFFECT_H
14 #define OPENSHOT_COLOR_GRADE_EFFECT_H
15 
16 #include "../AnimatedCurve.h"
17 #include "../EffectBase.h"
18 #include "../Color.h"
19 #include "../Frame.h"
20 #include "../Json.h"
21 #include "../KeyFrame.h"
22 #include "ColorMap.h"
23 
24 #include <QColor>
25 
26 #include <array>
27 #include <string>
28 #include <utility>
29 #include <vector>
30 
31 namespace openshot
32 {
40 
42  Json::Value JsonValue() const;
43  void SetJsonValue(const Json::Value& root);
44  QColor GetColor(int64_t frame_number) const;
45  float GetAmount(int64_t frame_number) const;
46  float GetLuma(int64_t frame_number) const;
47  };
48 
58 
60  Json::Value JsonValue() const;
61  void SetJsonValue(const Json::Value& root);
62  std::string Summary(int64_t frame_number) const;
63  bool IsEnabled(int64_t frame_number) const;
64  };
65 
73  class ColorGrade : public EffectBase
74  {
75  private:
76  ColorMap lut_effect;
77  std::string lut_path;
78  bool lut_dirty;
79 
80  void init_effect_details();
81  void sync_lut_effect();
82 
83  static float Clamp01(float value);
84 
85  public:
96 
102 
103  ColorGrade();
104 
105  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override {
106  return GetFrame(std::make_shared<openshot::Frame>(), frame_number);
107  }
108  std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
109 
110  std::string Json() const override;
111  Json::Value JsonValue() const override;
112  void SetJson(const std::string value) override;
113  void SetJsonValue(const Json::Value root) override;
114  std::string PropertiesJSON(int64_t requested_frame) const override;
115  };
116 }
117 
118 #endif
openshot::ColorGradeWheelEntry::GetAmount
float GetAmount(int64_t frame_number) const
Definition: ColorGrade.cpp:132
openshot::ColorGrade::wheels
ColorGradeWheelsData wheels
Definition: ColorGrade.h:97
openshot::ColorGradeWheelsData::midtones
ColorGradeWheelEntry midtones
Definition: ColorGrade.h:56
openshot::ColorGradeWheelEntry::SetJsonValue
void SetJsonValue(const Json::Value &root)
Definition: ColorGrade.cpp:106
openshot::ColorGradeWheelsData::Summary
std::string Summary(int64_t frame_number) const
Definition: ColorGrade.cpp:169
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:56
openshot::ColorGradeWheelsData::global
ColorGradeWheelEntry global
Definition: ColorGrade.h:54
openshot::ColorGrade::mix
Keyframe mix
Definition: ColorGrade.h:94
openshot::ColorGrade::curve_red
AnimatedCurve curve_red
Definition: ColorGrade.h:99
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: AnimatedCurve.h:24
openshot::ColorGradeWheelsData::enabled
Keyframe enabled
Definition: ColorGrade.h:53
openshot::AnimatedCurve
Definition: AnimatedCurve.h:49
openshot::ColorGradeWheelsData
All wheel controls for ColorGrade.
Definition: ColorGrade.h:52
openshot::ColorGrade::exposure
Keyframe exposure
Definition: ColorGrade.h:88
openshot::ColorGradeWheelEntry::amount
Keyframe amount
Definition: ColorGrade.h:38
openshot::ColorGrade::ColorGrade
ColorGrade()
Definition: ColorGrade.cpp:178
openshot::ColorGrade::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: ColorGrade.cpp:406
openshot::ColorGrade::curve_all
AnimatedCurve curve_all
Definition: ColorGrade.h:98
openshot::ColorGradeWheelEntry::ColorGradeWheelEntry
ColorGradeWheelEntry()
Definition: ColorGrade.cpp:88
openshot::ColorGrade::tint
Keyframe tint
Definition: ColorGrade.h:87
openshot::ColorGrade::Json
std::string Json() const override
Generate JSON string of this object.
Definition: ColorGrade.cpp:380
openshot::Color
This class represents a color (used on the timeline and clips)
Definition: Color.h:27
openshot::ColorGrade::vibrance
Keyframe vibrance
Definition: ColorGrade.h:93
openshot::ColorGradeWheelEntry::luma
Keyframe luma
Definition: ColorGrade.h:39
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::ColorGrade::saturation
Keyframe saturation
Definition: ColorGrade.h:92
openshot::ColorMap
Applies a 1D or 3D LUT (.cube) color transform to each frame.
Definition: ColorMap.h:35
openshot::ColorGrade::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: ColorGrade.cpp:415
openshot::ColorGrade::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: ColorGrade.cpp:384
openshot::ColorGrade::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: ColorGrade.cpp:456
openshot::ColorGrade::curve_green
AnimatedCurve curve_green
Definition: ColorGrade.h:100
openshot::ColorGradeWheelEntry
Wheel payload for a tonal region using native animated primitives.
Definition: ColorGrade.h:36
openshot::ColorGradeWheelEntry::JsonValue
Json::Value JsonValue() const
Definition: ColorGrade.cpp:91
openshot::ColorGrade::curve_blue
AnimatedCurve curve_blue
Definition: ColorGrade.h:101
openshot::ColorGradeWheelsData::IsEnabled
bool IsEnabled(int64_t frame_number) const
Definition: ColorGrade.cpp:174
openshot::ColorGradeWheelsData::ColorGradeWheelsData
ColorGradeWheelsData()
Definition: ColorGrade.cpp:140
openshot::ColorGradeWheelEntry::color
Color color
Definition: ColorGrade.h:37
openshot::ColorGrade
A unified beginner-friendly color grading effect.
Definition: ColorGrade.h:73
openshot::ColorGrade::shadows
Keyframe shadows
Definition: ColorGrade.h:91
openshot::ColorGrade::lut_intensity
Keyframe lut_intensity
Definition: ColorGrade.h:95
openshot::ColorGradeWheelEntry::GetColor
QColor GetColor(int64_t frame_number) const
Definition: ColorGrade.cpp:124
openshot::ColorGradeWheelsData::SetJsonValue
void SetJsonValue(const Json::Value &root)
Definition: ColorGrade.cpp:154
openshot::ColorGrade::highlights
Keyframe highlights
Definition: ColorGrade.h:90
openshot::ColorGradeWheelEntry::GetLuma
float GetLuma(int64_t frame_number) const
Definition: ColorGrade.cpp:136
openshot::ColorGrade::temperature
Keyframe temperature
Definition: ColorGrade.h:86
openshot::ColorGradeWheelsData::JsonValue
Json::Value JsonValue() const
Definition: ColorGrade.cpp:143
openshot::ColorGradeWheelsData::shadows
ColorGradeWheelEntry shadows
Definition: ColorGrade.h:55
ColorMap.h
Header file for ColorMap (LUT) effect.
openshot::ColorGrade::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: ColorGrade.h:105
openshot::ColorGrade::contrast
Keyframe contrast
Definition: ColorGrade.h:89
openshot::ColorGradeWheelsData::highlights
ColorGradeWheelEntry highlights
Definition: ColorGrade.h:57