Beatmup
|
Color matrix filter: applies mapping Ax + B at each pixel of a given image in RGBA space. More...
#include <color_matrix.h>
Public Member Functions | |
ColorMatrix () | |
bool | isIntegerApproximationsAllowed () const |
void | allowIntegerApproximations (bool allow) |
Color::Matrix & | getMatrix () |
void | setCoefficients (int outChannel, float bias, float r=.0f, float g=.0f, float b=.0f, float a=.0f) |
Sets color matrix coefficients for a specific output color channel. More... | |
void | setHSVCorrection (float hueShiftDegrees, float saturationFactor=1.0f, float valueFactor=1.0f) |
Resets the current transformation to a matrix performing standard HSV correction. More... | |
void | setColorInversion (color3f preservedHue, float saturationFactor=1.0f, float valueFactor=1.0f) |
Resets the current transformation to a fancy color inversion mode with a fixed hue point. More... | |
void | applyContrast (float factor) |
Applies a contrast adjustment by a given factor on top of the current transformation. More... | |
void | setBrightness (float brightness) |
Sets a brightness adjustment by a given factor (non-cumulative with respect to the current transformation) More... | |
Public Member Functions inherited from Beatmup::Filters::PixelwiseFilter | |
virtual | ~PixelwiseFilter () |
virtual void | setInput (AbstractBitmap *input) |
virtual void | setOutput (AbstractBitmap *output) |
AbstractBitmap * | getInput () |
AbstractBitmap * | getOutput () |
ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Protected Member Functions | |
void | apply (int x, int y, msize nPix, TaskThread &thread) |
Applies filtering to given pixel data. More... | |
std::string | getGlslDeclarations () const |
Provides GLSL declarations used in the GLSL code. More... | |
std::string | getGlslSourceCode () const |
Provides GLSL source code of the filter. More... | |
void | setup (bool useGpu) |
A callback run every time before the filter is applied to the image. More... | |
Protected Member Functions inherited from Beatmup::Filters::PixelwiseFilter | |
virtual bool | process (TaskThread &thread) final |
Executes the task on CPU within a given thread. More... | |
virtual bool | processOnGPU (GraphicPipeline &gpu, TaskThread &thread) final |
Executes the task on GPU. More... | |
virtual void | beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu) |
Instruction called before the task is executed. More... | |
virtual void | afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted) |
Instruction called after the task is executed. More... | |
virtual TaskDeviceRequirement | getUsedDevices () const final |
Communicates devices (CPU and/or GPU) the task is run on. More... | |
PixelwiseFilter () | |
Private Attributes | |
Color::Matrix | matrix |
the matrix More... | |
color4f | bias |
added constant More... | |
bool | allowIntApprox |
allow integer approximation of the coefficients More... | |
Additional Inherited Members | |
Public Types inherited from Beatmup::AbstractTask | |
enum class | TaskDeviceRequirement { CPU_ONLY , GPU_OR_CPU , GPU_ONLY } |
Specifies which device (CPU and/or GPU) is used to run the task. More... | |
Static Public Member Functions inherited from Beatmup::AbstractTask | |
static ThreadIndex | validThreadCount (int number) |
Valid thread count from a given integer value. More... | |
Protected Attributes inherited from Beatmup::Filters::PixelwiseFilter | |
AbstractBitmap * | inputBitmap |
AbstractBitmap * | outputBitmap |
ImageShader * | shader |
Static Protected Attributes inherited from Beatmup::Filters::PixelwiseFilter | |
static const std::string | GLSL_RGBA_INPUT |
Color matrix filter: applies mapping Ax + B at each pixel of a given image in RGBA space.
Definition at line 30 of file color_matrix.h.
Filters::ColorMatrix::ColorMatrix | ( | ) |
Definition at line 27 of file color_matrix.cpp.
|
protectedvirtual |
Applies filtering to given pixel data.
x | Horizontal position of the first pixel in image |
y | Vertical position of the first pixel in image |
nPix | Number of pixels to process |
thread | Calling thread descriptor |
Implements Beatmup::Filters::PixelwiseFilter.
Definition at line 74 of file color_matrix.cpp.
|
protectedvirtual |
Provides GLSL declarations used in the GLSL code.
Reimplemented from Beatmup::Filters::PixelwiseFilter.
Definition at line 83 of file color_matrix.cpp.
|
protectedvirtual |
Provides GLSL source code of the filter.
Implements Beatmup::Filters::PixelwiseFilter.
Definition at line 95 of file color_matrix.cpp.
|
protectedvirtual |
A callback run every time before the filter is applied to the image.
useGpu | If true , the filter will be run on GPU. |
Reimplemented from Beatmup::Filters::PixelwiseFilter.
Definition at line 100 of file color_matrix.cpp.
|
inline |
Definition at line 46 of file color_matrix.h.
void Filters::ColorMatrix::allowIntegerApproximations | ( | bool | allow | ) |
Definition at line 108 of file color_matrix.cpp.
|
inline |
Definition at line 50 of file color_matrix.h.
void Filters::ColorMatrix::setCoefficients | ( | int | outChannel, |
float | bias, | ||
float | r = .0f , |
||
float | g = .0f , |
||
float | b = .0f , |
||
float | a = .0f |
||
) |
Sets color matrix coefficients for a specific output color channel.
outChannel | matrix line number (output channel) |
bias | constant to add to the output channel |
r | red channel coefficient |
g | green channel coefficient |
b | blue channel coefficient |
a | alpha channel coefficient |
Definition at line 113 of file color_matrix.cpp.
void Filters::ColorMatrix::setHSVCorrection | ( | float | hueShiftDegrees, |
float | saturationFactor = 1.0f , |
||
float | valueFactor = 1.0f |
||
) |
Resets the current transformation to a matrix performing standard HSV correction.
hueShiftDegrees | Hue shift in degrees |
saturationFactor | Saturation scaling factor |
valueFactor | Value scaling factor |
Definition at line 125 of file color_matrix.cpp.
void Filters::ColorMatrix::setColorInversion | ( | color3f | preservedHue, |
float | saturationFactor = 1.0f , |
||
float | valueFactor = 1.0f |
||
) |
Resets the current transformation to a fancy color inversion mode with a fixed hue point.
preservedHue | Hue value to keep constant. The other colors are inverted |
saturationFactor | Saturation scaling factor (in HSV sense) |
valueFactor | Value scaling factor (in HSV sense) |
Definition at line 131 of file color_matrix.cpp.
void Filters::ColorMatrix::applyContrast | ( | float | factor | ) |
Applies a contrast adjustment by a given factor on top of the current transformation.
Definition at line 137 of file color_matrix.cpp.
void Filters::ColorMatrix::setBrightness | ( | float | brightness | ) |
|
private |
the matrix
Definition at line 32 of file color_matrix.h.
|
private |
added constant
Definition at line 33 of file color_matrix.h.
|
private |
allow integer approximation of the coefficients
Definition at line 34 of file color_matrix.h.