Permalink
Browse files

Added a false color filter. Incorporated the shadows and highlights f…

…ilter into the showcase.
  • Loading branch information...
1 parent 6d2b072 commit 8c351acaa53ba0b0bd90a28dc4d93f861ffc615e @BradLarson BradLarson committed Jul 21, 2012
View
@@ -78,6 +78,10 @@ Documentation is generated from header comments using appledoc. To build the doc
- *greenControlPoints*:
- *blueControlPoints*: The tone curve takes in a series of control points that define the spline curve for each color component. These are stored as NSValue-wrapped CGPoints in an NSArray, with normalized X and Y coordinates from 0 - 1. The defaults are (0,0), (0.5,0.5), (1,1).
+- **GPUImageHighlightShadowFilter**: Adjusts the shadows and highlights of an image
+ - *shadows*: Increase to lighten shadows, from 0.0 to 1.0, with 0.0 as the default.
+ - *highlights*: Decrease to darken highlights, from 0.0 to 1.0, with 1.0 as the default.
+
- **GPUImageColorInvertFilter**: Inverts the colors of an image
- **GPUImageGrayscaleFilter**: Converts an image to grayscale (a slightly faster implementation of the saturation filter, without the ability to vary the color contribution)
@@ -86,6 +90,10 @@ Documentation is generated from header comments using appledoc. To build the doc
- *intensity*: The degree to which the specific color replaces the normal image color (0.0 - 1.0, with 1.0 as the default)
- *color*: The color to use as the basis for the effect, with (0.6, 0.45, 0.3, 1.0) as the default.
+- **GPUImageFalseColorFilter**: Uses the luminance of the image to mix between two user-specified colors
+ - *firstColor*: The first and second colors specify what colors replace the dark and light areas of the image, respectively. The defaults are (0.0, 0.0, 0.5) amd (1.0, 0.0, 0.0).
+ - *secondColor*:
+
- **GPUImageSepiaFilter**: Simple sepia tone filter
- *intensity*: The degree to which the sepia tone replaces the normal image color (0.0 - 1.0, with 1.0 as the default)
@@ -67,10 +67,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case GPUIMAGE_EXPOSURE: cell.textLabel.text = @"Exposure"; break;
case GPUIMAGE_RGB: cell.textLabel.text = @"RGB"; break;
case GPUIMAGE_MONOCHROME: cell.textLabel.text = @"Monochrome"; break;
+ case GPUIMAGE_FALSECOLOR: cell.textLabel.text = @"False color"; break;
case GPUIMAGE_SHARPEN: cell.textLabel.text = @"Sharpen"; break;
case GPUIMAGE_UNSHARPMASK: cell.textLabel.text = @"Unsharp mask"; break;
case GPUIMAGE_GAMMA: cell.textLabel.text = @"Gamma"; break;
case GPUIMAGE_TONECURVE: cell.textLabel.text = @"Tone curve"; break;
+ case GPUIMAGE_HIGHLIGHTSHADOW: cell.textLabel.text = @"Highlights and shadows"; break;
case GPUIMAGE_HAZE: cell.textLabel.text = @"Haze"; break;
case GPUIMAGE_HISTOGRAM: cell.textLabel.text = @"Histogram"; break;
case GPUIMAGE_THRESHOLD: cell.textLabel.text = @"Threshold"; break;
@@ -8,6 +8,7 @@ typedef enum {
GPUIMAGE_EXPOSURE,
GPUIMAGE_RGB,
GPUIMAGE_MONOCHROME,
+ GPUIMAGE_FALSECOLOR,
GPUIMAGE_SHARPEN,
GPUIMAGE_UNSHARPMASK,
GPUIMAGE_TRANSFORM,
@@ -16,6 +17,7 @@ typedef enum {
GPUIMAGE_MASK,
GPUIMAGE_GAMMA,
GPUIMAGE_TONECURVE,
+ GPUIMAGE_HIGHLIGHTSHADOW,
GPUIMAGE_HAZE,
GPUIMAGE_SEPIA,
GPUIMAGE_COLORINVERT,
@@ -128,6 +128,13 @@ - (void)setupFilter;
filter = [[GPUImageMonochromeFilter alloc] init];
[(GPUImageMonochromeFilter *)filter setColor:(GPUVector4){0.0f, 0.0f, 1.0f, 1.f}];
}; break;
+ case GPUIMAGE_FALSECOLOR:
+ {
+ self.title = @"False Color";
+ self.filterSettingsSlider.hidden = YES;
+
+ filter = [[GPUImageFalseColorFilter alloc] init];
+ }; break;
case GPUIMAGE_SATURATION:
{
self.title = @"Saturation";
@@ -230,6 +237,17 @@ - (void)setupFilter;
filter = [[GPUImageToneCurveFilter alloc] init];
[(GPUImageToneCurveFilter *)filter setBlueControlPoints:[NSArray arrayWithObjects:[NSValue valueWithCGPoint:CGPointMake(0.0, 0.0)], [NSValue valueWithCGPoint:CGPointMake(0.5, 0.5)], [NSValue valueWithCGPoint:CGPointMake(1.0, 0.75)], nil]];
}; break;
+ case GPUIMAGE_HIGHLIGHTSHADOW:
+ {
+ self.title = @"Highlights and Shadows";
+ self.filterSettingsSlider.hidden = NO;
+
+ [self.filterSettingsSlider setValue:1.0];
+ [self.filterSettingsSlider setMinimumValue:0.0];
+ [self.filterSettingsSlider setMaximumValue:1.0];
+
+ filter = [[GPUImageHighlightShadowFilter alloc] init];
+ }; break;
case GPUIMAGE_HAZE:
{
self.title = @"Haze / UV";
@@ -1074,8 +1092,8 @@ - (IBAction)updateFilterFromSlider:(id)sender;
case GPUIMAGE_GAMMA: [(GPUImageGammaFilter *)filter setGamma:[(UISlider *)sender value]]; break;
case GPUIMAGE_CROSSHATCH: [(GPUImageCrosshatchFilter *)filter setCrossHatchSpacing:[(UISlider *)sender value]]; break;
case GPUIMAGE_POSTERIZE: [(GPUImagePosterizeFilter *)filter setColorLevels:round([(UISlider*)sender value])]; break;
- case GPUIMAGE_HAZE: [(GPUImageHazeFilter *)filter setDistance:[(UISlider *)sender value]]; break;
- case GPUIMAGE_THRESHOLD: [(GPUImageLuminanceThresholdFilter *)filter setThreshold:[(UISlider *)sender value]]; break;
+ case GPUIMAGE_HAZE: [(GPUImageHazeFilter *)filter setDistance:[(UISlider *)sender value]]; break;
+ case GPUIMAGE_THRESHOLD: [(GPUImageLuminanceThresholdFilter *)filter setThreshold:[(UISlider *)sender value]]; break;
case GPUIMAGE_ADAPTIVETHRESHOLD: [(GPUImageAdaptiveThresholdFilter *)filter setBlurSize:[(UISlider*)sender value]]; break;
case GPUIMAGE_DISSOLVE: [(GPUImageDissolveBlendFilter *)filter setMix:[(UISlider *)sender value]]; break;
case GPUIMAGE_CHROMAKEY: [(GPUImageChromaKeyBlendFilter *)filter setThresholdSensitivity:[(UISlider *)sender value]]; break;
@@ -1093,6 +1111,7 @@ - (IBAction)updateFilterFromSlider:(id)sender;
case GPUIMAGE_BULGE: [(GPUImageBulgeDistortionFilter *)filter setScale:[(UISlider *)sender value]]; break;
case GPUIMAGE_SPHEREREFRACTION: [(GPUImageSphereRefractionFilter *)filter setRadius:[(UISlider *)sender value]]; break;
case GPUIMAGE_TONECURVE: [(GPUImageToneCurveFilter *)filter setBlueControlPoints:[NSArray arrayWithObjects:[NSValue valueWithCGPoint:CGPointMake(0.0, 0.0)], [NSValue valueWithCGPoint:CGPointMake(0.5, [(UISlider *)sender value])], [NSValue valueWithCGPoint:CGPointMake(1.0, 0.75)], nil]]; break;
+ case GPUIMAGE_HIGHLIGHTSHADOW: [(GPUImageHighlightShadowFilter *)filter setHighlights:[(UISlider *)sender value]]; break;
case GPUIMAGE_PINCH: [(GPUImagePinchDistortionFilter *)filter setScale:[(UISlider *)sender value]]; break;
case GPUIMAGE_PERLINNOISE: [(GPUImagePerlinNoiseFilter *)filter setScale:[(UISlider *)sender value]]; break;
case GPUIMAGE_MOSAIC: [(GPUImageMosaicFilter *)filter setDisplayTileSize:CGSizeMake([(UISlider *)sender value], [(UISlider *)sender value])]; break;
@@ -212,6 +212,10 @@
BCC1E66D152368130006EFA5 /* GPUImageCrosshatchFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC1E669152368130006EFA5 /* GPUImageCrosshatchFilter.h */; };
BCC1E66E152368130006EFA5 /* GPUImageCrosshatchFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC1E66A152368130006EFA5 /* GPUImageCrosshatchFilter.m */; };
BCC1E67C152368840006EFA5 /* GPUImageCGAColorspaceFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC1E67B152368840006EFA5 /* GPUImageCGAColorspaceFilter.m */; };
+ BCC46E5E15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC46E5C15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.h */; };
+ BCC46E5F15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC46E5D15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.m */; };
+ BCC46E6315BA095F005519B9 /* GPUImageFalseColorFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC46E6115BA095F005519B9 /* GPUImageFalseColorFilter.h */; };
+ BCC46E6415BA095F005519B9 /* GPUImageFalseColorFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC46E6215BA095F005519B9 /* GPUImageFalseColorFilter.m */; };
BCC93A0F1501D1BF00958B26 /* GPUImageFastBlurFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC93A0D1501D1BF00958B26 /* GPUImageFastBlurFilter.h */; };
BCC93A101501D1BF00958B26 /* GPUImageFastBlurFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC93A0E1501D1BF00958B26 /* GPUImageFastBlurFilter.m */; };
BCC93A1E1501E42F00958B26 /* GPUImageTwoPassFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC93A1C1501E42E00958B26 /* GPUImageTwoPassFilter.h */; };
@@ -466,6 +470,10 @@
BCC1E669152368130006EFA5 /* GPUImageCrosshatchFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPUImageCrosshatchFilter.h; path = Source/GPUImageCrosshatchFilter.h; sourceTree = SOURCE_ROOT; };
BCC1E66A152368130006EFA5 /* GPUImageCrosshatchFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GPUImageCrosshatchFilter.m; path = Source/GPUImageCrosshatchFilter.m; sourceTree = SOURCE_ROOT; };
BCC1E67B152368840006EFA5 /* GPUImageCGAColorspaceFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GPUImageCGAColorspaceFilter.m; path = Source/GPUImageCGAColorspaceFilter.m; sourceTree = SOURCE_ROOT; };
+ BCC46E5C15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPUImageHighlightShadowFilter.h; path = Source/GPUImageHighlightShadowFilter.h; sourceTree = SOURCE_ROOT; };
+ BCC46E5D15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GPUImageHighlightShadowFilter.m; path = Source/GPUImageHighlightShadowFilter.m; sourceTree = SOURCE_ROOT; };
+ BCC46E6115BA095F005519B9 /* GPUImageFalseColorFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPUImageFalseColorFilter.h; path = Source/GPUImageFalseColorFilter.h; sourceTree = SOURCE_ROOT; };
+ BCC46E6215BA095F005519B9 /* GPUImageFalseColorFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GPUImageFalseColorFilter.m; path = Source/GPUImageFalseColorFilter.m; sourceTree = SOURCE_ROOT; };
BCC93A0D1501D1BF00958B26 /* GPUImageFastBlurFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPUImageFastBlurFilter.h; path = Source/GPUImageFastBlurFilter.h; sourceTree = SOURCE_ROOT; };
BCC93A0E1501D1BF00958B26 /* GPUImageFastBlurFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GPUImageFastBlurFilter.m; path = Source/GPUImageFastBlurFilter.m; sourceTree = SOURCE_ROOT; };
BCC93A1C1501E42E00958B26 /* GPUImageTwoPassFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPUImageTwoPassFilter.h; path = Source/GPUImageTwoPassFilter.h; sourceTree = SOURCE_ROOT; };
@@ -553,10 +561,6 @@
BC1B715D14F4AFFF00ACA2AB /* Color processing */ = {
isa = PBXGroup;
children = (
- BCBCE9971595021B00E0ED33 /* GPUImageMonochromeFilter.h */,
- BCBCE9981595021B00E0ED33 /* GPUImageMonochromeFilter.m */,
- BEBE83B3155C092A00EEF8C3 /* GPUImageRGBFilter.h */,
- BEBE83B4155C092A00EEF8C3 /* GPUImageRGBFilter.m */,
BC982B7714F098CC0001FF6F /* GPUImageBrightnessFilter.h */,
BC982B7814F098CC0001FF6F /* GPUImageBrightnessFilter.m */,
BCB6B833150400030041703B /* GPUImageExposureFilter.h */,
@@ -569,6 +573,14 @@
BC982B7D14F09F980001FF6F /* GPUImageGammaFilter.m */,
B81521A014F1BA6A00F105F8 /* GPUImageColorMatrixFilter.h */,
B81521A114F1BA6A00F105F8 /* GPUImageColorMatrixFilter.m */,
+ BEBE83B3155C092A00EEF8C3 /* GPUImageRGBFilter.h */,
+ BEBE83B4155C092A00EEF8C3 /* GPUImageRGBFilter.m */,
+ BCC46E5C15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.h */,
+ BCC46E5D15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.m */,
+ BCBCE9971595021B00E0ED33 /* GPUImageMonochromeFilter.h */,
+ BCBCE9981595021B00E0ED33 /* GPUImageMonochromeFilter.m */,
+ BCC46E6115BA095F005519B9 /* GPUImageFalseColorFilter.h */,
+ BCC46E6215BA095F005519B9 /* GPUImageFalseColorFilter.m */,
6D13DBE4151AA804000B23BA /* GPUImageHazeFilter.h */,
6D13DBE5151AA804000B23BA /* GPUImageHazeFilter.m */,
BCB5E7C014E4B6D400701302 /* GPUImageSepiaFilter.h */,
@@ -1019,6 +1031,8 @@
BCBCE9991595021B00E0ED33 /* GPUImageMonochromeFilter.h in Headers */,
BCBCE9D5159944AC00E0ED33 /* GPUImageBuffer.h in Headers */,
BCF6B41115A7849F00FC6F58 /* GPUImageOpacityFilter.h in Headers */,
+ BCC46E5E15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.h in Headers */,
+ BCC46E6315BA095F005519B9 /* GPUImageFalseColorFilter.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1246,6 +1260,8 @@
BCBCE99A1595021B00E0ED33 /* GPUImageMonochromeFilter.m in Sources */,
BCBCE9D6159944AC00E0ED33 /* GPUImageBuffer.m in Sources */,
BCF6B41215A7849F00FC6F58 /* GPUImageOpacityFilter.m in Sources */,
+ BCC46E5F15B9EFE8005519B9 /* GPUImageHighlightShadowFilter.m in Sources */,
+ BCC46E6415BA095F005519B9 /* GPUImageFalseColorFilter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -104,4 +104,6 @@
#import "GPUImageColorPackingFilter.h"
#import "GPUImageSphereRefractionFilter.h"
#import "GPUImageMonochromeFilter.h"
-#import "GPUImageOpacityFilter.h"
+#import "GPUImageOpacityFilter.h"
+#import "GPUImageHighlightShadowFilter.h"
+#import "GPUImageFalseColorFilter.h"
@@ -0,0 +1,15 @@
+#import "GPUImageFilter.h"
+
+@interface GPUImageFalseColorFilter : GPUImageFilter
+{
+ GLint firstColorUniform, secondColorUniform;
+}
+
+// The first and second colors specify what colors replace the dark and light areas of the image, respectively. The defaults are (0.0, 0.0, 0.5) amd (1.0, 0.0, 0.0).
+@property(readwrite, nonatomic) GPUVector4 firstColor;
+@property(readwrite, nonatomic) GPUVector4 secondColor;
+
+- (void)setFirstColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
+- (void)setSecondColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
+
+@end
@@ -0,0 +1,88 @@
+#import "GPUImageFalseColorFilter.h"
+
+NSString *const kGPUFalseColorFragmentShaderString = SHADER_STRING
+(
+ precision lowp float;
+
+ varying highp vec2 textureCoordinate;
+
+ uniform sampler2D inputImageTexture;
+ uniform float intensity;
+ uniform vec3 firstColor;
+ uniform vec3 secondColor;
+
+ const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
+
+ void main()
+ {
+ lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
+ float luminance = dot(textureColor.rgb, luminanceWeighting);
+
+ gl_FragColor = vec4( mix(firstColor.rgb, secondColor.rgb, luminance), textureColor.a);
+ }
+);
+
+@implementation GPUImageFalseColorFilter
+
+@synthesize secondColor = _secondColor;
+@synthesize firstColor = _firstColor;
+
+- (id)init;
+{
+ if (!(self = [super initWithFragmentShaderFromString:kGPUFalseColorFragmentShaderString]))
+ {
+ return nil;
+ }
+
+ firstColorUniform = [filterProgram uniformIndex:@"firstColor"];
+ secondColorUniform = [filterProgram uniformIndex:@"secondColor"];
+
+ self.firstColor = (GPUVector4){0.0f, 0.0f, 0.5f, 1.0f};
+ self.secondColor = (GPUVector4){1.0f, 0.0f, 0.0f, 1.0f};
+
+ return self;
+}
+
+
+#pragma mark -
+#pragma mark Accessors
+
+- (void)setFirstColor:(GPUVector4)newValue;
+{
+ _firstColor = newValue;
+
+ [self setFirstColorRed:_firstColor.one green:_firstColor.two blue:_firstColor.three];
+}
+
+- (void)setSecondColor:(GPUVector4)newValue;
+{
+ _secondColor = newValue;
+
+ [self setSecondColorRed:_secondColor.one green:_secondColor.two blue:_secondColor.three];
+}
+
+- (void)setFirstColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
+{
+ GLfloat filterColor[3];
+ filterColor[0] = redComponent;
+ filterColor[1] = greenComponent;
+ filterColor[2] = blueComponent;
+
+ [GPUImageOpenGLESContext useImageProcessingContext];
+ [filterProgram use];
+ glUniform3fv(firstColorUniform, 1, filterColor);
+}
+
+- (void)setSecondColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
+{
+ GLfloat filterColor[3];
+ filterColor[0] = redComponent;
+ filterColor[1] = greenComponent;
+ filterColor[2] = blueComponent;
+
+ [GPUImageOpenGLESContext useImageProcessingContext];
+ [filterProgram use];
+ glUniform3fv(secondColorUniform, 1, filterColor);
+}
+
+@end
@@ -1,15 +1,5 @@
#import "GPUImageFilter.h"
-/**
- * This is an attempt to replicate CIHighlightShadowAdjust
- *
- *
- * @author Alaric Cole
- * @creationDate 07/10/12
- *
- */
-
-
@interface GPUImageHighlightShadowFilter : GPUImageFilter
{
GLint shadowsUniform, highlightsUniform;
@@ -7,7 +7,7 @@
@property(readwrite, nonatomic) CGFloat intensity;
@property(readwrite, nonatomic) GPUVector4 color;
-//@property(readwrite, nonatomic) CIColor* color;
+
- (void)setColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent;
@end
@@ -2,46 +2,35 @@
NSString *const kGPUMonochromeFragmentShaderString = SHADER_STRING
(
-precision lowp float;
-
-varying highp vec2 textureCoordinate;
+ precision lowp float;
-uniform sampler2D inputImageTexture;
-uniform float intensity;
-uniform vec3 filterColor;
-
-const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
+ varying highp vec2 textureCoordinate;
-
+ uniform sampler2D inputImageTexture;
+ uniform float intensity;
+ uniform vec3 filterColor;
-void main()
-{
-
-
+ const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
+
+ void main()
+ {
//desat, then apply overlay blend
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
float luminance = dot(textureColor.rgb, luminanceWeighting);
lowp vec4 desat = vec4(vec3(luminance), 1.0);
-
-
//overlay
lowp vec4 outputColor = vec4(
- (desat.r < 0.5 ? (2.0 * desat.r * filterColor.r) : (1.0 - 2.0 * (1.0 - desat.r) * (1.0 - filterColor.r))),
- (desat.g < 0.5 ? (2.0 * desat.g * filterColor.g) : (1.0 - 2.0 * (1.0 - desat.g) * (1.0 - filterColor.g))),
- (desat.b < 0.5 ? (2.0 * desat.b * filterColor.b) : (1.0 - 2.0 * (1.0 - desat.b) * (1.0 - filterColor.b))),
- 1.0
- );
+ (desat.r < 0.5 ? (2.0 * desat.r * filterColor.r) : (1.0 - 2.0 * (1.0 - desat.r) * (1.0 - filterColor.r))),
+ (desat.g < 0.5 ? (2.0 * desat.g * filterColor.g) : (1.0 - 2.0 * (1.0 - desat.g) * (1.0 - filterColor.g))),
+ (desat.b < 0.5 ? (2.0 * desat.b * filterColor.b) : (1.0 - 2.0 * (1.0 - desat.b) * (1.0 - filterColor.b))),
+ 1.0
+ );
//which is better, or are they equal?
- gl_FragColor = vec4( mix(textureColor.rgb, outputColor.rgb, intensity), 1.0 );
- //gl_FragColor = (intensity * outputColor) + ((1.0 - intensity) * textureColor);
-
-
-
-
-}
+ gl_FragColor = vec4( mix(textureColor.rgb, outputColor.rgb, intensity), textureColor.a);
+ }
);
@implementation GPUImageMonochromeFilter
@@ -7,6 +7,7 @@
GLint blueUniform;
}
+// Normalized values by which each color channel is multiplied. The range is from 0.0 up, with 1.0 as the default.
@property (readwrite, nonatomic) CGFloat red;
@property (readwrite, nonatomic) CGFloat green;
@property (readwrite, nonatomic) CGFloat blue;

0 comments on commit 8c351ac

Please sign in to comment.