diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-06 17:45:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-06 17:45:11 +0400 |
commit | 2b8ac9bc616d9a9cd8f303228efc30fdc9dd38a1 (patch) | |
tree | 96d17992548f206d12feca81d911ca7c82b131fb /source/blender/compositor/operations/COM_InpaintOperation.h | |
parent | 731c6ebec441ac577498e5673679df9e2a7d9bee (diff) |
inpaint node from tomato branch by Peter Schlaile
http://en.wikipedia.org/wiki/Inpainting
Diffstat (limited to 'source/blender/compositor/operations/COM_InpaintOperation.h')
-rw-r--r-- | source/blender/compositor/operations/COM_InpaintOperation.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h new file mode 100644 index 00000000000..0ff65174161 --- /dev/null +++ b/source/blender/compositor/operations/COM_InpaintOperation.h @@ -0,0 +1,76 @@ +/* + * Copyright 2011, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor: Peter Schlaile + * Jeroen Bakker + * Monique Dewanchand + */ + +#ifndef _COM_InpaintOperation_h +#define _COM_InpaintOperation_h +#include "COM_NodeOperation.h" + +class InpaintSimpleOperation : public NodeOperation { +protected: + /** + * Cached reference to the inputProgram + */ + SocketReader *m_inputImageProgram; + + int m_iterations; + + float *m_cached_buffer; + bool m_cached_buffer_ready; + + int *m_pixelorder; + int m_area_size; + short *m_manhatten_distance; +public: + InpaintSimpleOperation(); + + /** + * the inner loop of this program + */ + void executePixel(float *color, int x, int y, void *data); + + /** + * Initialize the execution + */ + void initExecution(); + + void *initializeTileData(rcti *rect); + /** + * Deinitialize the execution + */ + void deinitExecution(); + + void setIterations(int iterations) { this->m_iterations = iterations; } + + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); + +private: + void calc_manhatten_distance(); + void clamp_xy(int & x, int & y); + float get(int x, int y, int component); + void set(int x, int y, int component, float v); + int mdist(int x, int y); + bool next_pixel(int & x, int & y, int & curr, int iters); + void pix_step(int x, int y); +}; + + +#endif |