日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

IOS – OPenGL ES 调节图像饱和度 GPUImageSaturationFilter

發布時間:2024/9/27 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 函數

零基礎 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 調節圖像飽和度 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 調節圖像飽和度 GPUImageSaturationFilter

四.猜你喜歡

  • IOS – OPenGL ES 設置圖像亮度 GPUImageBrightnessFilter
  • IOS – OPenGL ES 調節圖像曝光度 GPUImageExposureFilter
  • IOS – OpenGL ES 調節圖像對比度 GPUImageContrastFilter
  • IOS – OPenGL ES 調節圖像飽和度 GPUImageSaturationFilter

總結

以上是生活随笔為你收集整理的IOS – OPenGL ES 调节图像饱和度 GPUImageSaturationFilter的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。