1 /*
2  */
3 
4 /*
5 
6     Copyright (C) 2014 Ferrero Andrea
7 
8     This program is free software: you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12 
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     GNU General Public License for more details.
17 
18     You should have received a copy of the GNU General Public License
19     along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21 
22  */
23 
24 /*
25 
26     These files are distributed with PhotoFlow - http://aferrero2707.github.io/PhotoFlow/
27 
28  */
29 
30 #ifndef PF_GMIC_INPAINT_H
31 #define PF_GMIC_INPAINT_H
32 
33 #include <iostream>
34 
35 #include "../../base/format_info.hh"
36 #include "../../base/operation.hh"
37 #include "../../base/processor.hh"
38 #include "../../base/rawbuffer.hh"
39 #include "../../base/rawbuffer.hh"
40 
41 #include "../draw.hh"
42 #include "../uniform.hh"
43 #include "gmic_untiled_op.hh"
44 
45 
46 namespace PF
47 {
48 
49   enum gmic_inpaint_display_mode_t {
50     GMIC_INPAINT_DRAW_MASK,
51     GMIC_INPAINT_DRAW_OUTPUT,
52   };
53 
54   class GmicInpaintPar: public GmicUntiledOperationPar
55   {
56     Property<int> patch_size;
57     Property<float> lookup_size;
58     Property<float> lookup_factor;
59     Property<float> blend_size;
60     Property<float> blend_threshold;
61     Property<float> blend_decay;
62     Property<int> blend_scales;
63     Property<int> allow_outer_blending;
64     Property<int> pen_size;
65     Property< std::list< Stroke<Pencil> > > strokes;
66     PropertyBase display_mode;
67 
68     Processor<PF::DrawPar,PF::DrawProc>* draw_op1;
69     Processor<PF::DrawPar,PF::DrawProc>* draw_op2;
70     PF::Processor<PF::BlenderPar,PF::BlenderProc>* maskblend;
71     Processor<PF::UniformPar,PF::Uniform>* black;
72     Processor<PF::UniformPar,PF::Uniform>* uniform;
73     ProcessorBase* invert;
74 
75     unsigned int scale_factor;
76 
77     Pencil pen;
78 
79   public:
80     GmicInpaintPar();
81     ~GmicInpaintPar();
82 
has_intensity()83     bool has_intensity() { return false; }
needs_input()84     bool needs_input() { return false; }
85 
get_pen()86     Pencil& get_pen() { return pen; }
87 
get_scale_factor()88     unsigned int get_scale_factor() { return scale_factor; }
89 
90     VipsImage* build(std::vector<VipsImage*>& in, int first,
91 		     VipsImage* imap, VipsImage* omap,
92 		     unsigned int& level);
93 
start_stroke()94     void start_stroke()
95     {
96       start_stroke( pen_size.get() );
97     }
98     void start_stroke( unsigned int pen_size );
99     void end_stroke();
100 
get_strokes()101     Property< std::list< Stroke<Pencil> > >& get_strokes() { return strokes; }
102 
103     void draw_point( unsigned int x, unsigned int y, VipsRect& update );
104   };
105 
106 
107 
108   template < OP_TEMPLATE_DEF >
109   class GmicInpaintProc
110   {
111   public:
render(VipsRegion ** ireg,int n,int in_first,VipsRegion * imap,VipsRegion * omap,VipsRegion * oreg,GmicInpaintPar * par)112     void render(VipsRegion** ireg, int n, int in_first,
113                 VipsRegion* imap, VipsRegion* omap,
114                 VipsRegion* oreg, GmicInpaintPar* par)
115     {
116     }
117   };
118 
119 
120   ProcessorBase* new_gmic_inpaint();
121 }
122 
123 #endif
124 
125 
126