OpenShot Library | libopenshot  0.5.0
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 
25 namespace openshot
26 {
30  };
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:
55  int mask_mode;
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
openshot::Pixelate::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: Pixelate.h:76
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:56
openshot::Pixelate::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Pixelate.cpp:194
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Pixelate::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Pixelate.cpp:173
openshot::Pixelate::pixelization
Keyframe pixelization
Amount of pixelization.
Definition: Pixelate.h:50
openshot::PIXELATE_MASK_LIMIT_TO_AREA
@ PIXELATE_MASK_LIMIT_TO_AREA
Definition: Pixelate.h:28
openshot::Pixelate
This class pixelates an image, and can be animated with openshot::Keyframe curves over time.
Definition: Pixelate.h:38
openshot::Pixelate::UseCustomMaskBlend
bool UseCustomMaskBlend(int64_t frame_number) const override
Optional override for effects that need custom mask behavior.
Definition: Pixelate.cpp:94
openshot::Pixelate::Json
std::string Json() const override
Generate JSON string of this object.
Definition: Pixelate.cpp:132
openshot::Pixelate::bottom
Keyframe bottom
Size of bottom margin.
Definition: Pixelate.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::Pixelate::right
Keyframe right
Size of right margin.
Definition: Pixelate.h:53
openshot::Pixelate::ApplyCustomMaskBlend
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
openshot::Pixelate::left
Keyframe left
Size of left margin.
Definition: Pixelate.h:51
openshot::Pixelate::Pixelate
Pixelate()
Default constructor, useful when using Json to load the effect properties.
Definition: Pixelate.cpp:25
openshot::PixelateMaskMode
PixelateMaskMode
Definition: Pixelate.h:27
openshot::Pixelate::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Pixelate.cpp:139
openshot::Pixelate::top
Keyframe top
Size of top margin.
Definition: Pixelate.h:52
openshot::PIXELATE_MASK_VARY_STRENGTH
@ PIXELATE_MASK_VARY_STRENGTH
Definition: Pixelate.h:29
openshot::Pixelate::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Pixelate.cpp:156
openshot::Pixelate::mask_mode
int mask_mode
Mask behavior mode for this effect.
Definition: Pixelate.h:55