Blender  V2.93
COM_MaskOperation.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  * Copyright 2012, Blender Foundation.
17  */
18 
19 #pragma once
20 
21 #include "BLI_listbase.h"
22 #include "COM_NodeOperation.h"
23 #include "DNA_mask_types.h"
24 #include "IMB_imbuf_types.h"
25 
26 /* Forward declarations. */
27 struct MaskRasterHandle;
28 
29 namespace blender::compositor {
30 
34 class MaskOperation : public NodeOperation {
35  protected:
37 
38  /* note, these are used more like aspect,
39  * but they _do_ impact on mask detail */
42  float m_maskWidthInv; /* 1 / m_maskWidth */
43  float m_maskHeightInv; /* 1 / m_maskHeight */
44  float m_mask_px_ofs[2];
45 
48 
50 
52  unsigned int m_rasterMaskHandleTot;
53 
57  void determineResolution(unsigned int resolution[2],
58  unsigned int preferredResolution[2]) override;
59 
60  public:
61  MaskOperation();
62 
63  void initExecution() override;
64  void deinitExecution() override;
65 
66  void setMask(Mask *mask)
67  {
68  this->m_mask = mask;
69  }
70  void setMaskWidth(int width)
71  {
72  this->m_maskWidth = width;
73  this->m_maskWidthInv = 1.0f / (float)width;
74  this->m_mask_px_ofs[0] = this->m_maskWidthInv * 0.5f;
75  }
77  {
78  this->m_maskHeight = height;
79  this->m_maskHeightInv = 1.0f / (float)height;
80  this->m_mask_px_ofs[1] = this->m_maskHeightInv * 0.5f;
81  }
82  void setFramenumber(int frame_number)
83  {
84  this->m_frame_number = frame_number;
85  }
86  void setFeather(bool feather)
87  {
88  this->m_do_feather = feather;
89  }
90 
91  void setMotionBlurSamples(int samples)
92  {
93  this->m_rasterMaskHandleTot = MIN2(MAX2(1, samples), CMP_NODE_MASK_MBLUR_SAMPLES_MAX);
94  }
95  void setMotionBlurShutter(float shutter)
96  {
97  this->m_frame_shutter = shutter;
98  }
99 
100  void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
101 };
102 
103 } // namespace blender::compositor
typedef float(TangentPoint)[2]
#define MAX2(a, b)
#define MIN2(a, b)
#define CMP_NODE_MASK_MBLUR_SAMPLES_MAX
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Contains defines and structs used throughout the imbuf module.
#define output
void setMotionBlurShutter(float shutter)
void setFramenumber(int frame_number)
struct MaskRasterHandle * m_rasterMaskHandles[CMP_NODE_MASK_MBLUR_SAMPLES_MAX]
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) override
NodeOperation contains calculation logic.
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)