IOS – OPenGL ES 调节图像饱和度 GPUImageSaturationFilter
目錄
- 一.簡介
- 二.效果演示
- 三.源碼下載
- 四.猜你喜歡
零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES 基礎
零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES 轉場
零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES 特效
零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES 函數(shù)
零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES GPUImage 使用
零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES GLSL 編程
一.簡介
GPUImage 共 125 個濾鏡, 分為四類
1、Color adjustments : 31 filters , 顏色處理相關
2、Image processing : 40 filters , 圖像處理相關.
3、Blending modes : 29 filters , 混合模式相關.
4、Visual effects : 25 filters , 視覺效果相關.
GPUImageSaturationFilter 屬于 GPUImage 顏色處理相關,用來處理圖片飽和度,shader 源碼如下:
/******************************************************************************************/ //@Author:猿說編程 //@Blog(個人博客地址): www.codersrc.com //@File:IOS – OPenGL ES 調節(jié)圖像飽和度 GPUImageSaturationFilter //@Time:2022/03/12 07:30 //@Motto:不積跬步無以至千里,不積小流無以成江海,程序人生的精彩需要堅持不懈地積累! /******************************************************************************************/#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE NSString *const kGPUImageSaturationFragmentShaderString = SHADER_STRING (varying highp vec2 textureCoordinate;uniform sampler2D inputImageTexture;uniform lowp float saturation;// Values from "Graphics Shaders: Theory and Practice" by Bailey and Cunninghamconst mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);void main(){lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);lowp float luminance = dot(textureColor.rgb, luminanceWeighting);lowp vec3 greyScaleColor = vec3(luminance);gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);} ); #else NSString *const kGPUImageSaturationFragmentShaderString = SHADER_STRING (varying vec2 textureCoordinate;uniform sampler2D inputImageTexture;uniform float saturation;// Values from "Graphics Shaders: Theory and Practice" by Bailey and Cunninghamconst vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);void main(){vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);float luminance = dot(textureColor.rgb, luminanceWeighting);vec3 greyScaleColor = vec3(luminance);gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);}); #endif二.效果演示
三.源碼下載
下載地址:IOS – OPenGL ES 調節(jié)圖像飽和度 GPUImageSaturationFilter
四.猜你喜歡
- IOS – OPenGL ES 設置圖像亮度 GPUImageBrightnessFilter
- IOS – OPenGL ES 調節(jié)圖像曝光度 GPUImageExposureFilter
- IOS – OpenGL ES 調節(jié)圖像對比度 GPUImageContrastFilter
- IOS – OPenGL ES 調節(jié)圖像飽和度 GPUImageSaturationFilter
總結
以上是生活随笔為你收集整理的IOS – OPenGL ES 调节图像饱和度 GPUImageSaturationFilter的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Qt中QSS的简单使用
- 下一篇: linux按日期备份mysql,在Lin