Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Padding tone curve control points #519

Merged
merged 1 commit into from

2 participants

@gpatqwiki

This patch corrects issues with some .acv files (where the composite control points begin at x > 0 and end at x < 255) that otherwise result in black images.

@BradLarson
Owner

I don't do much with the tone curves, so I'll trust that this works as advertised. Thanks.

@BradLarson BradLarson merged commit a984bcb into BradLarson:master
@yamakox yamakox referenced this pull request from a commit
@yamakox yamakox Revert "Merge pull request #519 from qwiki/master"
This reverts commit a984bcb, reversing
changes made to 99ef54a.
29a4101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
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.
Something went wrong with that request. Please try again.