OpenShot Library | libopenshot 0.6.0
Loading...
Searching...
No Matches
Pixelate.h
Go to the documentation of this file.
1
9// Copyright (c) 2008-2019 OpenShot Studios, LLC
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#ifndef OPENSHOT_PIXELATE_EFFECT_H
14#define OPENSHOT_PIXELATE_EFFECT_H
15
16#include "../EffectBase.h"
17
18#include "../Frame.h"
19#include "../Json.h"
20#include "../KeyFrame.h"
21
22#include <memory>
23#include <string>
24
25namespace openshot
26{
31
38 class Pixelate : public EffectBase
39 {
40 private:
42 void init_effect_details();
43
44 protected:
45 bool UseCustomMaskBlend(int64_t frame_number) const override;
46 void ApplyCustomMaskBlend(std::shared_ptr<QImage> original_image, std::shared_ptr<QImage> effected_image,
47 std::shared_ptr<QImage> mask_image, int64_t frame_number) const override;
48
49 public:
56
58 Pixelate();
59
68
75 std::shared_ptr<openshot::Frame>
76 GetFrame(int64_t frame_number) override {
77 return GetFrame(std::make_shared<openshot::Frame>(),
78 frame_number);
79 }
80
90 std::shared_ptr<openshot::Frame>
91 GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
92
93 // Get and Set JSON methods
94 std::string Json() const override;
95 void SetJson(const std::string value) override;
96 Json::Value JsonValue() const override;
97 void SetJsonValue(const Json::Value root) override;
98
101 std::string PropertiesJSON(int64_t requested_frame) const override;
102 };
103
104}
105
106#endif
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:57
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition KeyFrame.h:53
This class pixelates an image, and can be animated with openshot::Keyframe curves over time.
Definition Pixelate.h:39
bool UseCustomMaskBlend(int64_t frame_number) const override
Optional override for effects that need custom mask behavior.
Definition Pixelate.cpp:94
Pixelate()
Default constructor, useful when using Json to load the effect properties.
Definition Pixelate.cpp:25
int mask_mode
Mask behavior mode for this effect.
Definition Pixelate.h:55
Keyframe right
Size of right margin.
Definition Pixelate.h:53
std::string Json() const override
Generate JSON string of this object.
Definition Pixelate.cpp:132
std::string PropertiesJSON(int64_t requested_frame) const override
Definition Pixelate.cpp:194
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 Pixelate.h:76
Keyframe pixelization
Amount of pixelization.
Definition Pixelate.h:50
Keyframe left
Size of left margin.
Definition Pixelate.h:51
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition Pixelate.cpp:139
void SetJson(const std::string value) override
Load JSON string into this object.
Definition Pixelate.cpp:156
void ApplyCustomMaskBlend(std::shared_ptr< QImage > original_image, std::shared_ptr< QImage > effected_image, std::shared_ptr< QImage > mask_image, int64_t frame_number) const override
Optional override for effects with custom mask implementation.
Definition Pixelate.cpp:99
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition Pixelate.cpp:173
Keyframe top
Size of top margin.
Definition Pixelate.h:52
Keyframe bottom
Size of bottom margin.
Definition Pixelate.h:54
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29
PixelateMaskMode
Definition Pixelate.h:27
@ PIXELATE_MASK_VARY_STRENGTH
Definition Pixelate.h:29
@ PIXELATE_MASK_LIMIT_TO_AREA
Definition Pixelate.h:28