29 this->m_inputProgram =
nullptr;
30 this->m_use_premultiply =
false;
35 this->m_use_premultiply = use_premultiply;
52 float inputBrightness[4];
53 float inputContrast[4];
55 this->m_inputBrightnessProgram->
readSampled(inputBrightness,
x,
y, sampler);
56 this->m_inputContrastProgram->
readSampled(inputContrast,
x,
y, sampler);
57 float brightness = inputBrightness[0];
58 float contrast = inputContrast[0];
60 float delta = contrast / 200.0f;
67 a = 1.0f - delta * 2.0f;
69 b =
a * (brightness - delta);
73 a =
max_ff(1.0f - delta * 2.0f, 0.0f);
74 b =
a * brightness + delta;
76 if (this->m_use_premultiply) {
79 output[0] =
a * inputValue[0] + b;
80 output[1] =
a * inputValue[1] + b;
81 output[2] =
a * inputValue[2] + b;
83 if (this->m_use_premultiply) {
90 this->m_inputProgram =
nullptr;
91 this->m_inputBrightnessProgram =
nullptr;
92 this->m_inputContrastProgram =
nullptr;
MINLINE float max_ff(float a, float b)
MINLINE void premul_to_straight_v4(float color[4])
MINLINE void straight_to_premul_v4(float color[4])
_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
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
void initExecution() override
void setUsePremultiply(bool use_premultiply)
void deinitExecution() override
void readSampled(float result[4], float x, float y, PixelSampler sampler)
void addInputSocket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void addOutputSocket(DataType datatype)
SocketReader * getInputSocketReader(unsigned int inputSocketindex)