OpenShot Library | libopenshot 0.5.0
Loading...
Searching...
No Matches
ColorMap.h
Go to the documentation of this file.
1
8
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#include <array>
25
26namespace openshot
27{
28
35 class ColorMap : public EffectBase
36 {
37 private:
38 enum class LUTType { None, LUT1D, LUT3D };
39
40 std::string lut_path;
41 int lut_size;
42 std::vector<float> lut_data;
43 LUTType lut_type;
44 bool needs_refresh;
45 std::array<float, 3> lut_domain_min;
46 std::array<float, 3> lut_domain_max;
47
49 void init_effect_details();
50
52 void load_cube_file();
53
54 public:
59
61 ColorMap();
62
72 ColorMap(const std::string &path,
73 const Keyframe &i = Keyframe(1.0),
74 const Keyframe &iR = Keyframe(1.0),
75 const Keyframe &iG = Keyframe(1.0),
76 const Keyframe &iB = Keyframe(1.0));
77
79 std::shared_ptr<openshot::Frame>
80 GetFrame(int64_t frame_number) override
81 { return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
82
84 std::shared_ptr<openshot::Frame>
85 GetFrame(std::shared_ptr<openshot::Frame> frame,
86 int64_t frame_number) override;
87
88 // JSON serialization
89 std::string Json() const override;
90 Json::Value JsonValue() const override;
91 void SetJson(const std::string value) override;
92 void SetJsonValue(const Json::Value root) override;
93
95 std::string PropertiesJSON(int64_t requested_frame) const override;
96 };
97
98} // namespace openshot
99
100#endif // OPENSHOT_COLORMAP_EFFECT_H
Header file for EffectBase class.
Header file for JSON class.
Header file for the Keyframe class.
std::string Json() const override
Generate JSON string of this object.
Definition ColorMap.cpp:321
Keyframe intensity_r
Blend 0–1 for red channel.
Definition ColorMap.h:56
Keyframe intensity_b
Blend 0–1 for blue channel.
Definition ColorMap.h:58
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition ColorMap.cpp:326
Keyframe intensity_g
Blend 0–1 for green channel.
Definition ColorMap.h:57
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
Apply effect to a new frame.
Definition ColorMap.h:80
Keyframe intensity
Overall intensity 0–1 (affects all channels).
Definition ColorMap.h:55
ColorMap()
Blank constructor (used by JSON loader).
Definition ColorMap.cpp:149
void SetJson(const std::string value) override
Load JSON string into this object.
Definition ColorMap.cpp:338
std::string PropertiesJSON(int64_t requested_frame) const override
Expose properties (for UI).
Definition ColorMap.cpp:367
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition ColorMap.cpp:349
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:54
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 Compressor.h:29