Blender  V2.93
Operators.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include <iostream>
25 #include <vector>
26 
27 #include "Chain.h"
28 #include "ChainingIterators.h"
29 #include "Predicates0D.h"
30 #include "Predicates1D.h"
31 #include "StrokeShader.h"
32 
33 #include "../system/TimeStamp.h"
34 
35 #include "../view_map/Interface1D.h"
36 #include "../view_map/ViewMap.h"
37 
38 #ifdef WITH_CXX_GUARDEDALLOC
39 # include "MEM_guardedalloc.h"
40 #endif
41 
42 namespace Freestyle {
43 
49 class Operators {
50 
51  public:
52  typedef vector<Interface1D *> I1DContainer;
53  typedef vector<Stroke *> StrokesContainer;
54 
55  //
56  // Operators
57  //
59 
63  static int select(UnaryPredicate1D &pred);
64 
80  UnaryPredicate1D &pred,
81  UnaryFunction1D_void &modifier);
82 
97 
113 
128  static int bidirectionalChain(ChainingIterator &it);
129 
146  static int sequentialSplit(UnaryPredicate0D &startingPred,
147  UnaryPredicate0D &stoppingPred,
148  float sampling = 0.0f);
149 
161  static int sequentialSplit(UnaryPredicate0D &pred, float sampling = 0.0f);
162 
180  static int recursiveSplit(UnaryFunction0D<double> &func,
181  UnaryPredicate1D &pred,
182  float sampling = 0);
183 
208  static int recursiveSplit(UnaryFunction0D<double> &func,
209  UnaryPredicate0D &pred0d,
210  UnaryPredicate1D &pred,
211  float sampling = 0.0f);
212 
218  static int sort(BinaryPredicate1D &pred);
219 
227  static int create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders);
228 
229  //
230  // Data access
231  //
233 
234  static ViewEdge *getViewEdgeFromIndex(unsigned i)
235  {
236  return dynamic_cast<ViewEdge *>(_current_view_edges_set[i]);
237  }
238 
239  static Chain *getChainFromIndex(unsigned i)
240  {
241  return dynamic_cast<Chain *>(_current_chains_set[i]);
242  }
243 
244  static Stroke *getStrokeFromIndex(unsigned i)
245  {
246  return _current_strokes_set[i];
247  }
248 
249  static unsigned getViewEdgesSize()
250  {
251  return _current_view_edges_set.size();
252  }
253 
254  static unsigned getChainsSize()
255  {
256  return _current_chains_set.size();
257  }
258 
259  static unsigned getStrokesSize()
260  {
261  return _current_strokes_set.size();
262  }
263 
264  //
265  // Not exported in Python
266  //
268 
270  {
271  return &_current_strokes_set;
272  }
273 
274  static void reset(bool removeStrokes = true);
275 
276  private:
277  Operators()
278  {
279  }
280 
281  static I1DContainer _current_view_edges_set;
282  static I1DContainer _current_chains_set;
283  static I1DContainer *_current_set;
284  static StrokesContainer _current_strokes_set;
285 
286 #ifdef WITH_CXX_GUARDEDALLOC
287  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Operators")
288 #endif
289 };
290 
291 } /* namespace Freestyle */
Class to define a chain of viewedges.
Chaining iterators.
Read Guarded memory(de)allocation.
Class gathering stroke creation algorithms.
Class gathering stroke creation algorithms.
Class defining StrokeShader.
static int sort(BinaryPredicate1D &pred)
Definition: Operators.cpp:1068
static int select(UnaryPredicate1D &pred)
Definition: Operators.cpp:40
static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred, UnaryFunction1D_void &modifier)
Definition: Operators.cpp:82
static void reset(bool removeStrokes=true)
Definition: Operators.cpp:1317
static ViewEdge * getViewEdgeFromIndex(unsigned i)
Definition: Operators.h:234
static StrokesContainer * getStrokesSet()
Definition: Operators.h:269
vector< Interface1D * > I1DContainer
Definition: Operators.h:52
static int sequentialSplit(UnaryPredicate0D &startingPred, UnaryPredicate0D &stoppingPred, float sampling=0.0f)
Definition: Operators.cpp:594
static int recursiveSplit(UnaryFunction0D< double > &func, UnaryPredicate1D &pred, float sampling=0)
Definition: Operators.cpp:804
static unsigned getViewEdgesSize()
Definition: Operators.h:249
static int bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred)
Definition: Operators.cpp:329
static Stroke * getStrokeFromIndex(unsigned i)
Definition: Operators.h:244
static Chain * getChainFromIndex(unsigned i)
Definition: Operators.h:239
static int create(UnaryPredicate1D &pred, vector< StrokeShader * > shaders)
Definition: Operators.cpp:1273
static unsigned getStrokesSize()
Definition: Operators.h:259
vector< Stroke * > StrokesContainer
Definition: Operators.h:53
static unsigned getChainsSize()
Definition: Operators.h:254
IMAGE_Shaders shaders
Definition: image_shader.c:44
inherits from class Rep
Definition: AppCanvas.cpp:32