20 #include "../bitmap/bitmap_access.h"
21 #include "../bitmap/processing.h"
22 #include "../color/color_spaces.h"
23 #include "../color/constants.h"
40 out_t
out(output,
x,
y);
45 for (
int i = 0; i < 4; i++)
46 matrixI[i] = matrixF[i];
75 BitmapProcessing::pipeline<Kernels::ApplyColorMatrix>(
76 *inputBitmap, *outputBitmap,
x,
y,
77 bias, matrix, allowIntApprox && inputBitmap->isInteger() && outputBitmap->isInteger(),
86 "uniform lowp mat4 transform;" \
87 "uniform lowp vec4 bias;";
90 "uniform highp mat4 transform;" \
91 "uniform highp vec4 bias;";
102 shader->setFloatMatrix4(
"transform", matrix);
109 allowIntApprox =
allow;
116 _[outChannel] =
bias;
118 matrix[outChannel].
r =
r;
119 matrix[outChannel].g =
g;
120 matrix[outChannel].b =
b;
121 matrix[outChannel].a =
a;
126 matrix =
Color::Matrix(hueDegrees, saturationFactor, valueFactor);
132 matrix =
Color::Matrix(preservedHue, saturationFactor, valueFactor);
A very basic class for any image.
void setBrightness(float brightness)
Sets a brightness adjustment by a given factor (non-cumulative with respect to the current transforma...
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.
void allowIntegerApproximations(bool allow)
void setHSVCorrection(float hueShiftDegrees, float saturationFactor=1.0f, float valueFactor=1.0f)
Resets the current transformation to a matrix performing standard HSV correction.
void setup(bool useGpu)
A callback run every time before the filter is applied to the image.
std::string getGlslSourceCode() const
Provides GLSL source code of the filter.
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.
std::string getGlslDeclarations() const
Provides GLSL declarations used in the GLSL code.
void apply(int x, int y, msize nPix, TaskThread &thread)
Applies filtering to given pixel data.
void applyContrast(float factor)
Applies a contrast adjustment by a given factor on top of the current transformation.
static const std::string GLSL_RGBA_INPUT
static void check(const datatype value, const datatype min, const datatype max, const char *message)
Application of a Color::Matrix on CPU.
static void process(AbstractBitmap &input, AbstractBitmap &output, int x, int y, const pixfloat4 &biasF, const Color::Matrix &matrixF, bool useIntApprox, msize nPix)
static const color4f ZERO_F
uint32_t msize
memory size
static const struct Beatmup::@1 CHANNELS_4
4-channel floating point arithmetic
4-channel integer arithmetic
jobject jlong jint jint jint jint g
jobject jlong jint jint jint jint jint b
jobject jlong jint jint y
jobject jlong jint jint jint r
jobject jlong jint jint jint jint jint jint a
JNIEnv jlong jint jfloat bias
layer getMapping().setCenterPosition(Beatmup jlong jfloat factor