diff --git a/library/src/main/jni/Android.mk b/library/src/main/jni/Android.mk index 0d02aa38..3b25df52 100644 --- a/library/src/main/jni/Android.mk +++ b/library/src/main/jni/Android.mk @@ -74,7 +74,6 @@ LOCAL_SRC_FILES := \ $(CGE_SOURCE)/filters/cgeEdgeFilter.cpp \ $(CGE_SOURCE)/filters/cgeEmbossFilter.cpp \ \ - $(CGE_SOURCE)/filters/cgeHistogramFilter.cpp \ $(CGE_SOURCE)/filters/cgeWaveformFilter.cpp \ \ $(CGE_SOURCE)/filters/cgeCrosshatchFilter.cpp \ diff --git a/library/src/main/jni/cge/filters/cgeAdvancedEffects.cpp b/library/src/main/jni/cge/filters/cgeAdvancedEffects.cpp index bf161dc2..8ba92182 100644 --- a/library/src/main/jni/cge/filters/cgeAdvancedEffects.cpp +++ b/library/src/main/jni/cge/filters/cgeAdvancedEffects.cpp @@ -137,11 +137,6 @@ CGEBeautifyFilter* createBeautifyFilter() COMMON_FUNC(CGEBeautifyFilter); } -CGEHistogramFilter* createHistogramFilter() -{ - COMMON_FUNC(CGEHistogramFilter); -} - CGEWaveformFilter* createWaveformFilter() { COMMON_FUNC(CGEWaveformFilter); diff --git a/library/src/main/jni/cge/filters/cgeAdvancedEffects.h b/library/src/main/jni/cge/filters/cgeAdvancedEffects.h index 5fccb778..a5c756e4 100644 --- a/library/src/main/jni/cge/filters/cgeAdvancedEffects.h +++ b/library/src/main/jni/cge/filters/cgeAdvancedEffects.h @@ -15,7 +15,6 @@ #include "cgeEmbossFilter.h" #include "cgeHalftoneFilter.h" #include "cgeHazeFilter.h" -#include "cgeHistogramFilter.h" #include "cgeLerpblurFilter.h" #include "cgeLiquifyFilter.h" #include "cgeMosaicBlurFilter.h" @@ -51,7 +50,6 @@ CGESketchFilter* createSketchFilter(); CGEBeautifyFilter* createBeautifyFilter(); -CGEHistogramFilter* createHistogramFilter(); CGEWaveformFilter* createWaveformFilter(); } // namespace CGE diff --git a/library/src/main/jni/cge/filters/cgeDataParsingEngine.cpp b/library/src/main/jni/cge/filters/cgeDataParsingEngine.cpp index c349a7e0..92fc3fb6 100644 --- a/library/src/main/jni/cge/filters/cgeDataParsingEngine.cpp +++ b/library/src/main/jni/cge/filters/cgeDataParsingEngine.cpp @@ -1093,26 +1093,6 @@ CGEImageFilterInterface* CGEDataParsingEngine::advancedStyleParser(const char* p { ADJUSTHELP_COMMON_FUNC2(pstr, CGECrosshatchFilter, setCrosshatchSpacing, setLineWidth); } - else if (strcmp(buffer, "hist") == 0) - { - float x, y, value1, value2, r, g, b; - if (sscanf(pstr, "%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f", &x, &y, &value1, &value2, &r, &g, &b) != 7) - { - LOG_ERROR_PARAM(pstr); - return nullptr; - } - - CGEHistogramFilter* filter = createHistogramFilter(); - if (filter != nullptr) - { - proc = filter; - filter->setCenter(x, y); - filter->setXValue(value1); - filter->setYValue(value2); - filter->setColor(r, g, b); - } - } - else if (strcmp(buffer, "waveform") == 0) { float x, y, width, height; diff --git a/library/src/main/jni/cge/filters/cgeHistogramFilter.cpp b/library/src/main/jni/cge/filters/cgeHistogramFilter.cpp deleted file mode 100644 index 2a3e0b35..00000000 --- a/library/src/main/jni/cge/filters/cgeHistogramFilter.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "cgeHistogramFilter.h" - -static CGEConstString s_fshHistogram = CGE_SHADER_STRING_PRECISION_M( - varying vec2 textureCoordinate; - - uniform sampler2D inputImageTexture; - - uniform vec2 center; //坐标系原点 - - uniform float xValue; //宽度(x轴长度) - - uniform float yValue; //高度(y轴长度) - - uniform vec3 bgColor; //背景颜色 - - void main() { - /** - 在以center为原点,宽xValue,高yValue,背景色为bgColor的矩形框中绘制亮度直方图。如何在这个库的基础上实现? - */ - gl_FragColor = texture2D(inputImageTexture, textureCoordinate); - }); - -namespace CGE -{ -CGEConstString CGEHistogramFilter::paramCenter = "center"; -CGEConstString CGEHistogramFilter::paramXValue = "xValue"; -CGEConstString CGEHistogramFilter::paramYValue = "yValue"; -CGEConstString CGEHistogramFilter::paramColor = "bgColor"; - -bool CGEHistogramFilter::init() -{ - if (initShadersFromString(g_vshDefaultWithoutTexCoord, s_fshHistogram)) - { - setCenter(0.5f, 0.5f); - setXValue(0.4f); - setYValue(0.3f); - setColor(0.0f, 0.0f, 0.0f); - return true; - } - return false; -} - -void CGEHistogramFilter::setCenter(float x, float y) -{ - m_program.bind(); - m_program.sendUniformf(paramCenter, x, y); -} - -void CGEHistogramFilter::setXValue(float value) -{ - m_program.bind(); - m_program.sendUniformf(paramXValue, value); -} - -void CGEHistogramFilter::setYValue(float value) -{ - m_program.bind(); - m_program.sendUniformf(paramYValue, value); -} - -void CGEHistogramFilter::setColor(float r, float b, float g) -{ - m_program.bind(); - m_program.sendUniformf(paramColor, r, b, g); -} -} // namespace CGE \ No newline at end of file diff --git a/library/src/main/jni/cge/filters/cgeHistogramFilter.h b/library/src/main/jni/cge/filters/cgeHistogramFilter.h deleted file mode 100644 index f143449f..00000000 --- a/library/src/main/jni/cge/filters/cgeHistogramFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _HISTOGRAMFILTER_H_ -#define _HISTOGRAMFILTER_H_ - -#include "cgeImageFilter.h" - -namespace CGE -{ -class CGEHistogramFilter : public CGEImageFilterInterface -{ -public: - /** - * 坐标系原点, 默认 (0.5, 0.5) - */ - void setCenter(float x, float y); - /** - * 宽度 - */ - void setXValue(float value); - /** - * 高度 - */ - void setYValue(float value); - /** - * 背景颜色 - */ - void setColor(float r, float b, float g); - - bool init(); - -protected: - static CGEConstString paramCenter; - static CGEConstString paramXValue; - static CGEConstString paramYValue; - static CGEConstString paramColor; -}; -} // namespace CGE - -#endif \ No newline at end of file diff --git a/library/src/main/jni/cge/filters/cgeWaveformFilter.cpp b/library/src/main/jni/cge/filters/cgeWaveformFilter.cpp index 279c55f3..f3924a80 100644 --- a/library/src/main/jni/cge/filters/cgeWaveformFilter.cpp +++ b/library/src/main/jni/cge/filters/cgeWaveformFilter.cpp @@ -2,33 +2,6 @@ #define USING_ALPHA 1 /// 视图增加一个 80% 的半透明 -// static CGEConstString s_vshWaveform = "#version 310 es\n" CGE_SHADER_STRING_PRECISION_H( -// layout(location = 0) in vec2 position; -// layout(location = 0) out vec2 textureCoordinate; -// void main() { -// gl_Position = vec4(position, 0.0, 1.0); -// textureCoordinate = (position.xy + 1.0) / 2.0; -// }); - -// static CGEConstString s_fshWaveform = "#version 310 es\n" CGE_SHADER_STRING( -// precision highp float; -// precision highp int; -// layout(location = 0) in vec2 textureCoordinate; -// layout(binding = 0) uniform sampler2D inputImageTexture; -// layout(rgba8ui, binding = 1) uniform writeonly highp uimage2D outputImage; -// layout(location = 0) out vec4 fragColor; - -// void main() { -// fragColor = vec4(1.0); -// vec4 color = texture(inputImageTexture, textureCoordinate); -// float lum = dot(color.rgb, vec3(0.299, 0.587, 0.114)); -// ivec2 newLoc = ivec2(vec2(textureCoordinate.x, lum) * vec2(imageSize(outputImage))); -// // uint newLum = uint(lum * 255.0); -// imageStore(outputImage, newLoc, uvec4(255, 255, 255, 255)); - -// // TODO: 直接使用 255 来描述最亮是没有问题的。 如果要实现颜色亮度叠加. 可以考虑使用 imageAtomicAdd. -// }); - static CGEConstString s_cshWaveform = "#version 310 es\n" CGE_SHADER_STRING( precision highp float; precision highp int;