Skip to content

Commit

Permalink
fill white with layer 0
Browse files Browse the repository at this point in the history
  • Loading branch information
lostjared committed Mar 20, 2024
1 parent 1158a5f commit cc02e2d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
4 changes: 4 additions & 0 deletions glitch.gui/filters/layer_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ void add_layer_filters(Layer &layer1, Layer &layer2, Layer &layer3) {
z_fill->setLayer(&layer1);
new_filter_list.push_back({"New_Layer_0_Fill_Zero", z_fill});

Layer_Fill_White *w_fill = new Layer_Fill_White();
w_fill->setLayer(&layer1);
new_filter_list.push_back({"New_Layer_0_Fill_White", w_fill});

ThreshEffect_Layer *t_l = new ThreshEffect_Layer ();
t_l->initLayer(&layer1);
new_filter_list.push_back({"New_Layer_0_Threshold_Rand", t_l});
Expand Down
36 changes: 32 additions & 4 deletions glitch.gui/filters/layer_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,38 @@ class Layer_Fill_Zero : public FilterFunc {
Layer *layer_;
};

class Layer_Fill_White : public FilterFunc {
public:
void init() override {

}
void setLayer(Layer *layer) {
layer_ = layer;
}
void proc(cv::Mat &frame) override {
cv::Mat layer1;
if(layer_->hasNext()) {
if(layer_->read(layer1)) {
cv::Mat resized;
cv::resize(layer1, resized, frame.size());
for(int z = 0; z < frame.rows; ++z) {
for(int i = 0; i < frame.cols; ++i) {
cv::Vec3b &pix1 = frame.at<cv::Vec3b>(z, i);
if(pix1[0] > 225 && pix1[1] > 225 && pix1[2] > 225) {
setvec(pix1,resized.at<cv::Vec3b>(z, i));
}
}
}
}
}
}
void clear() override {

}
private:
Layer *layer_;
};

class Layer0_Wave : public FilterFunc {
public:
void init() override {
Expand Down Expand Up @@ -3390,12 +3422,8 @@ class AugmentedSketchesEffect : public FilterFunc {
cv::cvtColor(edges, sketchFrame, cv::COLOR_GRAY2BGR);
return sketchFrame;
}

};


void add_layer_filters(Layer&,Layer&,Layer&);



#endif

0 comments on commit cc02e2d

Please sign in to comment.