public static final String CONTRAST_FRAGMENT_SHADER = "" + "varying highp vec2 textureCoordinate;\n" + " \n" + " uniform sampler2D inputImageTexture;\n" + " uniform lowp float contrast;\n" + " \n" + " void main()\n" + " {\n" + " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + " \n" + " gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + vec3(0.5)), textureColor.w);\n" + " }"; Contrast shader:
public static final String BRIGHTNESS_FRAGMENT_SHADERvarying =highp ""vec2 textureCoordinate;
+
"varying highp vec2 textureCoordinate;\n"uniform sampler2D inputImageTexture;
+uniform "lowp \n"float contrast;
+
" uniform sampler2D inputImageTexture;\n"void main()
+{
" uniform lowp floatvec4 brightness;\n"textureColor = texture2D(inputImageTexture, textureCoordinate);
gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + "vec3(0.5)), \n"textureColor.w);
+}
Brightness shader:
" varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float brightness;
void main()\n"
+ " {\n"
+ " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n";
+ " \n"
+ " gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);\n";
+ " }";
public static final String CONTRAST_BRIGHTNESS_FRAGMENT_SHADER = ""
+ "varyingvarying highp vec2 textureCoordinate;\n"textureCoordinate;
+ " uniform sampler2D inputImageTexture;\n"inputImageTexture;
+ "varyingvarying highp vec2 textureCoordinate2;\n"textureCoordinate2;
+ " uniform sampler2D inputImageTexture2;\n"inputImageTexture2;
+ " uniform lowp float contrast;\n"contrast;
+ " uniform lowp float brightness;\n"brightness;
+ " \n"
+ " void main()\n"
+ " {\n"
+ " lowp vec4 textureColorForContrast = texture2D(inputImageTexture, textureCoordinate);\n";
+ " \n"
+ " lowp vec4 contastVec4 = vec4(((textureColorForContrast.rgb - vec3(0.5)) * contrast + vec3(0.5)), textureColorForContrast.w);\n";
+ " lowp vec4 textureColorForBrightness = texture2D(inputImageTexture2, textureCoordinate2);\n";
+ " \n"
+ " lowp vec4 brightnessVec4 = vec4((textureColorForBrightness.rgb + vec3(brightness)), textureColorForBrightness.w);\n";
+ " gl_FragColor = contastVec4 + brightnessVec4;\n"brightnessVec4;
+ " }";