Loading...
Searching...
No Matches
ColorMap.h
Go to the documentation of this file.
// Copyright (c) 2008-2025 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_COLORMAP_EFFECT_H
#define OPENSHOT_COLORMAP_EFFECT_H
#include "../EffectBase.h"
#include "../Json.h"
#include "../KeyFrame.h"
#include <QString>
#include <QFile>
#include <QTextStream>
#include <vector>
#include <string>
#include <array>
namespace openshot
{
class ColorMap : public EffectBase
{
private:
enum class LUTType { None, LUT1D, LUT3D };
std::string lut_path;
int lut_size;
std::vector<float> lut_data;
LUTType lut_type;
bool needs_refresh;
std::array<float, 3> lut_domain_min;
std::array<float, 3> lut_domain_max;
void init_effect_details();
void load_cube_file();
public:
Keyframe intensity;
Keyframe intensity_r;
Keyframe intensity_g;
Keyframe intensity_b;
ColorMap();
ColorMap(const std::string &path,
const Keyframe &i = Keyframe(1.0),
const Keyframe &iR = Keyframe(1.0),
const Keyframe &iG = Keyframe(1.0),
const Keyframe &iB = Keyframe(1.0));
std::shared_ptr<openshot::Frame>
GetFrame(int64_t frame_number) override
{ return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
std::shared_ptr<openshot::Frame>
GetFrame(std::shared_ptr<openshot::Frame> frame,
int64_t frame_number) override;
// JSON serialization
std::string Json() const override;
Json::Value JsonValue() const override;
void SetJson(const std::string value) override;
void SetJsonValue(const Json::Value root) override;
std::string PropertiesJSON(int64_t requested_frame) const override;
};
} // namespace openshot
#endif // OPENSHOT_COLORMAP_EFFECT_H
EffectBase.h
Header file for EffectBase class.
path
path
Definition FFmpegWriter.cpp:1468
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
openshot::ColorMap::Json
std::string Json() const override
Generate JSON string of this object.
Definition ColorMap.cpp:321
openshot::ColorMap::intensity_r
Keyframe intensity_r
Blend 0–1 for red channel.
Definition ColorMap.h:56
openshot::ColorMap::intensity_b
Keyframe intensity_b
Blend 0–1 for blue channel.
Definition ColorMap.h:58
openshot::ColorMap::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition ColorMap.cpp:326
openshot::ColorMap::intensity_g
Keyframe intensity_g
Blend 0–1 for green channel.
Definition ColorMap.h:57
openshot::ColorMap::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
Apply effect to a new frame.
Definition ColorMap.h:80
openshot::ColorMap::intensity
Keyframe intensity
Overall intensity 0–1 (affects all channels).
Definition ColorMap.h:55
openshot::ColorMap::ColorMap
ColorMap()
Blank constructor (used by JSON loader).
Definition ColorMap.cpp:149
openshot::ColorMap::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition ColorMap.cpp:338
openshot::ColorMap::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Expose properties (for UI).
Definition ColorMap.cpp:367
openshot::ColorMap::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition ColorMap.cpp:349
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:54
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
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29