Skip to content
Browse files

Merge pull request #519 from qwiki/master

Padding tone curve control points
  • Loading branch information...
2 parents 99ef54a + 0b962e6 commit a984bcb0e174cf75fc50b1d09e5ad60c9475bdbe @BradLarson committed Oct 2, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 framework/Source/GPUImageToneCurveFilter.m
View
14 framework/Source/GPUImageToneCurveFilter.m
@@ -250,11 +250,21 @@ - (NSArray *)getPreparedSplineCurve:(NSArray *)points
CGPoint firstSplinePoint = [[splinePoints objectAtIndex:0] CGPointValue];
if (firstSplinePoint.x > 0) {
- for (int i=0; i <=firstSplinePoint.x; i++) {
- CGPoint newCGPoint = CGPointMake(0, 0);
+ for (int i=firstSplinePoint.x; i >= 0; i--) {
+ CGPoint newCGPoint = CGPointMake(i, 0);
[splinePoints insertObject:[NSValue valueWithCGPoint:newCGPoint] atIndex:0];
}
}
+
+ // Insert points similarly at the end, if necessary.
+ CGPoint lastSplinePoint = [[splinePoints objectAtIndex:([splinePoints count] - 1)] CGPointValue];
+
+ if (lastSplinePoint.x < 255) {
+ for (int i = lastSplinePoint.x + 1; i <= 255; i++) {
+ CGPoint newCGPoint = CGPointMake(i, 255);
+ [splinePoints addObject:[NSValue valueWithCGPoint:newCGPoint]];
+ }
+ }
// Prepare the spline points.

0 comments on commit a984bcb

Please sign in to comment.
Something went wrong with that request. Please try again.