Blender  V2.93
COM_TranslateOperation.cc
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 2011, Blender Foundation.
17  */
18 
19 #include "COM_TranslateOperation.h"
20 
21 namespace blender::compositor {
22 
24 {
30  this->m_inputOperation = nullptr;
31  this->m_inputXOperation = nullptr;
32  this->m_inputYOperation = nullptr;
33  this->m_isDeltaSet = false;
34  this->m_factorX = 1.0f;
35  this->m_factorY = 1.0f;
36 }
38 {
39  this->m_inputOperation = this->getInputSocketReader(0);
40  this->m_inputXOperation = this->getInputSocketReader(1);
41  this->m_inputYOperation = this->getInputSocketReader(2);
42 }
43 
45 {
46  this->m_inputOperation = nullptr;
47  this->m_inputXOperation = nullptr;
48  this->m_inputYOperation = nullptr;
49 }
50 
52  float x,
53  float y,
54  PixelSampler /*sampler*/)
55 {
56  ensureDelta();
57 
58  float originalXPos = x - this->getDeltaX();
59  float originalYPos = y - this->getDeltaY();
60 
61  this->m_inputOperation->readSampled(output, originalXPos, originalYPos, PixelSampler::Bilinear);
62 }
63 
65  ReadBufferOperation *readOperation,
66  rcti *output)
67 {
68  rcti newInput;
69 
70  ensureDelta();
71 
72  newInput.xmin = input->xmin - this->getDeltaX();
73  newInput.xmax = input->xmax - this->getDeltaX();
74  newInput.ymin = input->ymin - this->getDeltaY();
75  newInput.ymax = input->ymax - this->getDeltaY();
76 
77  return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
78 }
79 
80 void TranslateOperation::setFactorXY(float factorX, float factorY)
81 {
82  m_factorX = factorX;
83  m_factorY = factorY;
84 }
85 
86 } // namespace blender::compositor
_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
#define output
void readSampled(float result[4], float x, float y, PixelSampler sampler)
void addInputSocket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void addOutputSocket(DataType datatype)
void setResolutionInputSocketIndex(unsigned int index)
set the index of the input socket that will determine the resolution of this operation
SocketReader * getInputSocketReader(unsigned int inputSocketindex)
virtual bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void setFactorXY(float factorX, float factorY)
int ymin
Definition: DNA_vec_types.h:80
int ymax
Definition: DNA_vec_types.h:80
int xmin
Definition: DNA_vec_types.h:79
int xmax
Definition: DNA_vec_types.h:79