├── .gitignore ├── Classes ├── Curve │ ├── BezierCurve.h │ ├── BezierCurve.m │ ├── CGPointArithmetic.h │ ├── CatmullRomSpline.h │ ├── CatmullRomSpline.m │ ├── CubicBezierCurve.h │ ├── CubicBezierCurve.m │ ├── LinearBezierCurve.h │ ├── LinearBezierCurve.m │ ├── NSArray_PointArray.h │ ├── NSArray_PointArray.m │ ├── QuadraticBezierCurve.h │ ├── QuadraticBezierCurve.m │ ├── Spline.h │ └── Spline.m ├── ImageFilter.h ├── ImageFilter.m ├── iphone_filtersAppDelegate.h ├── iphone_filtersAppDelegate.m ├── iphone_filtersViewController.h └── iphone_filtersViewController.m ├── MainWindow.xib ├── README.md ├── docs ├── ss1.png └── ss2.png ├── green.jpg ├── iphone-filters.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── kiichi.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── kiichi.xcuserdatad │ └── xcschemes │ ├── iphone-filters.xcscheme │ └── xcschememanagement.plist ├── iphone_filters-Info.plist ├── iphone_filtersViewController.xib ├── iphone_filters_Prefix.pch ├── landscape.jpg └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X Finder and whatnot 2 | .DS_Store 3 | 4 | 5 | # Sparkle distribution Private Key (Don't check me in!) 6 | dsa_priv.pem 7 | 8 | 9 | # XCode (and ancestors) per-user config (very noisy, and not relevant) 10 | *.mode1 11 | *.mode1v3 12 | *.mode2v3 13 | *.perspective 14 | *.perspectivev3 15 | *.pbxuser 16 | 17 | 18 | # Generated files 19 | VersionX-revision.h 20 | 21 | 22 | # build products 23 | build/ 24 | *.[o] 25 | 26 | # Other source repository archive directories (protects when importing) 27 | .hg 28 | .svn 29 | CVS 30 | 31 | 32 | # automatic backup files 33 | *~.nib 34 | *.swp 35 | *~ 36 | *(Autosaved).rtfd/ 37 | Backup[ ]of[ ]*.pages/ 38 | Backup[ ]of[ ]*.key/ 39 | Backup[ ]of[ ]*.numbers/ 40 | 41 | *.pyc 42 | *~ 43 | .*.swp 44 | .svn 45 | tags 46 | .DS_Store 47 | Thumbs.db 48 | appversion.py 49 | scripts/scrape_data/* 50 | static/images/Thumbs.db 51 | 52 | Resources/Icon.png 53 | Resources/*/Localizable.strings 54 | Resources/*/Custom.strings 55 | Resources/Config.strings 56 | Resources/Config.strings 57 | Resources/iPhone-bg.png 58 | Resources/iPhone-logo.png 59 | Resources/iPhone-logo@2x.png 60 | Resources/quickedit-logo.png 61 | Resources/tos.html 62 | Resources/UserTypes.plist 63 | Resources/LookingFor.plist 64 | Resources/browse-logo.png 65 | 66 | Resources-iPad/iPad-logo.png 67 | Resources-iPad/iPad-bg.png 68 | Resources-iPad/IconPad.png 69 | Husband Material.xcodeproj/project.xcworkspace/* 70 | Husband Material.xcodeproj/xcuserdata/* 71 | 72 | -------------------------------------------------------------------------------- /Classes/Curve/BezierCurve.h: -------------------------------------------------------------------------------- 1 | // 2 | // BezierCurve.h 3 | // Curve 4 | // 5 | // BezierCurve is an abstract class representing a Bezier curve of any degree. It should not be instantiated 6 | // directly. Use LinearBezierCurve, QuadraticBezierCurve, and CubicBezierCurve instead. 7 | // 8 | // Created by Bryan Spitz on 10-01-26. 9 | // Copyright 2010 Bryan Spitz. All rights reserved. 10 | // 11 | 12 | #import 13 | 14 | 15 | @interface BezierCurve : NSObject { 16 | CGPoint p1, p2; 17 | } 18 | 19 | // Start point 20 | @property (nonatomic, readonly) CGPoint p1; 21 | // End point 22 | @property (nonatomic, readonly) CGPoint p2; 23 | 24 | // An array of two Bezier curves of the same degree as the original. 25 | // These two curves, placed together, encompass exactly the same points 26 | // as the original. 27 | -(NSArray *)subdivided; 28 | 29 | // Returns whether the curve may be treated as linear for drawing or other purposes. 30 | -(BOOL)isNearLinear; 31 | 32 | // Returns an array of NSValues representing CGPoints dividing the curve into near-linear subsections. 33 | -(NSArray *)asPointArray; 34 | 35 | // The same as asPointArray, but adds points to an existing array for efficiency. 36 | -(void)addToPointArray:(NSMutableArray *)pointArray; 37 | @end 38 | -------------------------------------------------------------------------------- /Classes/Curve/BezierCurve.m: -------------------------------------------------------------------------------- 1 | // 2 | // BezierCurve.m 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-26. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "BezierCurve.h" 10 | 11 | 12 | @implementation BezierCurve 13 | @synthesize p1, p2; 14 | 15 | - (NSArray *)subdivided { 16 | [self doesNotRecognizeSelector:_cmd]; 17 | return nil; 18 | } 19 | 20 | - (BOOL)isNearLinear { 21 | [self doesNotRecognizeSelector:_cmd]; 22 | return NO; 23 | } 24 | 25 | - (NSArray *)asPointArray { 26 | [self doesNotRecognizeSelector:_cmd]; 27 | return nil; 28 | } 29 | 30 | - (void)addToPointArray:(NSMutableArray *)pointArray { 31 | [self doesNotRecognizeSelector:_cmd]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Classes/Curve/CGPointArithmetic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CGPointArithmetic.h 3 | * Curve 4 | * 5 | * A set of tools for doing CGPoint calculations. For efficiency, these are preprocessor macros 6 | * instead of C functions. 7 | * 8 | * Created by Bryan Spitz on 10-01-26. 9 | * Copyright 2010 Bryan Spitz. All rights reserved. 10 | * 11 | */ 12 | 13 | #import 14 | 15 | #define CGPointDifference(p1,p2) (CGPointMake(((p1.x) - (p2.x)), ((p1.y) - (p2.y)))) 16 | #define CGPointMagnitude(p) sqrt(p.x*p.x + p.y*p.y) 17 | #define CGPointSlope(p) (p.y / p.x) 18 | #define CGPointScale(p, d) CGPointMake(p.x * d, p.y * d) 19 | #define CGPointAdd(p1, p2) CGPointMake(p1.x + p2.x, p1.y + p2.y) 20 | #define CGPointMidpoint(p1, p2) CGPointMake((p1.x + p2.x)/2., (p1.y + p2.y)/2.) -------------------------------------------------------------------------------- /Classes/Curve/CatmullRomSpline.h: -------------------------------------------------------------------------------- 1 | // 2 | // CatmullRomSpline.h 3 | // Curve 4 | // 5 | // CatmullRomSpline is a class representing a Catmull-Rom Spline (i.e. a spline with 6 | // continuous derivative, passing through a set of arbitrary control points). The tangent 7 | // of the spline at any control point (except the first and last) is parallel to the 8 | // line connecting the previous control point with the next one. 9 | // 10 | // Most of the segments of a CatmullRomSpline are cubic bezier curves. The last segment is 11 | // a quadratic curve. When a new point is added, the last segment is removed and replaced with a 12 | // cubic curve making use of the new control point information, and a new quadratic curve is 13 | // added to the end. Application that attempt to cache data related to the spline should be 14 | // aware that the final points are subject to change. 15 | // 16 | // Created by Bryan Spitz on 10-01-28. 17 | // Copyright 2010 Bryan Spitz. All rights reserved. 18 | // 19 | 20 | #import 21 | #import "Spline.h" 22 | 23 | @interface CatmullRomSpline : Spline { 24 | CGPoint p3, p2, p1, p; 25 | } 26 | 27 | +(CatmullRomSpline *)catmullRomSplineAtPoint:(CGPoint)start; 28 | 29 | // Add a control point, through which the spline must pass, to the end of the spline. 30 | -(void)addPoint:(CGPoint)point; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/Curve/CatmullRomSpline.m: -------------------------------------------------------------------------------- 1 | // 2 | // CatmullRomSpline.m 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-28. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "CatmullRomSpline.h" 10 | #import "CGPointArithmetic.h" 11 | 12 | 13 | @implementation CatmullRomSpline 14 | 15 | 16 | +(CatmullRomSpline *)catmullRomSplineAtPoint:(CGPoint)start { 17 | return [[[CatmullRomSpline alloc] initAtPoint:start] autorelease]; 18 | } 19 | 20 | 21 | -(id)initAtPoint:(CGPoint)start { 22 | if (self = [super initAtPoint:start]) { 23 | p = start; 24 | p1 = start; 25 | p2 = start; 26 | p3 = start; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | -(void)addPoint:(CGPoint)point { 33 | CGPoint diff = CGPointMake(point.x - p.x, point.y - p.y); 34 | double length = sqrt(pow(diff.x, 2) + pow(diff.y, 2)); 35 | 36 | 37 | 38 | if ([curves count] > 0) { 39 | [self removeLastCurve]; 40 | } 41 | 42 | 43 | if (length >= 15) { 44 | p3 = p2; 45 | p2 = p1; 46 | p1 = p; 47 | p = point; 48 | 49 | CGPoint tangent = CGPointMake((p1.x - p3.x), (p1.y - p3.y)); 50 | CGFloat tangentLength = CGPointMagnitude(tangent); 51 | CGPoint unitTangent = (tangentLength == 0.)?tangent:CGPointScale(tangent, 1. / tangentLength); 52 | CGPoint diff = CGPointDifference (p1, p2); 53 | CGFloat desiredLength = CGPointMagnitude(diff) / 3.; 54 | CGPoint desiredTangent = CGPointScale(unitTangent, desiredLength); 55 | 56 | CGPoint ctrl1 = CGPointMake(p2.x + desiredTangent.x, p2.y + desiredTangent.y); 57 | 58 | tangent = CGPointMake((p.x - p2.x), (p.y - p2.y)); 59 | tangentLength = CGPointMagnitude(tangent); 60 | unitTangent = (tangentLength == 0.)?tangent:CGPointScale(tangent, 1. / tangentLength); 61 | desiredTangent = CGPointScale(unitTangent, desiredLength); 62 | 63 | CGPoint ctrl2 = CGPointMake(p1.x - desiredTangent.x, p1.y - desiredTangent.y); 64 | 65 | [self addCubicCurveWithControl1:ctrl1 control2:ctrl2 toPoint:p1]; 66 | 67 | 68 | } 69 | 70 | CGPoint currtemp = current; 71 | CGPoint tangent2 = CGPointMake((p.x - p2.x)/5., (p.y - p2.y)/5.); 72 | CGPoint ctrl = CGPointMake(p1.x + tangent2.x, p1.y + tangent2.y); 73 | [self addQuadCurveWithControl:ctrl toPoint:point]; 74 | current = currtemp; 75 | 76 | 77 | } 78 | @end 79 | -------------------------------------------------------------------------------- /Classes/Curve/CubicBezierCurve.h: -------------------------------------------------------------------------------- 1 | // 2 | // CubicBezierCurve.h 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-28. 6 | // Copyright 2010 Bryan Spitz. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BezierCurve.h" 11 | 12 | @interface CubicBezierCurve : BezierCurve { 13 | CGPoint ctrl1, ctrl2; 14 | } 15 | 16 | +(CubicBezierCurve *)cubicCurveWithStart:(CGPoint)start controlPoint1:(CGPoint)control1 controlPoint2:(CGPoint)control2 end:(CGPoint)end; 17 | -(id)initWithStart:(CGPoint)start controlPoint1:(CGPoint)control1 controlPoint2:(CGPoint)control2 end:(CGPoint)end; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Classes/Curve/CubicBezierCurve.m: -------------------------------------------------------------------------------- 1 | // 2 | // CubicBezierCurve.m 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-28. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "CubicBezierCurve.h" 10 | #import "CGPointArithmetic.h" 11 | 12 | 13 | @implementation CubicBezierCurve 14 | 15 | +(CubicBezierCurve *)cubicCurveWithStart:(CGPoint)start controlPoint1:(CGPoint)control1 controlPoint2:(CGPoint)control2 end:(CGPoint)end { 16 | return [[[CubicBezierCurve alloc] initWithStart:start 17 | controlPoint1:control1 18 | controlPoint2:control2 19 | end:end] autorelease]; 20 | } 21 | 22 | -(id)initWithStart:(CGPoint)start controlPoint1:(CGPoint)control1 controlPoint2:(CGPoint)control2 end:(CGPoint)end { 23 | if (self = [super init]) { 24 | p1 = start; 25 | p2 = end; 26 | ctrl1 = control1; 27 | ctrl2 = control2; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | -(BOOL)isNearLinear { 34 | 35 | if (CGPointEqualToPoint(p1, p2)) { 36 | return YES; 37 | } 38 | 39 | CGPoint p1Ctrl1 = CGPointDifference(ctrl1, p1); 40 | CGPoint p1p2 = CGPointDifference(p2, p1); 41 | 42 | CGFloat p1p2length = CGPointMagnitude(p1p2); 43 | CGFloat projectionLength = (p1Ctrl1.x * p1p2.x + p1Ctrl1.y * p1p2.y) / (p1p2length * p1p2length); 44 | 45 | CGPoint projectedPt = CGPointScale(p1p2, projectionLength); 46 | 47 | CGPoint diff = CGPointDifference(p1Ctrl1, projectedPt); 48 | CGFloat distance = CGPointMagnitude(diff); 49 | 50 | CGPoint p2Ctrl2 = CGPointDifference(ctrl2, p2); 51 | projectionLength = (p2Ctrl2.x * -p1p2.x + p2Ctrl2.y * -p1p2.y) / (p1p2length * p1p2length); 52 | projectedPt = CGPointScale(p1p2, -projectionLength); 53 | diff = CGPointDifference(p2Ctrl2, projectedPt); 54 | CGFloat distance2 = CGPointMagnitude(diff); 55 | 56 | return distance < 0.5 && distance2 < 0.5; 57 | 58 | } 59 | 60 | -(NSArray *)subdivided { 61 | CGPoint midStartCtrl1 = CGPointMidpoint(p1, ctrl1); 62 | CGPoint midCtrl1Ctrl2 = CGPointMidpoint(ctrl1, ctrl2); 63 | CGPoint midCtrl2End = CGPointMidpoint(ctrl2, p2); 64 | CGPoint newCtrl1 = CGPointMidpoint(midStartCtrl1, midCtrl1Ctrl2); 65 | CGPoint newCtrl2 = CGPointMidpoint(midCtrl1Ctrl2, midCtrl2End); 66 | CGPoint mid = CGPointMidpoint(newCtrl1, newCtrl2); 67 | 68 | CubicBezierCurve *curve1 = [[CubicBezierCurve alloc] initWithStart:p1 69 | controlPoint1:midStartCtrl1 70 | controlPoint2:newCtrl1 71 | end:mid]; 72 | CubicBezierCurve *curve2 = [[CubicBezierCurve alloc] initWithStart:mid 73 | controlPoint1:newCtrl2 74 | controlPoint2:midCtrl2End 75 | end:p2]; 76 | 77 | NSArray *result = [NSArray arrayWithObjects:curve1, curve2, nil]; 78 | 79 | [curve1 release]; 80 | [curve2 release]; 81 | 82 | return result; 83 | } 84 | 85 | -(NSArray *)asPointArray { 86 | /* 87 | if (pointArray != nil) { 88 | return pointArray; 89 | } 90 | */ 91 | if ([self isNearLinear]) { 92 | return [NSArray arrayWithObjects:[NSValue valueWithCGPoint:p1], [NSValue valueWithCGPoint:p2], nil]; 93 | } else { 94 | NSArray *div = [self subdivided]; 95 | NSMutableArray *pointArray = [[NSMutableArray alloc] initWithArray:[[div objectAtIndex:0] asPointArray]]; 96 | [pointArray autorelease]; 97 | [pointArray removeLastObject]; 98 | [pointArray addObjectsFromArray:[[div objectAtIndex:1] asPointArray]]; 99 | 100 | return pointArray; 101 | } 102 | 103 | } 104 | 105 | -(void)addToPointArray:(NSMutableArray *)pointArray { 106 | if ([self isNearLinear]) { 107 | [pointArray addObject:[NSValue valueWithCGPoint:p1]]; 108 | } else { 109 | NSArray *div = [self subdivided]; 110 | [[div objectAtIndex:0] addToPointArray:pointArray]; 111 | [[div objectAtIndex:1] addToPointArray:pointArray]; 112 | } 113 | 114 | } 115 | 116 | 117 | -(void)dealloc { 118 | //[pointArray release]; 119 | [super dealloc]; 120 | } 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /Classes/Curve/LinearBezierCurve.h: -------------------------------------------------------------------------------- 1 | // 2 | // LinearBezierCurve.h 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-26. 6 | // Copyright 2010 Bryan Spitz. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BezierCurve.h" 11 | 12 | @interface LinearBezierCurve : BezierCurve { 13 | } 14 | 15 | +(LinearBezierCurve *)linearCurveWithStartPoint:(CGPoint)start endPoint:(CGPoint)end; 16 | -(id)initWithStartPoint:(CGPoint)start endPoint:(CGPoint)end; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Classes/Curve/LinearBezierCurve.m: -------------------------------------------------------------------------------- 1 | // 2 | // LinearBezierCurve.m 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-26. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "LinearBezierCurve.h" 10 | 11 | 12 | @implementation LinearBezierCurve 13 | 14 | +(LinearBezierCurve *)linearCurveWithStartPoint:(CGPoint)start endPoint:(CGPoint)end { 15 | return [[[LinearBezierCurve alloc] initWithStartPoint:start endPoint:end] autorelease]; 16 | } 17 | 18 | -(id)initWithStartPoint:(CGPoint)start endPoint:(CGPoint)end { 19 | if (self = [super init]) { 20 | p1 = start; 21 | p2 = end; 22 | } 23 | return self; 24 | } 25 | 26 | -(BOOL)isNearLinear { 27 | return YES; 28 | } 29 | 30 | -(NSArray *)subdivided { 31 | CGPoint mid = CGPointMake((p1.x + p2.x)/2, (p1.y + p2.y)/2); 32 | LinearBezierCurve *curve1 = [[LinearBezierCurve alloc] initWithStartPoint:p1 endPoint:mid]; 33 | LinearBezierCurve *curve2 = [[LinearBezierCurve alloc] initWithStartPoint:mid endPoint:p2]; 34 | NSArray *result = [NSArray arrayWithObjects:curve1, curve2, nil]; 35 | [curve1 release]; 36 | [curve2 release]; 37 | 38 | return result; 39 | } 40 | 41 | -(NSArray *)asPointArray { 42 | return [NSArray arrayWithObjects:[NSValue valueWithCGPoint:p1], [NSValue valueWithCGPoint:p2], nil]; 43 | } 44 | 45 | -(void)addToPointArray:(NSMutableArray *)pointArray { 46 | [pointArray addObject:[NSValue valueWithCGPoint:p1]]; 47 | } 48 | @end 49 | -------------------------------------------------------------------------------- /Classes/Curve/NSArray_PointArray.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray_PointArray.h 3 | // Curve 4 | // 5 | // A category for NSArray, providing methods for extracting information from an array 6 | // of NSValues representing CGPoints. 7 | // 8 | // The structures PointArrayBounds and PointArrayLocation are provided for efficiency of common 9 | // operations (i.e. extracting subarrays and finding points and tangents at arbitrary lengths along 10 | // the array). 11 | // 12 | // Created by Bryan Spitz on 10-01-27. 13 | // Copyright 2010 Bryan Spitz. All rights reserved. 14 | // 15 | 16 | #import 17 | 18 | // A structure for extracting a subarray from the original array. 19 | // start is the start point of the subarray 20 | // end is the end point of the subarray 21 | // startIndex is the index of the first point in the array that is contained by the subarray 22 | // endIndex is the index of the first point in the array that is past the end of the subarray 23 | struct PointArrayBounds { 24 | CGPoint start; 25 | CGPoint end; 26 | NSInteger startIndex; 27 | NSInteger endIndex; 28 | }; 29 | 30 | // A structure for extracting a particular point from the array, along with the angle of the 31 | // line segment containing that point. 32 | struct PointArrayLocation { 33 | CGPoint location; 34 | CGFloat angle; 35 | }; 36 | 37 | typedef struct PointArrayBounds PointArrayBounds; 38 | typedef struct PointArrayLocation PointArrayLocation; 39 | 40 | @interface NSArray(PointArray) 41 | 42 | // Return the location and angle of a point at distance d along the curve represented by this array. 43 | -(PointArrayLocation)locationAtDistance:(CGFloat)d; 44 | 45 | // Return the total length of the curve represented by this array. 46 | -(CGFloat)length; 47 | 48 | // Return the information for a subcurve of the curve represented by this array. 49 | -(PointArrayBounds)pointArrayBoundsFromDistance:(CGFloat)from to:(CGFloat)to; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Classes/Curve/NSArray_PointArray.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray_PointArray.m 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-27. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "NSArray_PointArray.h" 10 | #import "CGPointArithmetic.h" 11 | #import 12 | 13 | @implementation NSArray(PointArray) 14 | 15 | -(PointArrayLocation)locationAtDistance:(CGFloat)d { 16 | if (d < 0) { 17 | @throw [NSException exceptionWithName:@"PointNotFoundException" reason:@"Point is before start of curve" userInfo:nil]; 18 | } 19 | 20 | PointArrayLocation result; 21 | 22 | for (NSInteger i = 1; i < [self count]; i++) { 23 | CGPoint current = [[self objectAtIndex:i] CGPointValue]; 24 | CGPoint last = [[self objectAtIndex:i-1] CGPointValue]; 25 | 26 | CGPoint diff = CGPointDifference(current, last); 27 | CGFloat distance = CGPointMagnitude(diff); 28 | 29 | if (d >= distance) { 30 | d -= distance; 31 | } else { 32 | CGPoint unit = CGPointScale(diff, 1/distance); 33 | CGPoint scaled = CGPointScale(unit, d); 34 | result.location = CGPointAdd(last, scaled); 35 | result.angle = atan2(unit.y, unit.x); 36 | return result; 37 | } 38 | 39 | } 40 | 41 | result.location = [[self lastObject] CGPointValue]; 42 | if ([self count] < 2) { 43 | result.angle = 0; 44 | } else { 45 | CGPoint current = [[self objectAtIndex:[self count] - 1] CGPointValue]; 46 | CGPoint last = [[self objectAtIndex:[self count] - 2] CGPointValue]; 47 | 48 | CGPoint diff = CGPointDifference(current, last); 49 | result.angle = atan2(diff.y, diff.x); 50 | } 51 | 52 | return result; 53 | //@throw [NSException exceptionWithName:@"PointNotFoundException" reason:@"Point is beyond end of curve" userInfo:nil]; 54 | } 55 | 56 | -(CGFloat)length { 57 | CGFloat result = 0; 58 | 59 | for (NSInteger i = 1; i < [self count]; i++) { 60 | CGPoint current = [[self objectAtIndex:i] CGPointValue]; 61 | CGPoint last = [[self objectAtIndex:i-1] CGPointValue]; 62 | 63 | CGPoint diff = CGPointDifference(current, last); 64 | CGFloat distance = CGPointMagnitude(diff); 65 | 66 | result += distance; 67 | } 68 | 69 | return result; 70 | } 71 | 72 | -(PointArrayBounds)pointArrayBoundsFromDistance:(CGFloat)from to:(CGFloat)to { 73 | PointArrayBounds result; 74 | 75 | if (from < 0) { 76 | @throw [NSException exceptionWithName:@"PointNotFoundException" reason:@"Point is before start of curve" userInfo:nil]; 77 | } 78 | 79 | CGFloat *source = &from; 80 | CGPoint *target = &(result.start); 81 | NSInteger *targetIndex = &(result.startIndex); 82 | BOOL foundStart = NO; 83 | 84 | CGPoint current; 85 | CGPoint last; 86 | for (NSInteger i = 1; i < [self count]; i++) { 87 | last = [[self objectAtIndex:i - 1] CGPointValue]; 88 | current = [[self objectAtIndex:i] CGPointValue]; 89 | 90 | CGPoint diff = CGPointDifference(current, last); 91 | CGFloat distance = CGPointMagnitude(diff); 92 | 93 | if (*source >= distance) { 94 | from -= distance; 95 | to -=distance; 96 | } else { 97 | CGPoint unit = CGPointScale(diff, 1/distance); 98 | CGPoint scaled = CGPointScale(unit, *source); 99 | *target = CGPointAdd(last, scaled); 100 | *targetIndex = i; 101 | if (!foundStart) { 102 | foundStart = YES; 103 | i--; 104 | source = &to; 105 | target = &(result.end); 106 | targetIndex = &(result.endIndex); 107 | } else { 108 | return result; 109 | } 110 | 111 | } 112 | 113 | } 114 | 115 | if (!foundStart) { 116 | result.start = [[self lastObject] CGPointValue]; 117 | result.startIndex = [self count]; 118 | } 119 | result.end = [[self lastObject] CGPointValue]; 120 | result.endIndex = [self count]; 121 | 122 | return result; 123 | 124 | } 125 | 126 | @end 127 | -------------------------------------------------------------------------------- /Classes/Curve/QuadraticBezierCurve.h: -------------------------------------------------------------------------------- 1 | // 2 | // QuadraticBezierCurve.h 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-26. 6 | // Copyright 2010 Bryan Spitz. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BezierCurve.h" 11 | 12 | @interface QuadraticBezierCurve : BezierCurve { 13 | CGPoint ctrl; 14 | } 15 | 16 | +(QuadraticBezierCurve *)quadraticCurveWithStartPoint:(CGPoint)start controlPoint:(CGPoint)control endPoint:(CGPoint)end; 17 | -(id)initWithStartPoint:(CGPoint)start controlPoint:(CGPoint)control endPoint:(CGPoint)end; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Classes/Curve/QuadraticBezierCurve.m: -------------------------------------------------------------------------------- 1 | // 2 | // QuadraticBezierCurve.m 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-26. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "QuadraticBezierCurve.h" 10 | #import "CGPointArithmetic.h" 11 | #import 12 | 13 | 14 | @implementation QuadraticBezierCurve 15 | 16 | +(QuadraticBezierCurve *)quadraticCurveWithStartPoint:(CGPoint)start controlPoint:(CGPoint)control endPoint:(CGPoint)end { 17 | return [[[QuadraticBezierCurve alloc] initWithStartPoint:start controlPoint:control endPoint:end] autorelease]; 18 | } 19 | 20 | -(id)initWithStartPoint:(CGPoint)start controlPoint:(CGPoint)control endPoint:(CGPoint)end { 21 | if (self = [super init]) { 22 | p1 = start; 23 | p2 = end; 24 | ctrl = control; 25 | } 26 | 27 | return self; 28 | } 29 | 30 | -(BOOL)isNearLinear { 31 | 32 | if (CGPointEqualToPoint(p1, p2) || CGPointEqualToPoint(p1, ctrl) || CGPointEqualToPoint(ctrl, p2)) { 33 | return YES; 34 | } 35 | 36 | CGPoint p1Ctrl = CGPointDifference(ctrl, p1); 37 | CGPoint p1p2 = CGPointDifference(p2, p1); 38 | 39 | CGFloat p1p2length = CGPointMagnitude(p1p2); 40 | CGFloat projectionLength = (p1Ctrl.x * p1p2.x + p1Ctrl.y * p1p2.y) / (p1p2length * p1p2length); 41 | 42 | CGPoint projectedPt = CGPointScale(p1p2, projectionLength); 43 | 44 | CGPoint diff = CGPointDifference(p1Ctrl, projectedPt); 45 | CGFloat distance = CGPointMagnitude(diff); 46 | 47 | return distance < 0.5; 48 | 49 | } 50 | 51 | -(NSArray *)subdivided { 52 | CGPoint ctrl1 = CGPointMidpoint(p1, ctrl); 53 | CGPoint ctrl2 = CGPointMidpoint(p2, ctrl); 54 | CGPoint mid = CGPointMidpoint(ctrl1, ctrl2); 55 | 56 | QuadraticBezierCurve *curve1 = [[QuadraticBezierCurve alloc] initWithStartPoint:p1 controlPoint:ctrl1 endPoint:mid]; 57 | QuadraticBezierCurve *curve2 = [[QuadraticBezierCurve alloc] initWithStartPoint:mid controlPoint:ctrl2 endPoint:p2]; 58 | 59 | NSArray *result = [NSArray arrayWithObjects:curve1, curve2, nil]; 60 | 61 | [curve1 release]; 62 | [curve2 release]; 63 | 64 | return result; 65 | } 66 | 67 | -(NSArray *)asPointArray { 68 | if ([self isNearLinear]) { 69 | return [NSArray arrayWithObjects:[NSValue valueWithCGPoint:p1], [NSValue valueWithCGPoint:p2], nil]; 70 | } else { 71 | NSArray *div = [self subdivided]; 72 | NSMutableArray *result = [NSMutableArray arrayWithArray:[[div objectAtIndex:0] asPointArray]]; 73 | [result removeLastObject]; 74 | [result addObjectsFromArray:[[div objectAtIndex:1] asPointArray]]; 75 | 76 | return result; 77 | } 78 | 79 | } 80 | 81 | -(void)addToPointArray:(NSMutableArray *)pointArray { 82 | if ([self isNearLinear]) { 83 | [pointArray addObject:[NSValue valueWithCGPoint:p1]]; 84 | } else { 85 | NSArray *div = [self subdivided]; 86 | [[div objectAtIndex:0] addToPointArray:pointArray]; 87 | [[div objectAtIndex:1] addToPointArray:pointArray]; 88 | } 89 | 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Classes/Curve/Spline.h: -------------------------------------------------------------------------------- 1 | // 2 | // Spline.h 3 | // Curve 4 | // 5 | // An Objective-C representation of a spline made of linear, quadratic, and cubic bezier curves. 6 | // 7 | // Created by Bryan Spitz on 10-01-23. 8 | // Copyright 2010 Bryan Spitz. All rights reserved. 9 | // 10 | 11 | #import 12 | 13 | 14 | @interface Spline : NSObject { 15 | NSMutableArray *curves; 16 | CGPoint begin; 17 | CGPoint current; 18 | } 19 | 20 | // Initialization methods - start a spline at a particular point. 21 | +(Spline *)splineAtPoint:(CGPoint)start; 22 | -(id)initAtPoint:(CGPoint)start; 23 | 24 | // Add a linear bezier curve (i.e. a line segment) to the spline, starting at the previous endpoint. 25 | -(void)addLinearCurveToPoint:(CGPoint)end; 26 | 27 | // Add a cubic bezier curve to the spline, starting at the previous endpoint. 28 | -(void)addCubicCurveWithControl1:(CGPoint)ctrl1 control2:(CGPoint)ctrl2 toPoint:(CGPoint)end; 29 | 30 | // Add a quadratic bezier curve to the spline, starting at the previous endpoint. 31 | -(void)addQuadCurveWithControl:(CGPoint)ctrl toPoint:(CGPoint)end; 32 | 33 | // Pop the most recently-added curve off the end of the spline. 34 | -(void)removeLastCurve; 35 | 36 | // Return an array of NSValues representing CGPoints dividing the spline into near-linear segments. 37 | -(NSArray *)asPointArray; 38 | @end 39 | -------------------------------------------------------------------------------- /Classes/Curve/Spline.m: -------------------------------------------------------------------------------- 1 | // 2 | // Spline.m 3 | // Curve 4 | // 5 | // Created by Bryan Spitz on 10-01-23. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "Spline.h" 10 | #import "CubicBezierCurve.h" 11 | #import "QuadraticBezierCurve.h" 12 | #import "LinearBezierCurve.h" 13 | 14 | @implementation Spline 15 | 16 | +(Spline *)splineAtPoint:(CGPoint)start { 17 | return [[[Spline alloc] initAtPoint:start] autorelease]; 18 | } 19 | 20 | -(id)initAtPoint:(CGPoint)start { 21 | if (self = [super init]) { 22 | current = start; 23 | begin = start; 24 | curves = [[NSMutableArray alloc] initWithCapacity:20]; 25 | } 26 | return self; 27 | } 28 | 29 | 30 | -(void)addCubicCurveWithControl1:(CGPoint)ctrl1 control2:(CGPoint)ctrl2 toPoint:(CGPoint)end { 31 | CubicBezierCurve *cubic = [[CubicBezierCurve alloc] initWithStart:current 32 | controlPoint1:ctrl1 33 | controlPoint2:ctrl2 34 | end:end]; 35 | 36 | [curves addObject:cubic]; 37 | [cubic release]; 38 | current = end; 39 | } 40 | 41 | -(void)addQuadCurveWithControl:(CGPoint)ctrl toPoint:(CGPoint)end { 42 | QuadraticBezierCurve *quad = [[QuadraticBezierCurve alloc] initWithStartPoint:current 43 | controlPoint:ctrl 44 | endPoint:end]; 45 | 46 | [curves addObject:quad]; 47 | [quad release]; 48 | current = end; 49 | } 50 | 51 | -(void)addLinearCurveToPoint:(CGPoint)end { 52 | LinearBezierCurve *linear = [[LinearBezierCurve alloc] initWithStartPoint:current endPoint:end]; 53 | [curves addObject:linear]; 54 | [linear release]; 55 | current = end; 56 | } 57 | 58 | 59 | -(void)removeLastCurve { 60 | [curves removeLastObject]; 61 | } 62 | 63 | -(NSArray *)asPointArray { 64 | if ([curves count] == 0) { 65 | return [NSArray arrayWithObject:[NSValue valueWithCGPoint:begin]]; 66 | } 67 | 68 | 69 | NSMutableArray *pointArray = [NSMutableArray arrayWithCapacity:[curves count] * 3]; 70 | 71 | for (NSInteger i = 0; i < [curves count]; i++) { 72 | [[curves objectAtIndex:i] addToPointArray:pointArray]; 73 | /* 74 | [pointArray addObjectsFromArray:[[curves objectAtIndex:i] asPointArray]]; 75 | if (i < [curves count] - 1) { 76 | [pointArray removeLastObject]; 77 | } 78 | */ 79 | } 80 | [pointArray addObject:[NSValue valueWithCGPoint:[[curves lastObject] p2]]]; 81 | 82 | return pointArray; 83 | } 84 | 85 | -(void)dealloc { 86 | [curves release]; 87 | [super dealloc]; 88 | } 89 | @end 90 | -------------------------------------------------------------------------------- /Classes/ImageFilter.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImageFilter.h 3 | // iphone-filters 4 | // 5 | // Created by Eric Silverberg on 6/16/11. 6 | // Copyright 2011 Perry Street Software, Inc. 7 | // 8 | // Licensed under the MIT License. 9 | // 10 | 11 | #import 12 | 13 | enum { 14 | CurveChannelNone = 0, 15 | CurveChannelRed = 1 << 0, 16 | CurveChannelGreen = 1 << 1, 17 | CurveChannelBlue = 1 << 2, 18 | }; 19 | typedef NSUInteger CurveChannel; 20 | 21 | @interface UIImage (ImageFilter) 22 | 23 | /* Filters */ 24 | - (UIImage*) greyscale; 25 | - (UIImage*) sepia; 26 | - (UIImage*) posterize:(int)levels; 27 | - (UIImage*) saturate:(double)amount; 28 | - (UIImage*) brightness:(double)amount; 29 | - (UIImage*) gamma:(double)amount; 30 | - (UIImage*) opacity:(double)amount; 31 | - (UIImage*) contrast:(double)amount; 32 | - (UIImage*) bias:(double)amount; 33 | - (UIImage*) invert; 34 | - (UIImage*)noise:(double)amount; 35 | 36 | /* Color Correction */ 37 | - (UIImage*) levels:(NSInteger)black mid:(NSInteger)mid white:(NSInteger)white; 38 | - (UIImage*) applyCurve:(NSArray*)points toChannel:(CurveChannel)channel; 39 | - (UIImage*) adjust:(double)r g:(double)g b:(double)b; 40 | 41 | /* Convolve Operations */ 42 | - (UIImage*) sharpen; 43 | - (UIImage*) edgeDetect; 44 | - (UIImage*) gaussianBlur:(NSUInteger)radius; 45 | - (UIImage*) vignette; 46 | - (UIImage*) darkVignette; 47 | - (UIImage*) polaroidish; 48 | 49 | /* Blend Operations */ 50 | - (UIImage*) overlay:(UIImage*)other; 51 | 52 | /* Pre-packed filter sets */ 53 | - (UIImage*) lomo; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Classes/ImageFilter.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImageFilter.m 3 | // iphone-filters 4 | // 5 | // Created by Eric Silverberg on 6/16/11. 6 | // Copyright 2011 Perry Street Software, Inc. 7 | // 8 | // Licensed under the MIT License. 9 | // 10 | // Some filters in the file are licensed under the ImageMagick License (the "License"); you may not use 11 | // this file except in compliance with the License. You may obtain a copy 12 | // of the License at 13 | // 14 | // http://www.imagemagick.org/script/license.php 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 19 | // License for the specific language governing permissions and limitations 20 | // under the License. 21 | // 22 | // Original ImageMagick filters source code is found at: 23 | // http://www.google.com/codesearch#I0cABDTB4TA/pub/FreeBSD/ports/distfiles/ImageMagick-6.3.2-0.tar.bz2%7Cqy9T8VaIuJE/ImageMagick-6.3.2/magick/effect.c 24 | // 25 | 26 | #include 27 | #import "ImageFilter.h" 28 | #import "CatmullRomSpline.h" 29 | 30 | /* These constants are used by ImageMagick */ 31 | typedef unsigned char Quantum; 32 | typedef double MagickRealType; 33 | 34 | #define RoundToQuantum(quantum) ClampToQuantum(quantum) 35 | #define ScaleCharToQuantum(value) ((Quantum) (value)) 36 | #define SigmaGaussian ScaleCharToQuantum(4) 37 | #define TauGaussian ScaleCharToQuantum(20) 38 | #define QuantumRange ((Quantum) 65535) 39 | 40 | /* These are our own constants */ 41 | #define SAFECOLOR(color) MIN(255,MAX(0,color)) 42 | 43 | typedef void (*FilterCallback)(UInt8 *pixelBuf, UInt32 offset, void *context); 44 | typedef void (*FilterBlendCallback)(UInt8 *pixelBuf, UInt8 *pixelBlendBuf, UInt32 offset, void *context); 45 | 46 | @implementation UIImage (ImageFilter) 47 | 48 | #pragma mark - 49 | #pragma mark Basic Filters 50 | #pragma mark Internals 51 | - (UIImage*) applyFilter:(FilterCallback)filter context:(void*)context 52 | { 53 | CGImageRef inImage = self.CGImage; 54 | size_t width = CGImageGetWidth(inImage); 55 | size_t height = CGImageGetHeight(inImage); 56 | size_t bits = CGImageGetBitsPerComponent(inImage); 57 | size_t bitsPerRow = CGImageGetBytesPerRow(inImage); 58 | CGColorSpaceRef colorSpace = CGImageGetColorSpace(inImage); 59 | int alphaInfo = CGImageGetAlphaInfo(inImage); 60 | 61 | if (alphaInfo != kCGImageAlphaPremultipliedLast && 62 | alphaInfo != kCGImageAlphaNoneSkipLast) { 63 | if (alphaInfo == kCGImageAlphaNone || 64 | alphaInfo == kCGImageAlphaNoneSkipFirst) { 65 | alphaInfo = kCGImageAlphaNoneSkipLast; 66 | }else { 67 | alphaInfo = kCGImageAlphaPremultipliedLast; 68 | } 69 | CGContextRef context = CGBitmapContextCreate(NULL, 70 | width, 71 | height, 72 | bits, 73 | bitsPerRow, 74 | colorSpace, 75 | alphaInfo); 76 | CGContextDrawImage(context, CGRectMake(0, 0, width, height), inImage); 77 | inImage = CGBitmapContextCreateImage(context); 78 | CGContextRelease(context); 79 | }else { 80 | CGImageRetain(inImage); 81 | } 82 | 83 | CFDataRef m_DataRef = CGDataProviderCopyData(CGImageGetDataProvider(inImage)); 84 | int length = CFDataGetLength(m_DataRef); 85 | CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef); 86 | CFRelease(m_DataRef); 87 | UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit); 88 | 89 | for (int i=0; i= (MagickRealType) QuantumRange) 294 | return((Quantum) QuantumRange); 295 | return((Quantum) (value+0.5)); 296 | } 297 | 298 | static inline double RandBetweenZeroAndOne() 299 | { 300 | double value = arc4random() % 1000000; 301 | value = value / 1000000; 302 | return value; 303 | } 304 | 305 | static inline Quantum GenerateGaussianNoise(double alpha, const Quantum pixel) 306 | { 307 | double beta = RandBetweenZeroAndOne(); 308 | double sigma = sqrt(-2.0*log((double) alpha))*cos((double) (2.0*M_PI*beta)); 309 | double tau = sqrt(-2.0*log((double) alpha))*sin((double) (2.0*M_PI*beta)); 310 | double noise = (MagickRealType) pixel+sqrt((double) pixel)*SigmaGaussian*sigma+TauGaussian*tau; 311 | 312 | return RoundToQuantum(noise); 313 | } 314 | 315 | void filterNoise(UInt8 *pixelBuf, UInt32 offset, void *context) 316 | { 317 | double alpha = 1.0 - *((double*)context); 318 | 319 | int r = offset; 320 | int g = offset+1; 321 | int b = offset+2; 322 | 323 | int red = pixelBuf[r]; 324 | int green = pixelBuf[g]; 325 | int blue = pixelBuf[b]; 326 | 327 | pixelBuf[r] = GenerateGaussianNoise(alpha, red); 328 | pixelBuf[g] = GenerateGaussianNoise(alpha, green); 329 | pixelBuf[b] = GenerateGaussianNoise(alpha, blue); 330 | } 331 | 332 | #pragma mark Filters 333 | -(UIImage*)greyscale 334 | { 335 | return [self applyFilter:filterGreyscale context:nil]; 336 | } 337 | 338 | - (UIImage*)sepia 339 | { 340 | return [self applyFilter:filterSepia context:nil]; 341 | } 342 | 343 | - (UIImage*)posterize:(int)levels 344 | { 345 | return [self applyFilter:filterPosterize context:&levels]; 346 | } 347 | 348 | - (UIImage*)saturate:(double)amount 349 | { 350 | return [self applyFilter:filterSaturate context:&amount]; 351 | } 352 | 353 | - (UIImage*)brightness:(double)amount 354 | { 355 | return [self applyFilter:filterBrightness context:&amount]; 356 | } 357 | 358 | - (UIImage*)gamma:(double)amount 359 | { 360 | return [self applyFilter:filterGamma context:&amount]; 361 | } 362 | 363 | - (UIImage*)opacity:(double)amount 364 | { 365 | return [self applyFilter:filterOpacity context:&amount]; 366 | } 367 | 368 | - (UIImage*)contrast:(double)amount 369 | { 370 | return [self applyFilter:filterContrast context:&amount]; 371 | } 372 | 373 | - (UIImage*)bias:(double)amount 374 | { 375 | return [self applyFilter:filterBias context:&amount]; 376 | } 377 | 378 | - (UIImage*)invert 379 | { 380 | return [self applyFilter:filterInvert context:nil]; 381 | } 382 | 383 | - (UIImage*)noise:(double)amount 384 | { 385 | return [self applyFilter:filterNoise context:&amount]; 386 | } 387 | 388 | #pragma mark - 389 | #pragma mark Blends 390 | #pragma mark Internals 391 | - (UIImage*) applyBlendFilter:(FilterBlendCallback)filter other:(UIImage*)other context:(void*)context 392 | { 393 | CGImageRef inImage = self.CGImage; 394 | 395 | 396 | size_t width = CGImageGetWidth(inImage); 397 | size_t height = CGImageGetHeight(inImage); 398 | size_t bits = CGImageGetBitsPerComponent(inImage); 399 | size_t bitsPerRow = CGImageGetBytesPerRow(inImage); 400 | CGColorSpaceRef colorSpace = CGImageGetColorSpace(inImage); 401 | int alphaInfo = CGImageGetAlphaInfo(inImage); 402 | 403 | if (alphaInfo != kCGImageAlphaPremultipliedLast || 404 | alphaInfo != kCGImageAlphaNoneSkipLast) { 405 | if (alphaInfo == kCGImageAlphaNone || 406 | alphaInfo == kCGImageAlphaNoneSkipFirst) { 407 | alphaInfo = kCGImageAlphaNoneSkipLast; 408 | }else { 409 | alphaInfo = kCGImageAlphaPremultipliedLast; 410 | } 411 | CGContextRef context = CGBitmapContextCreate(NULL, 412 | width, 413 | height, 414 | bits, 415 | bitsPerRow, 416 | colorSpace, 417 | alphaInfo); 418 | CGContextDrawImage(context, CGRectMake(0, 0, width, height), inImage); 419 | inImage = CGBitmapContextCreateImage(context); 420 | CGContextRelease(context); 421 | }else { 422 | CGImageRetain(inImage); 423 | } 424 | 425 | CFDataRef m_DataRef = CGDataProviderCopyData(CGImageGetDataProvider(inImage)); 426 | int length = CFDataGetLength(m_DataRef); 427 | CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef); 428 | CFRelease(m_DataRef); 429 | UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit); 430 | 431 | CGImageRef otherImage = other.CGImage; 432 | CFDataRef m_OtherDataRef = CGDataProviderCopyData(CGImageGetDataProvider(otherImage)); 433 | int otherLength = CFDataGetLength(m_OtherDataRef); 434 | CFMutableDataRef m_OtherDataRefEdit = CFDataCreateMutableCopy(NULL,otherLength,m_OtherDataRef); 435 | CFRelease(m_OtherDataRef); 436 | UInt8 * m_OtherPixelBuf = (UInt8 *) CFDataGetBytePtr(m_OtherDataRef); 437 | 438 | int h = self.size.height; 439 | int w = self.size.width; 440 | 441 | 442 | for (int i=0; i 128.0f) ? 255.0f - 2.0f * (255.0f - t) * (255.0f - b) / 255.0f: (b * t * 2.0f) / 255.0f; 474 | } 475 | 476 | void filterOverlay(UInt8 *pixelBuf, UInt8 *pixedBlendBuf, UInt32 offset, void *context) 477 | { 478 | int r = offset; 479 | int g = offset+1; 480 | int b = offset+2; 481 | int a = offset+3; 482 | 483 | int red = pixelBuf[r]; 484 | int green = pixelBuf[g]; 485 | int blue = pixelBuf[b]; 486 | 487 | int blendRed = pixedBlendBuf[r]; 488 | int blendGreen = pixedBlendBuf[g]; 489 | int blendBlue = pixedBlendBuf[b]; 490 | double blendAlpha = pixedBlendBuf[a] / 255.0f; 491 | 492 | // http://en.wikipedia.org/wiki/Alpha_compositing 493 | // double blendAlpha = pixedBlendBuf[a] / 255.0f; 494 | // double blendRed = pixedBlendBuf[r] * blendAlpha + red * (1-blendAlpha); 495 | // double blendGreen = pixedBlendBuf[g] * blendAlpha + green * (1-blendAlpha); 496 | // double blendBlue = pixedBlendBuf[b] * blendAlpha + blue * (1-blendAlpha); 497 | 498 | int resultR = SAFECOLOR(calcOverlay(red, blendRed)); 499 | int resultG = SAFECOLOR(calcOverlay(green, blendGreen)); 500 | int resultB = SAFECOLOR(calcOverlay(blue, blendBlue)); 501 | 502 | // take this result, and blend it back again using the alpha of the top guy 503 | pixelBuf[r] = SAFECOLOR(resultR * blendAlpha + red * (1 - blendAlpha)); 504 | pixelBuf[g] = SAFECOLOR(resultG * blendAlpha + green * (1 - blendAlpha)); 505 | pixelBuf[b] = SAFECOLOR(resultB * blendAlpha + blue * (1 - blendAlpha)); 506 | 507 | } 508 | 509 | void filterMask(UInt8 *pixelBuf, UInt8 *pixedBlendBuf, UInt32 offset, void *context) 510 | { 511 | int r = offset; 512 | // int g = offset+1; 513 | // int b = offset+2; 514 | int a = offset+3; 515 | 516 | // take this result, and blend it back again using the alpha of the top guy 517 | pixelBuf[a] = pixedBlendBuf[r]; 518 | } 519 | 520 | void filterMerge(UInt8 *pixelBuf, UInt8 *pixedBlendBuf, UInt32 offset, void *context) 521 | { 522 | int r = offset; 523 | int g = offset+1; 524 | int b = offset+2; 525 | int a = offset+3; 526 | 527 | int red = pixelBuf[r]; 528 | int green = pixelBuf[g]; 529 | int blue = pixelBuf[b]; 530 | 531 | int blendRed = pixedBlendBuf[r]; 532 | int blendGreen = pixedBlendBuf[g]; 533 | int blendBlue = pixedBlendBuf[b]; 534 | double blendAlpha = pixedBlendBuf[a] / 255.0f; 535 | 536 | // take this result, and blend it back again using the alpha of the top guy 537 | pixelBuf[r] = SAFECOLOR(blendRed * blendAlpha + red * (1 - blendAlpha)); 538 | pixelBuf[g] = SAFECOLOR(blendGreen * blendAlpha + green * (1 - blendAlpha)); 539 | pixelBuf[b] = SAFECOLOR(blendBlue * blendAlpha + blue * (1 - blendAlpha)); 540 | } 541 | 542 | #pragma mark Filters 543 | - (UIImage*) overlay:(UIImage*)other; 544 | { 545 | return [self applyBlendFilter:filterOverlay other:other context:nil]; 546 | } 547 | 548 | - (UIImage*) mask:(UIImage*)other; 549 | { 550 | return [self applyBlendFilter:filterMask other:other context:nil]; 551 | } 552 | 553 | - (UIImage*) merge:(UIImage*)other; 554 | { 555 | return [self applyBlendFilter:filterMerge other:other context:nil]; 556 | } 557 | 558 | 559 | #pragma mark - 560 | #pragma mark Color Correction 561 | #pragma mark C Implementation 562 | typedef struct 563 | { 564 | int blackPoint; 565 | int whitePoint; 566 | int midPoint; 567 | } LevelsOptions; 568 | 569 | int calcLevelColor(int color, int black, int mid, int white) 570 | { 571 | if (color < black) { 572 | return 0; 573 | } else if (color < mid) { 574 | int width = (mid - black); 575 | double stepSize = ((double)width / 128.0f); 576 | return (int)((double)(color - black) / stepSize); 577 | } else if (color < white) { 578 | int width = (white - mid); 579 | double stepSize = ((double)width / 128.0f); 580 | return 128 + (int)((double)(color - mid) / stepSize); 581 | } 582 | 583 | return 255; 584 | } 585 | void filterLevels(UInt8 *pixelBuf, UInt32 offset, void *context) 586 | { 587 | LevelsOptions val = *((LevelsOptions*)context); 588 | int r = offset; 589 | int g = offset+1; 590 | int b = offset+2; 591 | 592 | int red = pixelBuf[r]; 593 | int green = pixelBuf[g]; 594 | int blue = pixelBuf[b]; 595 | 596 | pixelBuf[r] = SAFECOLOR(calcLevelColor(red, val.blackPoint, val.midPoint, val.whitePoint)); 597 | pixelBuf[g] = SAFECOLOR(calcLevelColor(green, val.blackPoint, val.midPoint, val.whitePoint)); 598 | pixelBuf[b] = SAFECOLOR(calcLevelColor(blue, val.blackPoint, val.midPoint, val.whitePoint)); 599 | } 600 | 601 | typedef struct 602 | { 603 | CurveChannel channel; 604 | CGPoint *points; 605 | int length; 606 | } CurveEquation; 607 | 608 | double valueGivenCurve(CurveEquation equation, double xValue) 609 | { 610 | assert(xValue <= 255); 611 | assert(xValue >= 0); 612 | 613 | CGPoint point1 = CGPointZero; 614 | CGPoint point2 = CGPointZero; 615 | NSInteger idx = 0; 616 | 617 | for (idx = 0; idx < equation.length; idx++) 618 | { 619 | CGPoint point = equation.points[idx]; 620 | if (xValue < point.x) 621 | { 622 | point2 = point; 623 | if (idx - 1 >= 0) 624 | { 625 | point1 = equation.points[idx-1]; 626 | } 627 | else 628 | { 629 | point1 = point2; 630 | } 631 | 632 | break; 633 | } 634 | } 635 | 636 | double m = (point2.y - point1.y)/(point2.x - point1.x); 637 | double b = point2.y - (m * point2.x); 638 | double y = m * xValue + b; 639 | return y; 640 | } 641 | 642 | void filterCurve(UInt8 *pixelBuf, UInt32 offset, void *context) 643 | { 644 | CurveEquation equation = *((CurveEquation*)context); 645 | 646 | int r = offset; 647 | int g = offset+1; 648 | int b = offset+2; 649 | 650 | int red = pixelBuf[r]; 651 | int green = pixelBuf[g]; 652 | int blue = pixelBuf[b]; 653 | 654 | red = equation.channel & CurveChannelRed ? valueGivenCurve(equation, red) : red; 655 | green = equation.channel & CurveChannelGreen ? valueGivenCurve(equation, green) : green; 656 | blue = equation.channel & CurveChannelBlue ? valueGivenCurve(equation, blue) : blue; 657 | 658 | pixelBuf[r] = SAFECOLOR(red); 659 | pixelBuf[g] = SAFECOLOR(green); 660 | pixelBuf[b] = SAFECOLOR(blue); 661 | } 662 | typedef struct 663 | { 664 | double r; 665 | double g; 666 | double b; 667 | } RGBAdjust; 668 | 669 | 670 | void filterAdjust(UInt8 *pixelBuf, UInt32 offset, void *context) 671 | { 672 | RGBAdjust val = *((RGBAdjust*)context); 673 | int r = offset; 674 | int g = offset+1; 675 | int b = offset+2; 676 | 677 | int red = pixelBuf[r]; 678 | int green = pixelBuf[g]; 679 | int blue = pixelBuf[b]; 680 | 681 | pixelBuf[r] = SAFECOLOR(red * (1 + val.r)); 682 | pixelBuf[g] = SAFECOLOR(green * (1 + val.g)); 683 | pixelBuf[b] = SAFECOLOR(blue * (1 + val.b)); 684 | } 685 | 686 | #pragma mark Filters 687 | /* 688 | * Levels: Similar to levels in photoshop. 689 | * todo: Specify per-channel 690 | * 691 | * Parameters: 692 | * black: 0-255 693 | * mid: 0-255 694 | * white: 0-255 695 | */ 696 | - (UIImage*) levels:(NSInteger)black mid:(NSInteger)mid white:(NSInteger)white 697 | { 698 | LevelsOptions l; 699 | l.midPoint = mid; 700 | l.whitePoint = white; 701 | l.blackPoint = black; 702 | 703 | return [self applyFilter:filterLevels context:&l]; 704 | } 705 | 706 | /* 707 | * Levels: Similar to curves in photoshop. 708 | * todo: Use a Bicubic spline not a catmull rom spline 709 | * 710 | * Parameters: 711 | * points: An NSArray of CGPoints through which the curve runs 712 | * toChannel: A bitmask of the channels to which the curve gets applied 713 | */ 714 | - (UIImage*) applyCurve:(NSArray*)points toChannel:(CurveChannel)channel 715 | { 716 | assert([points count] > 1); 717 | 718 | CGPoint firstPoint = ((NSValue*)[points objectAtIndex:0]).CGPointValue; 719 | CatmullRomSpline *spline = [CatmullRomSpline catmullRomSplineAtPoint:firstPoint]; 720 | NSInteger idx = 0; 721 | NSInteger length = [points count]; 722 | for (idx = 1; idx < length; idx++) 723 | { 724 | CGPoint point = ((NSValue*)[points objectAtIndex:idx]).CGPointValue; 725 | [spline addPoint:point]; 726 | NSLog(@"Adding point %@",NSStringFromCGPoint(point)); 727 | } 728 | 729 | NSArray *splinePoints = [spline asPointArray]; 730 | length = [splinePoints count]; 731 | CGPoint *cgPoints = malloc(sizeof(CGPoint) * length); 732 | memset(cgPoints, 0, sizeof(CGPoint) * length); 733 | for (idx = 0; idx < length; idx++) 734 | { 735 | CGPoint point = ((NSValue*)[splinePoints objectAtIndex:idx]).CGPointValue; 736 | NSLog(@"Adding point %@",NSStringFromCGPoint(point)); 737 | cgPoints[idx].x = point.x; 738 | cgPoints[idx].y = point.y; 739 | } 740 | 741 | CurveEquation equation; 742 | equation.length = length; 743 | equation.points = cgPoints; 744 | equation.channel = channel; 745 | UIImage *result = [self applyFilter:filterCurve context:&equation]; 746 | free(cgPoints); 747 | return result; 748 | } 749 | 750 | 751 | /* 752 | * adjust: Similar to color balance 753 | * 754 | * Parameters: 755 | * r: Multiplier of r. Make < 0 to reduce red, > 0 to increase red 756 | * g: Multiplier of g. Make < 0 to reduce green, > 0 to increase green 757 | * b: Multiplier of b. Make < 0 to reduce blue, > 0 to increase blue 758 | */ 759 | - (UIImage*)adjust:(double)r g:(double)g b:(double)b 760 | { 761 | RGBAdjust adjust; 762 | adjust.r = r; 763 | adjust.g = g; 764 | adjust.b = b; 765 | 766 | return [self applyFilter:filterAdjust context:&adjust]; 767 | } 768 | 769 | #pragma mark - 770 | #pragma mark Convolve Operations 771 | #pragma mark Internals 772 | - (UIImage*) applyConvolve:(NSArray*)kernel 773 | { 774 | CGImageRef inImage = self.CGImage; 775 | CFDataRef m_DataRef = CGDataProviderCopyData(CGImageGetDataProvider(inImage)); 776 | CFDataRef m_OutDataRef = CGDataProviderCopyData(CGImageGetDataProvider(inImage)); 777 | 778 | int length = CFDataGetLength(m_DataRef); 779 | CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef); 780 | CFRelease(m_DataRef); 781 | UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit); 782 | 783 | int outputLength = CFDataGetLength(m_OutDataRef); 784 | CFMutableDataRef m_OutDataRefEdit = CFDataCreateMutableCopy(NULL,outputLength,m_DataRef); 785 | CFRelease(m_OutDataRef); 786 | UInt8 * m_OutPixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_OutDataRefEdit); 787 | 788 | int h = CGImageGetHeight(inImage); 789 | int w = CGImageGetWidth(inImage); 790 | 791 | int kh = [kernel count] / 2; 792 | int kw = [[kernel objectAtIndex:0] count] / 2; 793 | int i = 0, j = 0, n = 0, m = 0; 794 | 795 | for (i = 0; i < h; i++) { 796 | for (j = 0; j < w; j++) { 797 | int outIndex = (i*w*4) + (j*4); 798 | double r = 0, g = 0, b = 0; 799 | for (n = -kh; n <= kh; n++) { 800 | for (m = -kw; m <= kw; m++) { 801 | if (i + n >= 0 && i + n < h) { 802 | if (j + m >= 0 && j + m < w) { 803 | double f = [[[kernel objectAtIndex:(n + kh)] objectAtIndex:(m + kw)] doubleValue]; 804 | if (f == 0) {continue;} 805 | int inIndex = ((i+n)*w*4) + ((j+m)*4); 806 | r += m_PixelBuf[inIndex] * f; 807 | g += m_PixelBuf[inIndex + 1] * f; 808 | b += m_PixelBuf[inIndex + 2] * f; 809 | } 810 | } 811 | } 812 | } 813 | m_OutPixelBuf[outIndex] = SAFECOLOR((int)r); 814 | m_OutPixelBuf[outIndex + 1] = SAFECOLOR((int)g); 815 | m_OutPixelBuf[outIndex + 2] = SAFECOLOR((int)b); 816 | m_OutPixelBuf[outIndex + 3] = 255; 817 | } 818 | } 819 | 820 | CGContextRef ctx = CGBitmapContextCreate(m_OutPixelBuf, 821 | CGImageGetWidth(inImage), 822 | CGImageGetHeight(inImage), 823 | CGImageGetBitsPerComponent(inImage), 824 | CGImageGetBytesPerRow(inImage), 825 | CGImageGetColorSpace(inImage), 826 | CGImageGetBitmapInfo(inImage) 827 | ); 828 | 829 | CGImageRef imageRef = CGBitmapContextCreateImage(ctx); 830 | CGContextRelease(ctx); 831 | UIImage *finalImage = [UIImage imageWithCGImage:imageRef]; 832 | CGImageRelease(imageRef); 833 | CFRelease(m_DataRefEdit); 834 | CFRelease(m_OutDataRefEdit); 835 | return finalImage; 836 | 837 | } 838 | #pragma mark Filters 839 | - (UIImage*) sharpen 840 | { 841 | double dKernel[5][5]={ 842 | {0, 0.0, -0.2, 0.0, 0}, 843 | {0, -0.2, 1.8, -0.2, 0}, 844 | {0, 0.0, -0.2, 0.0, 0}}; 845 | 846 | NSMutableArray *kernel = [[[NSMutableArray alloc] initWithCapacity:5] autorelease]; 847 | for (int i = 0; i < 5; i++) { 848 | NSMutableArray *row = [[[NSMutableArray alloc] initWithCapacity:5] autorelease]; 849 | for (int j = 0; j < 5; j++) { 850 | [row addObject:[NSNumber numberWithDouble:dKernel[i][j]]]; 851 | } 852 | [kernel addObject:row]; 853 | } 854 | return [self applyConvolve:kernel]; 855 | } 856 | 857 | - (UIImage*) edgeDetect 858 | { 859 | double dKernel[5][5]={ 860 | {0, 0.0, 1.0, 0.0, 0}, 861 | {0, 1.0, -4.0, 1.0, 0}, 862 | {0, 0.0, 1.0, 0.0, 0}}; 863 | 864 | NSMutableArray *kernel = [[[NSMutableArray alloc] initWithCapacity:5] autorelease]; 865 | for (int i = 0; i < 5; i++) { 866 | NSMutableArray *row = [[[NSMutableArray alloc] initWithCapacity:5] autorelease]; 867 | for (int j = 0; j < 5; j++) { 868 | [row addObject:[NSNumber numberWithDouble:dKernel[i][j]]]; 869 | } 870 | [kernel addObject:row]; 871 | } 872 | return [self applyConvolve:kernel]; 873 | } 874 | 875 | + (NSArray*) makeKernel:(int)length 876 | { 877 | NSMutableArray *kernel = [[[NSMutableArray alloc] initWithCapacity:10] autorelease]; 878 | int radius = length / 2; 879 | 880 | double m = 1.0f/(2*M_PI*radius*radius); 881 | double a = 2.0 * radius * radius; 882 | double sum = 0.0; 883 | 884 | for (int y = 0-radius; y < length-radius; y++) 885 | { 886 | NSMutableArray *row = [[[NSMutableArray alloc] initWithCapacity:10] autorelease]; 887 | for (int x = 0-radius; x < length-radius; x++) 888 | { 889 | double dist = (x*x) + (y*y); 890 | double val = m*exp(-(dist / a)); 891 | [row addObject:[NSNumber numberWithDouble:val]]; 892 | sum += val; 893 | } 894 | [kernel addObject:row]; 895 | } 896 | 897 | //for Kernel-Sum of 1.0 898 | NSMutableArray *finalKernel = [[[NSMutableArray alloc] initWithCapacity:length] autorelease]; 899 | for (int y = 0; y < length; y++) 900 | { 901 | NSMutableArray *row = [kernel objectAtIndex:y]; 902 | NSMutableArray *newRow = [[[NSMutableArray alloc] initWithCapacity:length] autorelease]; 903 | for (int x = 0; x < length; x++) 904 | { 905 | NSNumber *value = [row objectAtIndex:x]; 906 | [newRow addObject:[NSNumber numberWithDouble:([value doubleValue] / sum)]]; 907 | } 908 | [finalKernel addObject:newRow]; 909 | } 910 | return finalKernel; 911 | } 912 | 913 | - (UIImage*) gaussianBlur:(NSUInteger)radius 914 | { 915 | // Pre-calculated kernel 916 | // double dKernel[5][5]={ 917 | // {1.0f/273.0f, 4.0f/273.0f, 7.0f/273.0f, 4.0f/273.0f, 1.0f/273.0f}, 918 | // {4.0f/273.0f, 16.0f/273.0f, 26.0f/273.0f, 16.0f/273.0f, 4.0f/273.0f}, 919 | // {7.0f/273.0f, 26.0f/273.0f, 41.0f/273.0f, 26.0f/273.0f, 7.0f/273.0f}, 920 | // {4.0f/273.0f, 16.0f/273.0f, 26.0f/273.0f, 16.0f/273.0f, 4.0f/273.0f}, 921 | // {1.0f/273.0f, 4.0f/273.0f, 7.0f/273.0f, 4.0f/273.0f, 1.0f/273.0f}}; 922 | // 923 | // NSMutableArray *kernel = [[[NSMutableArray alloc] initWithCapacity:5] autorelease]; 924 | // for (int i = 0; i < 5; i++) { 925 | // NSMutableArray *row = [[[NSMutableArray alloc] initWithCapacity:5] autorelease]; 926 | // for (int j = 0; j < 5; j++) { 927 | // [row addObject:[NSNumber numberWithDouble:dKernel[i][j]]]; 928 | // } 929 | // [kernel addObject:row]; 930 | // } 931 | return [self applyConvolve:[UIImage makeKernel:((radius*2)+1)]]; 932 | } 933 | 934 | #pragma mark - 935 | #pragma mark Pre-packaged 936 | - (UIImage*)lomo 937 | { 938 | UIImage *image = [[self saturate:1.2] contrast:1.15]; 939 | NSArray *redPoints = [NSArray arrayWithObjects: 940 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 941 | [NSValue valueWithCGPoint:CGPointMake(137, 118)], 942 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 943 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 944 | nil]; 945 | NSArray *greenPoints = [NSArray arrayWithObjects: 946 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 947 | [NSValue valueWithCGPoint:CGPointMake(64, 54)], 948 | [NSValue valueWithCGPoint:CGPointMake(175, 194)], 949 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 950 | nil]; 951 | NSArray *bluePoints = [NSArray arrayWithObjects: 952 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 953 | [NSValue valueWithCGPoint:CGPointMake(59, 64)], 954 | [NSValue valueWithCGPoint:CGPointMake(203, 189)], 955 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 956 | nil]; 957 | image = [[[image applyCurve:redPoints toChannel:CurveChannelRed] 958 | applyCurve:greenPoints toChannel:CurveChannelGreen] 959 | applyCurve:bluePoints toChannel:CurveChannelBlue]; 960 | 961 | return [image darkVignette]; 962 | } 963 | 964 | - (UIImage*) vignette 965 | { 966 | CGImageRef inImage = self.CGImage; 967 | CFDataRef m_DataRef = CGDataProviderCopyData(CGImageGetDataProvider(inImage)); 968 | int length = CFDataGetLength(m_DataRef); 969 | CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef); 970 | CFRelease(m_DataRef); 971 | UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit); 972 | memset(m_PixelBuf,0,length); 973 | 974 | CGContextRef ctx = CGBitmapContextCreate(m_PixelBuf, 975 | CGImageGetWidth(inImage), 976 | CGImageGetHeight(inImage), 977 | CGImageGetBitsPerComponent(inImage), 978 | CGImageGetBytesPerRow(inImage), 979 | CGImageGetColorSpace(inImage), 980 | CGImageGetBitmapInfo(inImage) 981 | ); 982 | 983 | 984 | int borderWidth = 0.10 * self.size.width; 985 | CGContextSetRGBFillColor(ctx, 0,0,0,1); 986 | CGContextFillRect(ctx, CGRectMake(0, 0, self.size.width, self.size.height)); 987 | CGContextSetRGBFillColor(ctx, 1.0,1.0,1.0,1); 988 | CGContextFillEllipseInRect(ctx, CGRectMake(borderWidth, borderWidth, 989 | self.size.width-(2*borderWidth), 990 | self.size.height-(2*borderWidth))); 991 | 992 | CGImageRef imageRef = CGBitmapContextCreateImage(ctx); 993 | CGContextRelease(ctx); 994 | UIImage *finalImage = [UIImage imageWithCGImage:imageRef]; 995 | CGImageRelease(imageRef); 996 | CFRelease(m_DataRefEdit); 997 | 998 | UIImage *mask = [finalImage gaussianBlur:10]; 999 | UIImage *blurredSelf = [self gaussianBlur:2]; 1000 | UIImage *maskedSelf = [self mask:mask]; 1001 | return [blurredSelf merge:maskedSelf]; 1002 | } 1003 | 1004 | - (UIImage*) darkVignette 1005 | { 1006 | CGImageRef inImage = self.CGImage; 1007 | CFDataRef m_DataRef = CGDataProviderCopyData(CGImageGetDataProvider(inImage)); 1008 | int length = CFDataGetLength(m_DataRef); 1009 | CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy(NULL,length,m_DataRef); 1010 | CFRelease(m_DataRef); 1011 | UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr(m_DataRefEdit); 1012 | memset(m_PixelBuf,0,length); 1013 | 1014 | CGContextRef ctx = CGBitmapContextCreate(m_PixelBuf, 1015 | CGImageGetWidth(inImage), 1016 | CGImageGetHeight(inImage), 1017 | CGImageGetBitsPerComponent(inImage), 1018 | CGImageGetBytesPerRow(inImage), 1019 | CGImageGetColorSpace(inImage), 1020 | CGImageGetBitmapInfo(inImage) 1021 | ); 1022 | 1023 | 1024 | int borderWidth = 0.05 * self.size.width; 1025 | CGContextSetRGBFillColor(ctx, 1.0,1.0,1.0,1); 1026 | CGContextFillRect(ctx, CGRectMake(0, 0, self.size.width, self.size.height)); 1027 | CGContextSetRGBFillColor(ctx, 0,0,0,1); 1028 | CGContextFillRect(ctx, CGRectMake(borderWidth, borderWidth, 1029 | self.size.width-(2*borderWidth), 1030 | self.size.height-(2*borderWidth))); 1031 | 1032 | CGImageRef imageRef = CGBitmapContextCreateImage(ctx); 1033 | CGContextRelease(ctx); 1034 | UIImage *finalImage = [UIImage imageWithCGImage:imageRef]; 1035 | CGImageRelease(imageRef); 1036 | 1037 | UIImage *mask = [finalImage gaussianBlur:10]; 1038 | 1039 | 1040 | ctx = CGBitmapContextCreate(m_PixelBuf, 1041 | CGImageGetWidth(inImage), 1042 | CGImageGetHeight(inImage), 1043 | CGImageGetBitsPerComponent(inImage), 1044 | CGImageGetBytesPerRow(inImage), 1045 | CGImageGetColorSpace(inImage), 1046 | CGImageGetBitmapInfo(inImage) 1047 | ); 1048 | CGContextSetRGBFillColor(ctx, 0,0,0,1); 1049 | CGContextFillRect(ctx, CGRectMake(0, 0, self.size.width, self.size.height)); 1050 | imageRef = CGBitmapContextCreateImage(ctx); 1051 | CGContextRelease(ctx); 1052 | UIImage *blackSquare = [UIImage imageWithCGImage:imageRef]; 1053 | CGImageRelease(imageRef); 1054 | CFRelease(m_DataRefEdit); 1055 | UIImage *maskedSquare = [blackSquare mask:mask]; 1056 | return [self overlay:[maskedSquare opacity:1.0]]; 1057 | } 1058 | 1059 | // This filter is not done... 1060 | - (UIImage*) polaroidish 1061 | { 1062 | NSArray *redPoints = [NSArray arrayWithObjects: 1063 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 1064 | [NSValue valueWithCGPoint:CGPointMake(93, 81)], 1065 | [NSValue valueWithCGPoint:CGPointMake(247, 241)], 1066 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 1067 | nil]; 1068 | NSArray *bluePoints = [NSArray arrayWithObjects: 1069 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 1070 | [NSValue valueWithCGPoint:CGPointMake(57, 59)], 1071 | [NSValue valueWithCGPoint:CGPointMake(223, 205)], 1072 | [NSValue valueWithCGPoint:CGPointMake(255, 241)], 1073 | nil]; 1074 | UIImage *image = [[self applyCurve:redPoints toChannel:CurveChannelRed] 1075 | applyCurve:bluePoints toChannel:CurveChannelBlue]; 1076 | 1077 | redPoints = [NSArray arrayWithObjects: 1078 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 1079 | [NSValue valueWithCGPoint:CGPointMake(93, 76)], 1080 | [NSValue valueWithCGPoint:CGPointMake(232, 226)], 1081 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 1082 | nil]; 1083 | bluePoints = [NSArray arrayWithObjects: 1084 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 1085 | [NSValue valueWithCGPoint:CGPointMake(57, 59)], 1086 | [NSValue valueWithCGPoint:CGPointMake(220, 202)], 1087 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 1088 | nil]; 1089 | image = [[image applyCurve:redPoints toChannel:CurveChannelRed] 1090 | applyCurve:bluePoints toChannel:CurveChannelBlue]; 1091 | 1092 | return image; 1093 | } 1094 | @end 1095 | -------------------------------------------------------------------------------- /Classes/iphone_filtersAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // iphone_filtersAppDelegate.h 3 | // iphone-filters 4 | // 5 | // Created by Eric Silverberg on 6/16/11. 6 | // Copyright 2011 Perry Street Software, Inc. 7 | // 8 | // Licensed under the MIT License. 9 | // 10 | 11 | #import 12 | 13 | @class iphone_filtersViewController; 14 | 15 | @interface iphone_filtersAppDelegate : NSObject { 16 | UIWindow *window; 17 | iphone_filtersViewController *viewController; 18 | } 19 | 20 | @property (nonatomic, retain) IBOutlet UIWindow *window; 21 | @property (nonatomic, retain) IBOutlet iphone_filtersViewController *viewController; 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /Classes/iphone_filtersAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // iphone_filtersAppDelegate.m 3 | // iphone-filters 4 | // 5 | // Created by Eric Silverberg on 6/16/11. 6 | // Copyright 2011 Perry Street Software, Inc. 7 | // 8 | // Licensed under the MIT License. 9 | // 10 | 11 | #import "iphone_filtersAppDelegate.h" 12 | #import "iphone_filtersViewController.h" 13 | 14 | @implementation iphone_filtersAppDelegate 15 | 16 | @synthesize window; 17 | @synthesize viewController; 18 | 19 | 20 | #pragma mark - 21 | #pragma mark Application lifecycle 22 | 23 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 24 | 25 | // Override point for customization after application launch. 26 | 27 | // Set the view controller as the window's root view controller and display. 28 | self.window.rootViewController = self.viewController; 29 | [self.window makeKeyAndVisible]; 30 | 31 | return YES; 32 | } 33 | 34 | 35 | - (void)applicationWillResignActive:(UIApplication *)application { 36 | /* 37 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 38 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 39 | */ 40 | } 41 | 42 | 43 | - (void)applicationDidEnterBackground:(UIApplication *)application { 44 | /* 45 | Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 46 | If your application supports background execution, called instead of applicationWillTerminate: when the user quits. 47 | */ 48 | } 49 | 50 | 51 | - (void)applicationWillEnterForeground:(UIApplication *)application { 52 | /* 53 | Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. 54 | */ 55 | } 56 | 57 | 58 | - (void)applicationDidBecomeActive:(UIApplication *)application { 59 | /* 60 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 61 | */ 62 | } 63 | 64 | 65 | - (void)applicationWillTerminate:(UIApplication *)application { 66 | /* 67 | Called when the application is about to terminate. 68 | See also applicationDidEnterBackground:. 69 | */ 70 | } 71 | 72 | 73 | #pragma mark - 74 | #pragma mark Memory management 75 | 76 | - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { 77 | /* 78 | Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. 79 | */ 80 | } 81 | 82 | 83 | - (void)dealloc { 84 | [viewController release]; 85 | [window release]; 86 | [super dealloc]; 87 | } 88 | 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /Classes/iphone_filtersViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // iphone_filtersViewController.h 3 | // iphone-filters 4 | // 5 | // Created by Eric Silverberg on 6/16/11. 6 | // Copyright 2011 Perry Street Software, Inc. 7 | // 8 | // Licensed under the MIT License. 9 | // 10 | 11 | #import 12 | 13 | typedef enum 14 | { 15 | FilterPosterize = 0, 16 | FilterSaturate, 17 | FilterBrightness, 18 | FilterContrast, 19 | FilterGamma, 20 | FilterNoise, 21 | FilterInvert, 22 | FilterTotal 23 | } FilterOptions; 24 | 25 | @interface iphone_filtersViewController : UIViewController { 26 | UIImageView *imageView; 27 | UIButton *buttonAdjustable; 28 | UIButton *buttonPackaged; 29 | UISlider *slider; 30 | UIActionSheet *actionSheetAdjustable; 31 | UIActionSheet *actionSheetPackaged; 32 | FilterOptions activeFilter; 33 | 34 | } 35 | 36 | @property (nonatomic, retain) IBOutlet UIImageView *imageView; 37 | @property (nonatomic, retain) IBOutlet UIButton *buttonAdjustable; 38 | @property (nonatomic, retain) IBOutlet UIButton *buttonPackaged; 39 | @property (nonatomic, retain) IBOutlet UISlider *slider; 40 | @property (nonatomic, retain) UIActionSheet *actionSheetAdjustable; 41 | @property (nonatomic, retain) UIActionSheet *actionSheetPackaged; 42 | 43 | @end 44 | 45 | -------------------------------------------------------------------------------- /Classes/iphone_filtersViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // iphone_filtersViewController.m 3 | // iphone-filters 4 | // 5 | // Created by Eric Silverberg on 6/16/11. 6 | // Copyright 2011 Perry Street Software, Inc. 7 | // 8 | // Licensed under the MIT License. 9 | // 10 | 11 | #import "iphone_filtersViewController.h" 12 | #import "ImageFilter.h" 13 | 14 | @implementation iphone_filtersViewController 15 | 16 | @synthesize buttonAdjustable; 17 | @synthesize buttonPackaged; 18 | @synthesize imageView; 19 | @synthesize slider; 20 | @synthesize actionSheetAdjustable; 21 | @synthesize actionSheetPackaged; 22 | 23 | - (void) dealloc 24 | { 25 | [buttonAdjustable release]; 26 | [buttonPackaged release]; 27 | [imageView release]; 28 | [slider release]; 29 | [actionSheetAdjustable release]; 30 | [actionSheetPackaged release]; 31 | [super dealloc]; 32 | } 33 | 34 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | [self.buttonAdjustable addTarget:self action:@selector(buttonAdjustableClicked:) forControlEvents:UIControlEventTouchUpInside]; 38 | [self.buttonPackaged addTarget:self action:@selector(buttonPackagedClicked:) forControlEvents:UIControlEventTouchUpInside]; 39 | [self.slider addTarget:self action:@selector(sliderMoved:) forControlEvents:UIControlEventTouchUpInside]; 40 | [self.imageView setImage:[UIImage imageNamed:@"landscape.jpg"]]; 41 | } 42 | 43 | - (IBAction) buttonAdjustableClicked:(id)sender 44 | { 45 | // open a dialog with two custom buttons 46 | self.actionSheetAdjustable = [[[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Set Filter",@"") 47 | delegate:self 48 | cancelButtonTitle:NSLocalizedString(@"Cancel",@"") 49 | destructiveButtonTitle:nil 50 | otherButtonTitles: 51 | NSLocalizedString(@"Posterize",@""), 52 | NSLocalizedString(@"Saturate",@""), 53 | NSLocalizedString(@"Brightness",@""), 54 | NSLocalizedString(@"Contrast",@""), 55 | NSLocalizedString(@"Gamma",@""), 56 | NSLocalizedString(@"Noise",@""), 57 | nil] autorelease]; 58 | self.actionSheetAdjustable.actionSheetStyle = UIActionSheetStyleDefault; 59 | [self.actionSheetAdjustable showInView:self.view]; // show from our table view (pops up in the middle of the table) 60 | } 61 | 62 | - (IBAction) buttonPackagedClicked:(id)sender 63 | { 64 | // open a dialog with two custom buttons 65 | self.actionSheetPackaged = 66 | [[[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Apply Filter",@"") 67 | delegate:self 68 | cancelButtonTitle:NSLocalizedString(@"Cancel",@"") 69 | destructiveButtonTitle:NSLocalizedString(@"Reset",@"") 70 | otherButtonTitles: 71 | NSLocalizedString(@"Sharpen",@""), 72 | NSLocalizedString(@"Sepia",@""), 73 | NSLocalizedString(@"Lomo",@""), 74 | NSLocalizedString(@"Vignette",@""), 75 | NSLocalizedString(@"Polaroidish",@""), 76 | NSLocalizedString(@"Invert",@""), 77 | nil] autorelease]; 78 | self.actionSheetPackaged.actionSheetStyle = UIActionSheetStyleDefault; 79 | [self.actionSheetPackaged showInView:self.view]; // show from our table view (pops up in the middle of the table) 80 | 81 | } 82 | 83 | - (IBAction) sliderMoved:(id)sender 84 | { 85 | 86 | UIImage *image = [UIImage imageNamed:@"landscape.jpg"]; 87 | 88 | double value = self.slider.value; 89 | switch (activeFilter) { 90 | case FilterPosterize: 91 | self.imageView.image = [image posterize:(int)(value*10)]; 92 | break; 93 | case FilterSaturate: 94 | self.imageView.image = [image saturate:(1+value-0.5)]; 95 | break; 96 | case FilterBrightness: 97 | self.imageView.image = [image brightness:(1+value-0.5)]; 98 | break; 99 | case FilterContrast: 100 | self.imageView.image = [image contrast:(1+value-0.5)]; 101 | break; 102 | case FilterGamma: 103 | self.imageView.image = [image gamma:(1+value-0.5)]; 104 | break; 105 | case FilterNoise: 106 | self.imageView.image = [image noise:value]; 107 | break; 108 | default: 109 | break; 110 | } 111 | } 112 | #pragma mark - 113 | #pragma mark Action Sheet 114 | 115 | typedef enum 116 | { 117 | ActionSheetPackagedOptionReset = 0, 118 | ActionSheetPackagedOptionSharpen, 119 | ActionSheetPackagedOptionSepia, 120 | ActionSheetPackagedOptionLomo, 121 | ActionSheetPackagedOptionVignette, 122 | ActionSheetPackagedOptionPolaroidish, 123 | ActionSheetPackagedOptionInvert, 124 | ActionSheetPackagedOptionTotal 125 | } ActionSheetPackagedOptions; 126 | 127 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 128 | { 129 | if (actionSheet == self.actionSheetAdjustable) { 130 | self.actionSheetAdjustable = nil; 131 | 132 | activeFilter = buttonIndex; 133 | self.slider.value = 0.5; 134 | } else if (actionSheet == self.actionSheetPackaged) { 135 | self.actionSheetPackaged = nil; 136 | UIImage *image = [UIImage imageNamed:@"landscape.jpg"]; 137 | 138 | switch (buttonIndex) { 139 | case ActionSheetPackagedOptionReset: 140 | self.imageView.image = image; 141 | break; 142 | case ActionSheetPackagedOptionSharpen: 143 | self.imageView.image = [image sharpen]; 144 | break; 145 | case ActionSheetPackagedOptionSepia: 146 | self.imageView.image = [image sepia]; 147 | break; 148 | case ActionSheetPackagedOptionLomo: 149 | self.imageView.image = [image lomo]; 150 | break; 151 | case ActionSheetPackagedOptionVignette: 152 | self.imageView.image = [image vignette]; 153 | break; 154 | case ActionSheetPackagedOptionPolaroidish: 155 | self.imageView.image = [image polaroidish]; 156 | break; 157 | case ActionSheetPackagedOptionInvert: 158 | self.imageView.image = [image invert]; 159 | break; 160 | default: 161 | break; 162 | } 163 | } 164 | } 165 | 166 | @end 167 | -------------------------------------------------------------------------------- /MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10D571 6 | 786 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 112 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | iphone_filtersViewController 45 | 46 | 47 | 1 48 | 49 | IBCocoaTouchFramework 50 | NO 51 | 52 | 53 | 54 | 292 55 | {320, 480} 56 | 57 | 1 58 | MSAxIDEAA 59 | 60 | NO 61 | NO 62 | 63 | IBCocoaTouchFramework 64 | YES 65 | 66 | 67 | 68 | 69 | YES 70 | 71 | 72 | delegate 73 | 74 | 75 | 76 | 4 77 | 78 | 79 | 80 | viewController 81 | 82 | 83 | 84 | 11 85 | 86 | 87 | 88 | window 89 | 90 | 91 | 92 | 14 93 | 94 | 95 | 96 | 97 | YES 98 | 99 | 0 100 | 101 | 102 | 103 | 104 | 105 | -1 106 | 107 | 108 | File's Owner 109 | 110 | 111 | 3 112 | 113 | 114 | iphone_filters App Delegate 115 | 116 | 117 | -2 118 | 119 | 120 | 121 | 122 | 10 123 | 124 | 125 | 126 | 127 | 12 128 | 129 | 130 | 131 | 132 | 133 | 134 | YES 135 | 136 | YES 137 | -1.CustomClassName 138 | -2.CustomClassName 139 | 10.CustomClassName 140 | 10.IBEditorWindowLastContentRect 141 | 10.IBPluginDependency 142 | 12.IBEditorWindowLastContentRect 143 | 12.IBPluginDependency 144 | 3.CustomClassName 145 | 3.IBPluginDependency 146 | 147 | 148 | YES 149 | UIApplication 150 | UIResponder 151 | iphone_filtersViewController 152 | {{234, 376}, {320, 480}} 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | {{525, 346}, {320, 480}} 155 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 156 | iphone_filtersAppDelegate 157 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 158 | 159 | 160 | 161 | YES 162 | 163 | 164 | YES 165 | 166 | 167 | 168 | 169 | YES 170 | 171 | 172 | YES 173 | 174 | 175 | 176 | 15 177 | 178 | 179 | 180 | YES 181 | 182 | UIWindow 183 | UIView 184 | 185 | IBUserSource 186 | 187 | 188 | 189 | 190 | iphone_filtersAppDelegate 191 | NSObject 192 | 193 | YES 194 | 195 | YES 196 | viewController 197 | window 198 | 199 | 200 | YES 201 | iphone_filtersViewController 202 | UIWindow 203 | 204 | 205 | 206 | YES 207 | 208 | YES 209 | viewController 210 | window 211 | 212 | 213 | YES 214 | 215 | viewController 216 | iphone_filtersViewController 217 | 218 | 219 | window 220 | UIWindow 221 | 222 | 223 | 224 | 225 | IBProjectSource 226 | Classes/iphone_filtersAppDelegate.h 227 | 228 | 229 | 230 | iphone_filtersAppDelegate 231 | NSObject 232 | 233 | IBUserSource 234 | 235 | 236 | 237 | 238 | iphone_filtersViewController 239 | UIViewController 240 | 241 | IBProjectSource 242 | Classes/iphone_filtersViewController.h 243 | 244 | 245 | 246 | 247 | YES 248 | 249 | NSObject 250 | 251 | IBFrameworkSource 252 | Foundation.framework/Headers/NSError.h 253 | 254 | 255 | 256 | NSObject 257 | 258 | IBFrameworkSource 259 | Foundation.framework/Headers/NSFileManager.h 260 | 261 | 262 | 263 | NSObject 264 | 265 | IBFrameworkSource 266 | Foundation.framework/Headers/NSKeyValueCoding.h 267 | 268 | 269 | 270 | NSObject 271 | 272 | IBFrameworkSource 273 | Foundation.framework/Headers/NSKeyValueObserving.h 274 | 275 | 276 | 277 | NSObject 278 | 279 | IBFrameworkSource 280 | Foundation.framework/Headers/NSKeyedArchiver.h 281 | 282 | 283 | 284 | NSObject 285 | 286 | IBFrameworkSource 287 | Foundation.framework/Headers/NSObject.h 288 | 289 | 290 | 291 | NSObject 292 | 293 | IBFrameworkSource 294 | Foundation.framework/Headers/NSRunLoop.h 295 | 296 | 297 | 298 | NSObject 299 | 300 | IBFrameworkSource 301 | Foundation.framework/Headers/NSThread.h 302 | 303 | 304 | 305 | NSObject 306 | 307 | IBFrameworkSource 308 | Foundation.framework/Headers/NSURL.h 309 | 310 | 311 | 312 | NSObject 313 | 314 | IBFrameworkSource 315 | Foundation.framework/Headers/NSURLConnection.h 316 | 317 | 318 | 319 | NSObject 320 | 321 | IBFrameworkSource 322 | UIKit.framework/Headers/UIAccessibility.h 323 | 324 | 325 | 326 | NSObject 327 | 328 | IBFrameworkSource 329 | UIKit.framework/Headers/UINibLoading.h 330 | 331 | 332 | 333 | NSObject 334 | 335 | IBFrameworkSource 336 | UIKit.framework/Headers/UIResponder.h 337 | 338 | 339 | 340 | UIApplication 341 | UIResponder 342 | 343 | IBFrameworkSource 344 | UIKit.framework/Headers/UIApplication.h 345 | 346 | 347 | 348 | UIResponder 349 | NSObject 350 | 351 | 352 | 353 | UISearchBar 354 | UIView 355 | 356 | IBFrameworkSource 357 | UIKit.framework/Headers/UISearchBar.h 358 | 359 | 360 | 361 | UISearchDisplayController 362 | NSObject 363 | 364 | IBFrameworkSource 365 | UIKit.framework/Headers/UISearchDisplayController.h 366 | 367 | 368 | 369 | UIView 370 | 371 | IBFrameworkSource 372 | UIKit.framework/Headers/UITextField.h 373 | 374 | 375 | 376 | UIView 377 | UIResponder 378 | 379 | IBFrameworkSource 380 | UIKit.framework/Headers/UIView.h 381 | 382 | 383 | 384 | UIViewController 385 | 386 | IBFrameworkSource 387 | UIKit.framework/Headers/UINavigationController.h 388 | 389 | 390 | 391 | UIViewController 392 | 393 | IBFrameworkSource 394 | UIKit.framework/Headers/UIPopoverController.h 395 | 396 | 397 | 398 | UIViewController 399 | 400 | IBFrameworkSource 401 | UIKit.framework/Headers/UISplitViewController.h 402 | 403 | 404 | 405 | UIViewController 406 | 407 | IBFrameworkSource 408 | UIKit.framework/Headers/UITabBarController.h 409 | 410 | 411 | 412 | UIViewController 413 | UIResponder 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UIViewController.h 417 | 418 | 419 | 420 | UIWindow 421 | UIView 422 | 423 | IBFrameworkSource 424 | UIKit.framework/Headers/UIWindow.h 425 | 426 | 427 | 428 | 429 | 0 430 | IBCocoaTouchFramework 431 | 432 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 433 | 434 | 435 | 436 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 437 | 438 | 439 | YES 440 | iphone-filters.xcodeproj 441 | 3 442 | 112 443 | 444 | 445 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ios-image-filters 2 | ====================== 3 | 4 | These days everyone seems to want instagram-style filters for images on iPhone. The way to do this (I think) is to examine how people have implemented equivalent filters in Photoshop and code them in objective c. Unfortunately, the imaging libraries are all geared for gaming. For non-game developers who just want simple image processing, this is overkill. 5 | 6 | It's like photoshop for the UIImage class! 7 | ====================== 8 | I've worked hard to mimic the photoshop color adjustment menus. Turns out these are clutch in pretty much all the best image filters you can name right now (lomo, polaroid). For example, if you want to manipulate levels, here's your method, built straight onto the UIImage class: 9 | 10 | - (UIImage*) levels:(NSInteger)black mid:(NSInteger)mid white:(NSInteger)white 11 | 12 | An API just like that cool menu in Photoshop! 13 | 14 | Want to do a curves adjustment to mimic a filter you saw on a blog? Just do this: 15 | 16 | NSArray *redPoints = [NSArray arrayWithObjects: 17 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 18 | [NSValue valueWithCGPoint:CGPointMake(93, 76)], 19 | [NSValue valueWithCGPoint:CGPointMake(232, 226)], 20 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 21 | nil]; 22 | NSArray *bluePoints = [NSArray arrayWithObjects: 23 | [NSValue valueWithCGPoint:CGPointMake(0, 0)], 24 | [NSValue valueWithCGPoint:CGPointMake(57, 59)], 25 | [NSValue valueWithCGPoint:CGPointMake(220, 202)], 26 | [NSValue valueWithCGPoint:CGPointMake(255, 255)], 27 | nil]; 28 | UIImage *image = [[[UIImage imageNamed:@"landscape.jpg" applyCurve:redPoints toChannel:CurveChannelRed] 29 | applyCurve:bluePoints toChannel:CurveChannelBlue]; 30 | 31 | The problem with my curves implementation is that I didn't use the same kind of curve algorithm as Photoshop uses. Mainly, because I don't know how, and other than the name of the curve (bicubic) all the posts and documentation I simply don't understand or cannot figure out how to port to iOS. But, the curves I use (catmull-rom) seem close enough. 32 | 33 | How to integrate 34 | ====================== 35 | Copy and paste the ImageFilter.* and Curves/* classes into your project. It's implemented a Category on UIImage. 36 | 37 | How to use 38 | ====================== 39 | #import "ImageFilter.h" 40 | UIImage *image = [UIImage imageNamed:@"landscape.jpg"]; 41 | self.imageView.image = [image sharpen]; 42 | // Or 43 | self.imageView.image = [image saturate:1.5]; 44 | // Or 45 | self.imageView.image = [image lomo]; 46 | 47 | What it looks like 48 | ====================== 49 | ![Screen shot 1](/esilverberg/ios-image-filters/raw/master/docs/ss1.png) 50 | ![Screen shot 2](/esilverberg/ios-image-filters/raw/master/docs/ss2.png) 51 | 52 | 53 | What is still broken 54 | ====================== 55 | 56 | - Gaussian blur is slow! 57 | - More blend modes for layers 58 | - Curves are catmull rom, not bicubic 59 | - So much else... 60 | 61 | Other options 62 | ============= 63 | I tried, but mostly failed, to understand these libraries. Simple Image Processing is too simple, and uses a CPP class to accomplish its effects, as does CImg. I find the CPP syntax ghoulish, to say the least. I stared at the GLImageProcessing code for hours, and still don't understand what's going on. Guess I should have taken CS244a... 64 | 65 | UPDATE: Core image filters in iOS5 are probably what you want to use going forward, though they are not backwards-compatible with iOS4 or earlier. 66 | 67 | - Core Image Filters: http://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html 68 | - Simple Image Processing: http://code.google.com/p/simple-iphone-image-processing/ 69 | - GLImageProcessing: http://developer.apple.com/library/ios/#samplecode/GLImageProcessing/Introduction/Intro.html 70 | - CImg: http://cimg.sourceforge.net/reference/group__cimg__tutorial.html 71 | 72 | License 73 | ======= 74 | MIT License, where applicable. I borrowed code from this project: http://sourceforge.net/projects/curve/files/ , which also indicates it is MIT-licensed. 75 | http://en.wikipedia.org/wiki/MIT_License 76 | 77 | There is also now code adapted from ImageMagick, whose license may be found at: http://www.imagemagick.org/script/license.php -------------------------------------------------------------------------------- /docs/ss1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esilverberg/ios-image-filters/7741be1db2345ddbe0f7380df16bb15cb29870ee/docs/ss1.png -------------------------------------------------------------------------------- /docs/ss2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esilverberg/ios-image-filters/7741be1db2345ddbe0f7380df16bb15cb29870ee/docs/ss2.png -------------------------------------------------------------------------------- /green.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esilverberg/ios-image-filters/7741be1db2345ddbe0f7380df16bb15cb29870ee/green.jpg -------------------------------------------------------------------------------- /iphone-filters.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 07878D2813AB008500E41BDD /* ImageFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 07878D2713AB008500E41BDD /* ImageFilter.m */; }; 11 | 078791E013ABE0A600E41BDD /* BezierCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 078791D213ABE0A600E41BDD /* BezierCurve.m */; }; 12 | 078791E113ABE0A600E41BDD /* CatmullRomSpline.m in Sources */ = {isa = PBXBuildFile; fileRef = 078791D413ABE0A600E41BDD /* CatmullRomSpline.m */; }; 13 | 078791E213ABE0A600E41BDD /* CubicBezierCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 078791D713ABE0A600E41BDD /* CubicBezierCurve.m */; }; 14 | 078791E313ABE0A600E41BDD /* LinearBezierCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 078791D913ABE0A600E41BDD /* LinearBezierCurve.m */; }; 15 | 078791E413ABE0A600E41BDD /* NSArray_PointArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 078791DB13ABE0A600E41BDD /* NSArray_PointArray.m */; }; 16 | 078791E513ABE0A600E41BDD /* QuadraticBezierCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 078791DD13ABE0A600E41BDD /* QuadraticBezierCurve.m */; }; 17 | 078791E613ABE0A600E41BDD /* Spline.m in Sources */ = {isa = PBXBuildFile; fileRef = 078791DF13ABE0A600E41BDD /* Spline.m */; }; 18 | 078792A913ABF0B900E41BDD /* green.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 078792A813ABF0B900E41BDD /* green.jpg */; }; 19 | 07DF2BDC13ADAD6D00647836 /* landscape.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 07DF2BDB13ADAD6D00647836 /* landscape.jpg */; }; 20 | 1D3623260D0F684500981E51 /* iphone_filtersAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* iphone_filtersAppDelegate.m */; }; 21 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 22 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 23 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 24 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 25 | 2899E5220DE3E06400AC0155 /* iphone_filtersViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* iphone_filtersViewController.xib */; }; 26 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 27 | 28D7ACF80DDB3853001CB0EB /* iphone_filtersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* iphone_filtersViewController.m */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 07878D2613AB008500E41BDD /* ImageFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFilter.h; sourceTree = ""; }; 32 | 07878D2713AB008500E41BDD /* ImageFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageFilter.m; sourceTree = ""; }; 33 | 078791D113ABE0A600E41BDD /* BezierCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BezierCurve.h; sourceTree = ""; }; 34 | 078791D213ABE0A600E41BDD /* BezierCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BezierCurve.m; sourceTree = ""; }; 35 | 078791D313ABE0A600E41BDD /* CatmullRomSpline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatmullRomSpline.h; sourceTree = ""; }; 36 | 078791D413ABE0A600E41BDD /* CatmullRomSpline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CatmullRomSpline.m; sourceTree = ""; }; 37 | 078791D513ABE0A600E41BDD /* CGPointArithmetic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGPointArithmetic.h; sourceTree = ""; }; 38 | 078791D613ABE0A600E41BDD /* CubicBezierCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CubicBezierCurve.h; sourceTree = ""; }; 39 | 078791D713ABE0A600E41BDD /* CubicBezierCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CubicBezierCurve.m; sourceTree = ""; }; 40 | 078791D813ABE0A600E41BDD /* LinearBezierCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinearBezierCurve.h; sourceTree = ""; }; 41 | 078791D913ABE0A600E41BDD /* LinearBezierCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LinearBezierCurve.m; sourceTree = ""; }; 42 | 078791DA13ABE0A600E41BDD /* NSArray_PointArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSArray_PointArray.h; sourceTree = ""; }; 43 | 078791DB13ABE0A600E41BDD /* NSArray_PointArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSArray_PointArray.m; sourceTree = ""; }; 44 | 078791DC13ABE0A600E41BDD /* QuadraticBezierCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuadraticBezierCurve.h; sourceTree = ""; }; 45 | 078791DD13ABE0A600E41BDD /* QuadraticBezierCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuadraticBezierCurve.m; sourceTree = ""; }; 46 | 078791DE13ABE0A600E41BDD /* Spline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Spline.h; sourceTree = ""; }; 47 | 078791DF13ABE0A600E41BDD /* Spline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Spline.m; sourceTree = ""; }; 48 | 078792A813ABF0B900E41BDD /* green.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = green.jpg; sourceTree = ""; }; 49 | 07DF2BDB13ADAD6D00647836 /* landscape.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = landscape.jpg; sourceTree = ""; }; 50 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 51 | 1D3623240D0F684500981E51 /* iphone_filtersAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iphone_filtersAppDelegate.h; sourceTree = ""; }; 52 | 1D3623250D0F684500981E51 /* iphone_filtersAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iphone_filtersAppDelegate.m; sourceTree = ""; }; 53 | 1D6058910D05DD3D006BFB54 /* iphone-filters.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iphone-filters.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 55 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 56 | 2899E5210DE3E06400AC0155 /* iphone_filtersViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = iphone_filtersViewController.xib; sourceTree = ""; }; 57 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 58 | 28D7ACF60DDB3853001CB0EB /* iphone_filtersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iphone_filtersViewController.h; sourceTree = ""; }; 59 | 28D7ACF70DDB3853001CB0EB /* iphone_filtersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iphone_filtersViewController.m; sourceTree = ""; }; 60 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 61 | 32CA4F630368D1EE00C91783 /* iphone_filters_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iphone_filters_Prefix.pch; sourceTree = ""; }; 62 | 8D1107310486CEB800E47090 /* iphone_filters-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iphone_filters-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 71 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 72 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | 078791D013ABE0A600E41BDD /* Curve */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 078791D113ABE0A600E41BDD /* BezierCurve.h */, 83 | 078791D213ABE0A600E41BDD /* BezierCurve.m */, 84 | 078791D313ABE0A600E41BDD /* CatmullRomSpline.h */, 85 | 078791D413ABE0A600E41BDD /* CatmullRomSpline.m */, 86 | 078791D513ABE0A600E41BDD /* CGPointArithmetic.h */, 87 | 078791D613ABE0A600E41BDD /* CubicBezierCurve.h */, 88 | 078791D713ABE0A600E41BDD /* CubicBezierCurve.m */, 89 | 078791D813ABE0A600E41BDD /* LinearBezierCurve.h */, 90 | 078791D913ABE0A600E41BDD /* LinearBezierCurve.m */, 91 | 078791DA13ABE0A600E41BDD /* NSArray_PointArray.h */, 92 | 078791DB13ABE0A600E41BDD /* NSArray_PointArray.m */, 93 | 078791DC13ABE0A600E41BDD /* QuadraticBezierCurve.h */, 94 | 078791DD13ABE0A600E41BDD /* QuadraticBezierCurve.m */, 95 | 078791DE13ABE0A600E41BDD /* Spline.h */, 96 | 078791DF13ABE0A600E41BDD /* Spline.m */, 97 | ); 98 | path = Curve; 99 | sourceTree = ""; 100 | }; 101 | 080E96DDFE201D6D7F000001 /* Classes */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 078791D013ABE0A600E41BDD /* Curve */, 105 | 1D3623240D0F684500981E51 /* iphone_filtersAppDelegate.h */, 106 | 1D3623250D0F684500981E51 /* iphone_filtersAppDelegate.m */, 107 | 28D7ACF60DDB3853001CB0EB /* iphone_filtersViewController.h */, 108 | 28D7ACF70DDB3853001CB0EB /* iphone_filtersViewController.m */, 109 | 07878D2613AB008500E41BDD /* ImageFilter.h */, 110 | 07878D2713AB008500E41BDD /* ImageFilter.m */, 111 | ); 112 | path = Classes; 113 | sourceTree = ""; 114 | }; 115 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 1D6058910D05DD3D006BFB54 /* iphone-filters.app */, 119 | ); 120 | name = Products; 121 | sourceTree = ""; 122 | }; 123 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 080E96DDFE201D6D7F000001 /* Classes */, 127 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 128 | 29B97317FDCFA39411CA2CEA /* Resources */, 129 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 130 | 19C28FACFE9D520D11CA2CBB /* Products */, 131 | ); 132 | name = CustomTemplate; 133 | sourceTree = ""; 134 | }; 135 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 32CA4F630368D1EE00C91783 /* iphone_filters_Prefix.pch */, 139 | 29B97316FDCFA39411CA2CEA /* main.m */, 140 | ); 141 | name = "Other Sources"; 142 | sourceTree = ""; 143 | }; 144 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 07DF2BDB13ADAD6D00647836 /* landscape.jpg */, 148 | 078792A813ABF0B900E41BDD /* green.jpg */, 149 | 2899E5210DE3E06400AC0155 /* iphone_filtersViewController.xib */, 150 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 151 | 8D1107310486CEB800E47090 /* iphone_filters-Info.plist */, 152 | ); 153 | name = Resources; 154 | sourceTree = ""; 155 | }; 156 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 160 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 161 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 162 | ); 163 | name = Frameworks; 164 | sourceTree = ""; 165 | }; 166 | /* End PBXGroup section */ 167 | 168 | /* Begin PBXNativeTarget section */ 169 | 1D6058900D05DD3D006BFB54 /* iphone-filters */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iphone-filters" */; 172 | buildPhases = ( 173 | 1D60588D0D05DD3D006BFB54 /* Resources */, 174 | 1D60588E0D05DD3D006BFB54 /* Sources */, 175 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | ); 181 | name = "iphone-filters"; 182 | productName = "iphone-filters"; 183 | productReference = 1D6058910D05DD3D006BFB54 /* iphone-filters.app */; 184 | productType = "com.apple.product-type.application"; 185 | }; 186 | /* End PBXNativeTarget section */ 187 | 188 | /* Begin PBXProject section */ 189 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 190 | isa = PBXProject; 191 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iphone-filters" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 1; 195 | knownRegions = ( 196 | English, 197 | Japanese, 198 | French, 199 | German, 200 | ); 201 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | 1D6058900D05DD3D006BFB54 /* iphone-filters */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXResourcesBuildPhase section */ 211 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 216 | 2899E5220DE3E06400AC0155 /* iphone_filtersViewController.xib in Resources */, 217 | 078792A913ABF0B900E41BDD /* green.jpg in Resources */, 218 | 07DF2BDC13ADAD6D00647836 /* landscape.jpg in Resources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXResourcesBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 230 | 1D3623260D0F684500981E51 /* iphone_filtersAppDelegate.m in Sources */, 231 | 28D7ACF80DDB3853001CB0EB /* iphone_filtersViewController.m in Sources */, 232 | 07878D2813AB008500E41BDD /* ImageFilter.m in Sources */, 233 | 078791E013ABE0A600E41BDD /* BezierCurve.m in Sources */, 234 | 078791E113ABE0A600E41BDD /* CatmullRomSpline.m in Sources */, 235 | 078791E213ABE0A600E41BDD /* CubicBezierCurve.m in Sources */, 236 | 078791E313ABE0A600E41BDD /* LinearBezierCurve.m in Sources */, 237 | 078791E413ABE0A600E41BDD /* NSArray_PointArray.m in Sources */, 238 | 078791E513ABE0A600E41BDD /* QuadraticBezierCurve.m in Sources */, 239 | 078791E613ABE0A600E41BDD /* Spline.m in Sources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXSourcesBuildPhase section */ 244 | 245 | /* Begin XCBuildConfiguration section */ 246 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | ALWAYS_SEARCH_USER_PATHS = NO; 250 | COPY_PHASE_STRIP = NO; 251 | GCC_DYNAMIC_NO_PIC = NO; 252 | GCC_OPTIMIZATION_LEVEL = 0; 253 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 254 | GCC_PREFIX_HEADER = iphone_filters_Prefix.pch; 255 | INFOPLIST_FILE = "iphone_filters-Info.plist"; 256 | PRODUCT_NAME = "iphone-filters"; 257 | }; 258 | name = Debug; 259 | }; 260 | 1D6058950D05DD3E006BFB54 /* Release */ = { 261 | isa = XCBuildConfiguration; 262 | buildSettings = { 263 | ALWAYS_SEARCH_USER_PATHS = NO; 264 | COPY_PHASE_STRIP = YES; 265 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 266 | GCC_PREFIX_HEADER = iphone_filters_Prefix.pch; 267 | INFOPLIST_FILE = "iphone_filters-Info.plist"; 268 | PRODUCT_NAME = "iphone-filters"; 269 | VALIDATE_PRODUCT = YES; 270 | }; 271 | name = Release; 272 | }; 273 | C01FCF4F08A954540054247B /* Debug */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 277 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 278 | GCC_C_LANGUAGE_STANDARD = c99; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 280 | GCC_WARN_UNUSED_VARIABLE = YES; 281 | PREBINDING = NO; 282 | SDKROOT = iphoneos; 283 | }; 284 | name = Debug; 285 | }; 286 | C01FCF5008A954540054247B /* Release */ = { 287 | isa = XCBuildConfiguration; 288 | buildSettings = { 289 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 290 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 291 | GCC_C_LANGUAGE_STANDARD = c99; 292 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 293 | GCC_WARN_UNUSED_VARIABLE = YES; 294 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 295 | PREBINDING = NO; 296 | SDKROOT = iphoneos; 297 | }; 298 | name = Release; 299 | }; 300 | /* End XCBuildConfiguration section */ 301 | 302 | /* Begin XCConfigurationList section */ 303 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iphone-filters" */ = { 304 | isa = XCConfigurationList; 305 | buildConfigurations = ( 306 | 1D6058940D05DD3E006BFB54 /* Debug */, 307 | 1D6058950D05DD3E006BFB54 /* Release */, 308 | ); 309 | defaultConfigurationIsVisible = 0; 310 | defaultConfigurationName = Release; 311 | }; 312 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iphone-filters" */ = { 313 | isa = XCConfigurationList; 314 | buildConfigurations = ( 315 | C01FCF4F08A954540054247B /* Debug */, 316 | C01FCF5008A954540054247B /* Release */, 317 | ); 318 | defaultConfigurationIsVisible = 0; 319 | defaultConfigurationName = Release; 320 | }; 321 | /* End XCConfigurationList section */ 322 | }; 323 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 324 | } 325 | -------------------------------------------------------------------------------- /iphone-filters.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iphone-filters.xcodeproj/project.xcworkspace/xcuserdata/kiichi.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $archiver 6 | NSKeyedArchiver 7 | $objects 8 | 9 | $null 10 | 11 | $class 12 | 13 | CF$UID 14 | 134 15 | 16 | NS.keys 17 | 18 | 19 | CF$UID 20 | 2 21 | 22 | 23 | CF$UID 24 | 3 25 | 26 | 27 | NS.objects 28 | 29 | 30 | CF$UID 31 | 4 32 | 33 | 34 | CF$UID 35 | 103 36 | 37 | 38 | 39 | IDEWorkspaceDocument 40 | 78703D37-55A2-49AB-929A-8800C2DE6F12 41 | 42 | $class 43 | 44 | CF$UID 45 | 37 46 | 47 | NS.keys 48 | 49 | 50 | CF$UID 51 | 5 52 | 53 | 54 | CF$UID 55 | 6 56 | 57 | 58 | CF$UID 59 | 7 60 | 61 | 62 | CF$UID 63 | 8 64 | 65 | 66 | CF$UID 67 | 9 68 | 69 | 70 | CF$UID 71 | 10 72 | 73 | 74 | CF$UID 75 | 11 76 | 77 | 78 | CF$UID 79 | 12 80 | 81 | 82 | CF$UID 83 | 13 84 | 85 | 86 | CF$UID 87 | 14 88 | 89 | 90 | NS.objects 91 | 92 | 93 | CF$UID 94 | 15 95 | 96 | 97 | CF$UID 98 | 16 99 | 100 | 101 | CF$UID 102 | 50 103 | 104 | 105 | CF$UID 106 | 51 107 | 108 | 109 | CF$UID 110 | 56 111 | 112 | 113 | CF$UID 114 | 59 115 | 116 | 117 | CF$UID 118 | 93 119 | 120 | 121 | CF$UID 122 | 94 123 | 124 | 125 | CF$UID 126 | 15 127 | 128 | 129 | CF$UID 130 | 15 131 | 132 | 133 | 134 | BreakpointsActivated 135 | DefaultEditorStatesForURLs 136 | DebuggingWindowBehavior 137 | ActiveRunDestination 138 | ActiveScheme 139 | LastCompletedPersistentSchemeBasedActivityReport 140 | DocumentWindows 141 | RecentEditorDocumentURLs 142 | AppFocusInMiniDebugging 143 | MiniDebuggingConsole 144 | 145 | 146 | $class 147 | 148 | CF$UID 149 | 37 150 | 151 | NS.keys 152 | 153 | 154 | CF$UID 155 | 17 156 | 157 | 158 | NS.objects 159 | 160 | 161 | CF$UID 162 | 18 163 | 164 | 165 | 166 | Xcode.IDEKit.EditorDocument.SourceCode 167 | 168 | $class 169 | 170 | CF$UID 171 | 37 172 | 173 | NS.keys 174 | 175 | 176 | CF$UID 177 | 19 178 | 179 | 180 | CF$UID 181 | 23 182 | 183 | 184 | CF$UID 185 | 25 186 | 187 | 188 | CF$UID 189 | 27 190 | 191 | 192 | NS.objects 193 | 194 | 195 | CF$UID 196 | 29 197 | 198 | 199 | CF$UID 200 | 38 201 | 202 | 203 | CF$UID 204 | 42 205 | 206 | 207 | CF$UID 208 | 46 209 | 210 | 211 | 212 | 213 | $class 214 | 215 | CF$UID 216 | 22 217 | 218 | NS.base 219 | 220 | CF$UID 221 | 0 222 | 223 | NS.relative 224 | 225 | CF$UID 226 | 20 227 | 228 | 229 | 230 | $class 231 | 232 | CF$UID 233 | 21 234 | 235 | NS.string 236 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/ImageFilter.m 237 | 238 | 239 | $classes 240 | 241 | NSMutableString 242 | NSString 243 | NSObject 244 | 245 | $classname 246 | NSMutableString 247 | 248 | 249 | $classes 250 | 251 | NSURL 252 | NSObject 253 | 254 | $classname 255 | NSURL 256 | 257 | 258 | $class 259 | 260 | CF$UID 261 | 22 262 | 263 | NS.base 264 | 265 | CF$UID 266 | 0 267 | 268 | NS.relative 269 | 270 | CF$UID 271 | 24 272 | 273 | 274 | 275 | $class 276 | 277 | CF$UID 278 | 21 279 | 280 | NS.string 281 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/iphone_filtersViewController.m 282 | 283 | 284 | $class 285 | 286 | CF$UID 287 | 22 288 | 289 | NS.base 290 | 291 | CF$UID 292 | 0 293 | 294 | NS.relative 295 | 296 | CF$UID 297 | 26 298 | 299 | 300 | 301 | $class 302 | 303 | CF$UID 304 | 21 305 | 306 | NS.string 307 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/ImageFilter.h 308 | 309 | 310 | $class 311 | 312 | CF$UID 313 | 22 314 | 315 | NS.base 316 | 317 | CF$UID 318 | 0 319 | 320 | NS.relative 321 | 322 | CF$UID 323 | 28 324 | 325 | 326 | 327 | $class 328 | 329 | CF$UID 330 | 21 331 | 332 | NS.string 333 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/iphone_filtersViewController.h 334 | 335 | 336 | $class 337 | 338 | CF$UID 339 | 37 340 | 341 | NS.keys 342 | 343 | 344 | CF$UID 345 | 30 346 | 347 | 348 | CF$UID 349 | 31 350 | 351 | 352 | CF$UID 353 | 32 354 | 355 | 356 | CF$UID 357 | 33 358 | 359 | 360 | NS.objects 361 | 362 | 363 | CF$UID 364 | 34 365 | 366 | 367 | CF$UID 368 | 35 369 | 370 | 371 | CF$UID 372 | 15 373 | 374 | 375 | CF$UID 376 | 36 377 | 378 | 379 | 380 | PrimaryDocumentTimestamp 381 | PrimaryDocumentVisibleCharacterRange 382 | HideAllIssues 383 | PrimaryDocumentSelectedCharacterRange 384 | 340472168.83510298 385 | {14825, 1363} 386 | {6092, 0} 387 | 388 | $classes 389 | 390 | NSMutableDictionary 391 | NSDictionary 392 | NSObject 393 | 394 | $classname 395 | NSMutableDictionary 396 | 397 | 398 | $class 399 | 400 | CF$UID 401 | 37 402 | 403 | NS.keys 404 | 405 | 406 | CF$UID 407 | 30 408 | 409 | 410 | CF$UID 411 | 31 412 | 413 | 414 | CF$UID 415 | 32 416 | 417 | 418 | CF$UID 419 | 33 420 | 421 | 422 | NS.objects 423 | 424 | 425 | CF$UID 426 | 39 427 | 428 | 429 | CF$UID 430 | 40 431 | 432 | 433 | CF$UID 434 | 15 435 | 436 | 437 | CF$UID 438 | 41 439 | 440 | 441 | 442 | 340472562.272798 443 | {4107, 988} 444 | {4768, 0} 445 | 446 | $class 447 | 448 | CF$UID 449 | 37 450 | 451 | NS.keys 452 | 453 | 454 | CF$UID 455 | 30 456 | 457 | 458 | CF$UID 459 | 31 460 | 461 | 462 | CF$UID 463 | 32 464 | 465 | 466 | CF$UID 467 | 33 468 | 469 | 470 | NS.objects 471 | 472 | 473 | CF$UID 474 | 43 475 | 476 | 477 | CF$UID 478 | 44 479 | 480 | 481 | CF$UID 482 | 15 483 | 484 | 485 | CF$UID 486 | 45 487 | 488 | 489 | 490 | 340472457.20757198 491 | {367, 954} 492 | {775, 0} 493 | 494 | $class 495 | 496 | CF$UID 497 | 37 498 | 499 | NS.keys 500 | 501 | 502 | CF$UID 503 | 30 504 | 505 | 506 | CF$UID 507 | 31 508 | 509 | 510 | CF$UID 511 | 32 512 | 513 | 514 | CF$UID 515 | 33 516 | 517 | 518 | NS.objects 519 | 520 | 521 | CF$UID 522 | 47 523 | 524 | 525 | CF$UID 526 | 48 527 | 528 | 529 | CF$UID 530 | 15 531 | 532 | 533 | CF$UID 534 | 49 535 | 536 | 537 | 538 | 340472562.87194002 539 | {60, 999} 540 | {340, 0} 541 | 0 542 | 543 | $class 544 | 545 | CF$UID 546 | 37 547 | 548 | NS.keys 549 | 550 | 551 | CF$UID 552 | 52 553 | 554 | 555 | CF$UID 556 | 53 557 | 558 | 559 | NS.objects 560 | 561 | 562 | CF$UID 563 | 54 564 | 565 | 566 | CF$UID 567 | 55 568 | 569 | 570 | 571 | IDEDeviceLocation 572 | IDEDeviceArchitecture 573 | dvtdevice-iphonesimulator:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk-iPhone 574 | i386 575 | 576 | $class 577 | 578 | CF$UID 579 | 37 580 | 581 | NS.keys 582 | 583 | 584 | CF$UID 585 | 57 586 | 587 | 588 | NS.objects 589 | 590 | 591 | CF$UID 592 | 58 593 | 594 | 595 | 596 | IDENameString 597 | iphone-filters 598 | 599 | $class 600 | 601 | CF$UID 602 | 37 603 | 604 | NS.keys 605 | 606 | 607 | CF$UID 608 | 60 609 | 610 | 611 | CF$UID 612 | 61 613 | 614 | 615 | CF$UID 616 | 62 617 | 618 | 619 | NS.objects 620 | 621 | 622 | CF$UID 623 | 63 624 | 625 | 626 | CF$UID 627 | 91 628 | 629 | 630 | CF$UID 631 | 92 632 | 633 | 634 | 635 | IDEActivityReportCompletionSummaryStringSegments 636 | IDEActivityReportOptions 637 | IDEActivityReportTitle 638 | 639 | $class 640 | 641 | CF$UID 642 | 90 643 | 644 | NS.objects 645 | 646 | 647 | CF$UID 648 | 64 649 | 650 | 651 | CF$UID 652 | 71 653 | 654 | 655 | CF$UID 656 | 75 657 | 658 | 659 | CF$UID 660 | 80 661 | 662 | 663 | 664 | 665 | $class 666 | 667 | CF$UID 668 | 37 669 | 670 | NS.keys 671 | 672 | 673 | CF$UID 674 | 65 675 | 676 | 677 | CF$UID 678 | 66 679 | 680 | 681 | CF$UID 682 | 67 683 | 684 | 685 | NS.objects 686 | 687 | 688 | CF$UID 689 | 68 690 | 691 | 692 | CF$UID 693 | 69 694 | 695 | 696 | CF$UID 697 | 70 698 | 699 | 700 | 701 | IDEActivityReportStringSegmentPriority 702 | IDEActivityReportStringSegmentBackSeparator 703 | IDEActivityReportStringSegmentStringValue 704 | 2 705 | 706 | Build 707 | 708 | $class 709 | 710 | CF$UID 711 | 37 712 | 713 | NS.keys 714 | 715 | 716 | CF$UID 717 | 65 718 | 719 | 720 | CF$UID 721 | 66 722 | 723 | 724 | CF$UID 725 | 67 726 | 727 | 728 | NS.objects 729 | 730 | 731 | CF$UID 732 | 72 733 | 734 | 735 | CF$UID 736 | 73 737 | 738 | 739 | CF$UID 740 | 74 741 | 742 | 743 | 744 | 4 745 | : 746 | iphone-filters 747 | 748 | $class 749 | 750 | CF$UID 751 | 37 752 | 753 | NS.keys 754 | 755 | 756 | CF$UID 757 | 65 758 | 759 | 760 | CF$UID 761 | 66 762 | 763 | 764 | CF$UID 765 | 67 766 | 767 | 768 | NS.objects 769 | 770 | 771 | CF$UID 772 | 76 773 | 774 | 775 | CF$UID 776 | 77 777 | 778 | 779 | CF$UID 780 | 78 781 | 782 | 783 | 784 | 1 785 | 786 | 787 | $class 788 | 789 | CF$UID 790 | 79 791 | 792 | NS.data 793 | 794 | YnBsaXN0MDDUAQIDBAUGOzxYJHZlcnNpb25YJG9iamVjdHNZJGFy 795 | Y2hpdmVyVCR0b3ASAAGGoK0HCA8QGhscJCUrMTQ3VSRudWxs0wkK 796 | CwwNDlxOU0F0dHJpYnV0ZXNWJGNsYXNzWE5TU3RyaW5ngAOADIAC 797 | WVN1Y2NlZWRlZNMKERITFBdXTlMua2V5c1pOUy5vYmplY3RzgAui 798 | FRaABIAFohgZgAaACVZOU0ZvbnRXTlNDb2xvctQKHR4fICEiI1ZO 799 | U05hbWVWTlNTaXplWE5TZkZsYWdzgAiAByNAJgAAAAAAABENEF8Q 800 | EUx1Y2lkYUdyYW5kZS1Cb2xk0iYnKClaJGNsYXNzbmFtZVgkY2xh 801 | c3Nlc1ZOU0ZvbnSiKCpYTlNPYmplY3TTCiwtLi8wXE5TQ29sb3JT 802 | cGFjZVdOU1doaXRlgAoQA0IwANImJzIzV05TQ29sb3KiMirSJic1 803 | NlxOU0RpY3Rpb25hcnmiNSrSJic4OV8QEk5TQXR0cmlidXRlZFN0 804 | cmluZ6I6Kl8QEk5TQXR0cmlidXRlZFN0cmluZ18QD05TS2V5ZWRB 805 | cmNoaXZlctE9PlRyb290gAEACAARABoAIwAtADIANwBFAEsAUgBf 806 | AGYAbwBxAHMAdQB/AIYAjgCZAJsAngCgAKIApQCnAKkAsAC4AMEA 807 | yADPANgA2gDcAOUA6AD8AQEBDAEVARwBHwEoAS8BPAFEAUYBSAFL 808 | AVABWAFbAWABbQFwAXUBigGNAaIBtAG3AbwAAAAAAAACAQAAAAAA 809 | AAA/AAAAAAAAAAAAAAAAAAABvg== 810 | 811 | 812 | 813 | $classes 814 | 815 | NSMutableData 816 | NSData 817 | NSObject 818 | 819 | $classname 820 | NSMutableData 821 | 822 | 823 | $class 824 | 825 | CF$UID 826 | 37 827 | 828 | NS.keys 829 | 830 | 831 | CF$UID 832 | 65 833 | 834 | 835 | CF$UID 836 | 81 837 | 838 | 839 | CF$UID 840 | 82 841 | 842 | 843 | CF$UID 844 | 67 845 | 846 | 847 | CF$UID 848 | 83 849 | 850 | 851 | CF$UID 852 | 84 853 | 854 | 855 | NS.objects 856 | 857 | 858 | CF$UID 859 | 85 860 | 861 | 862 | CF$UID 863 | 86 864 | 865 | 866 | CF$UID 867 | 87 868 | 869 | 870 | CF$UID 871 | 89 872 | 873 | 874 | CF$UID 875 | 86 876 | 877 | 878 | CF$UID 879 | 86 880 | 881 | 882 | 883 | IDEActivityReportStringSegmentType 884 | IDEActivityReportStringSegmentDate 885 | IDEActivityReportStringSegmentDateStyle 886 | IDEActivityReportStringSegmentTimeStyle 887 | 3 888 | 1 889 | 890 | $class 891 | 892 | CF$UID 893 | 88 894 | 895 | NS.time 896 | 340472526.96691197 897 | 898 | 899 | $classes 900 | 901 | NSDate 902 | NSObject 903 | 904 | $classname 905 | NSDate 906 | 907 | Today at 11:42 AM 908 | 909 | $classes 910 | 911 | NSMutableArray 912 | NSArray 913 | NSObject 914 | 915 | $classname 916 | NSMutableArray 917 | 918 | 234 919 | iphone-filters 920 | 921 | $class 922 | 923 | CF$UID 924 | 90 925 | 926 | NS.objects 927 | 928 | 929 | CF$UID 930 | 3 931 | 932 | 933 | 934 | 935 | $class 936 | 937 | CF$UID 938 | 90 939 | 940 | NS.objects 941 | 942 | 943 | CF$UID 944 | 95 945 | 946 | 947 | CF$UID 948 | 97 949 | 950 | 951 | CF$UID 952 | 99 953 | 954 | 955 | CF$UID 956 | 101 957 | 958 | 959 | 960 | 961 | $class 962 | 963 | CF$UID 964 | 22 965 | 966 | NS.base 967 | 968 | CF$UID 969 | 0 970 | 971 | NS.relative 972 | 973 | CF$UID 974 | 96 975 | 976 | 977 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/iphone_filtersViewController.h 978 | 979 | $class 980 | 981 | CF$UID 982 | 22 983 | 984 | NS.base 985 | 986 | CF$UID 987 | 0 988 | 989 | NS.relative 990 | 991 | CF$UID 992 | 98 993 | 994 | 995 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/iphone_filtersViewController.m 996 | 997 | $class 998 | 999 | CF$UID 1000 | 22 1001 | 1002 | NS.base 1003 | 1004 | CF$UID 1005 | 0 1006 | 1007 | NS.relative 1008 | 1009 | CF$UID 1010 | 100 1011 | 1012 | 1013 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/ImageFilter.h 1014 | 1015 | $class 1016 | 1017 | CF$UID 1018 | 22 1019 | 1020 | NS.base 1021 | 1022 | CF$UID 1023 | 0 1024 | 1025 | NS.relative 1026 | 1027 | CF$UID 1028 | 102 1029 | 1030 | 1031 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/ImageFilter.m 1032 | 1033 | $class 1034 | 1035 | CF$UID 1036 | 37 1037 | 1038 | NS.keys 1039 | 1040 | 1041 | CF$UID 1042 | 104 1043 | 1044 | 1045 | CF$UID 1046 | 105 1047 | 1048 | 1049 | CF$UID 1050 | 106 1051 | 1052 | 1053 | CF$UID 1054 | 107 1055 | 1056 | 1057 | CF$UID 1058 | 108 1059 | 1060 | 1061 | CF$UID 1062 | 109 1063 | 1064 | 1065 | CF$UID 1066 | 110 1067 | 1068 | 1069 | CF$UID 1070 | 111 1071 | 1072 | 1073 | NS.objects 1074 | 1075 | 1076 | CF$UID 1077 | 112 1078 | 1079 | 1080 | CF$UID 1081 | 113 1082 | 1083 | 1084 | CF$UID 1085 | 15 1086 | 1087 | 1088 | CF$UID 1089 | 115 1090 | 1091 | 1092 | CF$UID 1093 | 3 1094 | 1095 | 1096 | CF$UID 1097 | 107 1098 | 1099 | 1100 | CF$UID 1101 | 124 1102 | 1103 | 1104 | CF$UID 1105 | 124 1106 | 1107 | 1108 | 1109 | IDEWindowFrame 1110 | IDEOrderedWorkspaceTabControllers 1111 | IDEWindowInFullscreenMode 1112 | IDEWorkspaceTabController_12656AB0-97ED-4803-A741-9E1F4BD00830 1113 | IDEWorkspaceWindowControllerUniqueIdentifier 1114 | IDEActiveWorkspaceTabController 1115 | IDEWindowToolbarIsVisible 1116 | IDEWindowTabBarIsVisible 1117 | {{4, 0}, {1362, 746}} 1118 | 1119 | $class 1120 | 1121 | CF$UID 1122 | 114 1123 | 1124 | NS.objects 1125 | 1126 | 1127 | CF$UID 1128 | 107 1129 | 1130 | 1131 | 1132 | 1133 | $classes 1134 | 1135 | NSArray 1136 | NSObject 1137 | 1138 | $classname 1139 | NSArray 1140 | 1141 | 1142 | $class 1143 | 1144 | CF$UID 1145 | 37 1146 | 1147 | NS.keys 1148 | 1149 | 1150 | CF$UID 1151 | 116 1152 | 1153 | 1154 | CF$UID 1155 | 117 1156 | 1157 | 1158 | CF$UID 1159 | 118 1160 | 1161 | 1162 | CF$UID 1163 | 119 1164 | 1165 | 1166 | CF$UID 1167 | 120 1168 | 1169 | 1170 | CF$UID 1171 | 121 1172 | 1173 | 1174 | CF$UID 1175 | 122 1176 | 1177 | 1178 | CF$UID 1179 | 123 1180 | 1181 | 1182 | NS.objects 1183 | 1184 | 1185 | CF$UID 1186 | 50 1187 | 1188 | 1189 | CF$UID 1190 | 124 1191 | 1192 | 1193 | CF$UID 1194 | 125 1195 | 1196 | 1197 | CF$UID 1198 | 126 1199 | 1200 | 1201 | CF$UID 1202 | 137 1203 | 1204 | 1205 | CF$UID 1206 | 173 1207 | 1208 | 1209 | CF$UID 1210 | 15 1211 | 1212 | 1213 | CF$UID 1214 | 182 1215 | 1216 | 1217 | 1218 | AssistantEditorsLayout 1219 | IDEShowNavigator 1220 | IDETabLabel 1221 | IDEWorkspaceTabControllerUtilityAreaSplitView 1222 | IDENavigatorArea 1223 | IDEWorkspaceTabControllerDesignAreaSplitView 1224 | IDEShowUtilities 1225 | IDEEditorArea 1226 | 1227 | iphone_filtersViewController.h 1228 | 1229 | $class 1230 | 1231 | CF$UID 1232 | 37 1233 | 1234 | NS.keys 1235 | 1236 | 1237 | CF$UID 1238 | 127 1239 | 1240 | 1241 | NS.objects 1242 | 1243 | 1244 | CF$UID 1245 | 128 1246 | 1247 | 1248 | 1249 | DVTSplitViewItems 1250 | 1251 | $class 1252 | 1253 | CF$UID 1254 | 90 1255 | 1256 | NS.objects 1257 | 1258 | 1259 | CF$UID 1260 | 129 1261 | 1262 | 1263 | CF$UID 1264 | 135 1265 | 1266 | 1267 | 1268 | 1269 | $class 1270 | 1271 | CF$UID 1272 | 134 1273 | 1274 | NS.keys 1275 | 1276 | 1277 | CF$UID 1278 | 130 1279 | 1280 | 1281 | CF$UID 1282 | 131 1283 | 1284 | 1285 | NS.objects 1286 | 1287 | 1288 | CF$UID 1289 | 132 1290 | 1291 | 1292 | CF$UID 1293 | 133 1294 | 1295 | 1296 | 1297 | DVTIdentifier 1298 | DVTViewMagnitude 1299 | 1300 | 424 1301 | 1302 | $classes 1303 | 1304 | NSDictionary 1305 | NSObject 1306 | 1307 | $classname 1308 | NSDictionary 1309 | 1310 | 1311 | $class 1312 | 1313 | CF$UID 1314 | 134 1315 | 1316 | NS.keys 1317 | 1318 | 1319 | CF$UID 1320 | 130 1321 | 1322 | 1323 | CF$UID 1324 | 131 1325 | 1326 | 1327 | NS.objects 1328 | 1329 | 1330 | CF$UID 1331 | 132 1332 | 1333 | 1334 | CF$UID 1335 | 136 1336 | 1337 | 1338 | 1339 | 224 1340 | 1341 | $class 1342 | 1343 | CF$UID 1344 | 37 1345 | 1346 | NS.keys 1347 | 1348 | 1349 | CF$UID 1350 | 138 1351 | 1352 | 1353 | CF$UID 1354 | 139 1355 | 1356 | 1357 | NS.objects 1358 | 1359 | 1360 | CF$UID 1361 | 139 1362 | 1363 | 1364 | CF$UID 1365 | 140 1366 | 1367 | 1368 | 1369 | SelectedNavigator 1370 | Xcode.IDEKit.Navigator.Structure 1371 | 1372 | $class 1373 | 1374 | CF$UID 1375 | 37 1376 | 1377 | NS.keys 1378 | 1379 | 1380 | CF$UID 1381 | 141 1382 | 1383 | 1384 | CF$UID 1385 | 142 1386 | 1387 | 1388 | CF$UID 1389 | 143 1390 | 1391 | 1392 | CF$UID 1393 | 144 1394 | 1395 | 1396 | CF$UID 1397 | 145 1398 | 1399 | 1400 | CF$UID 1401 | 146 1402 | 1403 | 1404 | CF$UID 1405 | 147 1406 | 1407 | 1408 | NS.objects 1409 | 1410 | 1411 | CF$UID 1412 | 148 1413 | 1414 | 1415 | CF$UID 1416 | 15 1417 | 1418 | 1419 | CF$UID 1420 | 149 1421 | 1422 | 1423 | CF$UID 1424 | 15 1425 | 1426 | 1427 | CF$UID 1428 | 15 1429 | 1430 | 1431 | CF$UID 1432 | 151 1433 | 1434 | 1435 | CF$UID 1436 | 162 1437 | 1438 | 1439 | 1440 | IDEVisibleRect 1441 | IDEUnsavedDocumentFilteringEnabled 1442 | IDENavigatorExpandedItemsBeforeFilteringSet 1443 | IDERecentDocumentFilteringEnabled 1444 | IDESCMStatusFilteringEnabled 1445 | IDESelectedObjects 1446 | IDEExpandedItemsSet 1447 | {{0, 0}, {259, 604}} 1448 | 1449 | $class 1450 | 1451 | CF$UID 1452 | 150 1453 | 1454 | NS.objects 1455 | 1456 | 1457 | 1458 | $classes 1459 | 1460 | NSSet 1461 | NSObject 1462 | 1463 | $classname 1464 | NSSet 1465 | 1466 | 1467 | $class 1468 | 1469 | CF$UID 1470 | 114 1471 | 1472 | NS.objects 1473 | 1474 | 1475 | CF$UID 1476 | 152 1477 | 1478 | 1479 | CF$UID 1480 | 156 1481 | 1482 | 1483 | CF$UID 1484 | 158 1485 | 1486 | 1487 | CF$UID 1488 | 160 1489 | 1490 | 1491 | 1492 | 1493 | $class 1494 | 1495 | CF$UID 1496 | 90 1497 | 1498 | NS.objects 1499 | 1500 | 1501 | CF$UID 1502 | 153 1503 | 1504 | 1505 | CF$UID 1506 | 154 1507 | 1508 | 1509 | CF$UID 1510 | 155 1511 | 1512 | 1513 | 1514 | iphone-filters 1515 | Classes 1516 | iphone_filtersViewController.h 1517 | 1518 | $class 1519 | 1520 | CF$UID 1521 | 90 1522 | 1523 | NS.objects 1524 | 1525 | 1526 | CF$UID 1527 | 153 1528 | 1529 | 1530 | CF$UID 1531 | 154 1532 | 1533 | 1534 | CF$UID 1535 | 157 1536 | 1537 | 1538 | 1539 | iphone_filtersViewController.m 1540 | 1541 | $class 1542 | 1543 | CF$UID 1544 | 90 1545 | 1546 | NS.objects 1547 | 1548 | 1549 | CF$UID 1550 | 153 1551 | 1552 | 1553 | CF$UID 1554 | 154 1555 | 1556 | 1557 | CF$UID 1558 | 159 1559 | 1560 | 1561 | 1562 | ImageFilter.h 1563 | 1564 | $class 1565 | 1566 | CF$UID 1567 | 90 1568 | 1569 | NS.objects 1570 | 1571 | 1572 | CF$UID 1573 | 153 1574 | 1575 | 1576 | CF$UID 1577 | 154 1578 | 1579 | 1580 | CF$UID 1581 | 161 1582 | 1583 | 1584 | 1585 | ImageFilter.m 1586 | 1587 | $class 1588 | 1589 | CF$UID 1590 | 150 1591 | 1592 | NS.objects 1593 | 1594 | 1595 | CF$UID 1596 | 163 1597 | 1598 | 1599 | CF$UID 1600 | 164 1601 | 1602 | 1603 | CF$UID 1604 | 166 1605 | 1606 | 1607 | CF$UID 1608 | 168 1609 | 1610 | 1611 | CF$UID 1612 | 169 1613 | 1614 | 1615 | CF$UID 1616 | 171 1617 | 1618 | 1619 | 1620 | 1621 | $class 1622 | 1623 | CF$UID 1624 | 90 1625 | 1626 | NS.objects 1627 | 1628 | 1629 | CF$UID 1630 | 153 1631 | 1632 | 1633 | 1634 | 1635 | $class 1636 | 1637 | CF$UID 1638 | 90 1639 | 1640 | NS.objects 1641 | 1642 | 1643 | CF$UID 1644 | 153 1645 | 1646 | 1647 | CF$UID 1648 | 165 1649 | 1650 | 1651 | 1652 | Other Sources 1653 | 1654 | $class 1655 | 1656 | CF$UID 1657 | 90 1658 | 1659 | NS.objects 1660 | 1661 | 1662 | CF$UID 1663 | 153 1664 | 1665 | 1666 | CF$UID 1667 | 167 1668 | 1669 | 1670 | 1671 | Frameworks 1672 | 1673 | $class 1674 | 1675 | CF$UID 1676 | 90 1677 | 1678 | NS.objects 1679 | 1680 | 1681 | CF$UID 1682 | 153 1683 | 1684 | 1685 | CF$UID 1686 | 154 1687 | 1688 | 1689 | 1690 | 1691 | $class 1692 | 1693 | CF$UID 1694 | 90 1695 | 1696 | NS.objects 1697 | 1698 | 1699 | CF$UID 1700 | 153 1701 | 1702 | 1703 | CF$UID 1704 | 170 1705 | 1706 | 1707 | 1708 | Products 1709 | 1710 | $class 1711 | 1712 | CF$UID 1713 | 90 1714 | 1715 | NS.objects 1716 | 1717 | 1718 | CF$UID 1719 | 153 1720 | 1721 | 1722 | CF$UID 1723 | 172 1724 | 1725 | 1726 | 1727 | Resources 1728 | 1729 | $class 1730 | 1731 | CF$UID 1732 | 37 1733 | 1734 | NS.keys 1735 | 1736 | 1737 | CF$UID 1738 | 127 1739 | 1740 | 1741 | NS.objects 1742 | 1743 | 1744 | CF$UID 1745 | 174 1746 | 1747 | 1748 | 1749 | 1750 | $class 1751 | 1752 | CF$UID 1753 | 90 1754 | 1755 | NS.objects 1756 | 1757 | 1758 | CF$UID 1759 | 175 1760 | 1761 | 1762 | CF$UID 1763 | 177 1764 | 1765 | 1766 | CF$UID 1767 | 179 1768 | 1769 | 1770 | 1771 | 1772 | $class 1773 | 1774 | CF$UID 1775 | 134 1776 | 1777 | NS.keys 1778 | 1779 | 1780 | CF$UID 1781 | 130 1782 | 1783 | 1784 | CF$UID 1785 | 131 1786 | 1787 | 1788 | NS.objects 1789 | 1790 | 1791 | CF$UID 1792 | 120 1793 | 1794 | 1795 | CF$UID 1796 | 176 1797 | 1798 | 1799 | 1800 | 260 1801 | 1802 | $class 1803 | 1804 | CF$UID 1805 | 134 1806 | 1807 | NS.keys 1808 | 1809 | 1810 | CF$UID 1811 | 130 1812 | 1813 | 1814 | CF$UID 1815 | 131 1816 | 1817 | 1818 | NS.objects 1819 | 1820 | 1821 | CF$UID 1822 | 123 1823 | 1824 | 1825 | CF$UID 1826 | 178 1827 | 1828 | 1829 | 1830 | 1102 1831 | 1832 | $class 1833 | 1834 | CF$UID 1835 | 134 1836 | 1837 | NS.keys 1838 | 1839 | 1840 | CF$UID 1841 | 130 1842 | 1843 | 1844 | CF$UID 1845 | 131 1846 | 1847 | 1848 | NS.objects 1849 | 1850 | 1851 | CF$UID 1852 | 180 1853 | 1854 | 1855 | CF$UID 1856 | 181 1857 | 1858 | 1859 | 1860 | IDEUtilitiesArea 1861 | 260 1862 | 1863 | $class 1864 | 1865 | CF$UID 1866 | 37 1867 | 1868 | NS.keys 1869 | 1870 | 1871 | CF$UID 1872 | 183 1873 | 1874 | 1875 | CF$UID 1876 | 184 1877 | 1878 | 1879 | CF$UID 1880 | 185 1881 | 1882 | 1883 | CF$UID 1884 | 186 1885 | 1886 | 1887 | CF$UID 1888 | 187 1889 | 1890 | 1891 | CF$UID 1892 | 188 1893 | 1894 | 1895 | CF$UID 1896 | 189 1897 | 1898 | 1899 | CF$UID 1900 | 190 1901 | 1902 | 1903 | NS.objects 1904 | 1905 | 1906 | CF$UID 1907 | 191 1908 | 1909 | 1910 | CF$UID 1911 | 208 1912 | 1913 | 1914 | CF$UID 1915 | 240 1916 | 1917 | 1918 | CF$UID 1919 | 124 1920 | 1921 | 1922 | CF$UID 1923 | 50 1924 | 1925 | 1926 | CF$UID 1927 | 265 1928 | 1929 | 1930 | CF$UID 1931 | 273 1932 | 1933 | 1934 | CF$UID 1935 | 124 1936 | 1937 | 1938 | 1939 | layoutTree 1940 | IDEEditorMode_Standard 1941 | IDEEDitorArea_DebugArea 1942 | IDEShowEditor 1943 | EditorMode 1944 | DebuggerSplitView 1945 | DefaultPersistentRepresentations 1946 | ShowDebuggerArea 1947 | 1948 | $class 1949 | 1950 | CF$UID 1951 | 207 1952 | 1953 | geniusEditorContextNode 1954 | 1955 | CF$UID 1956 | 0 1957 | 1958 | primaryEditorContextNode 1959 | 1960 | CF$UID 1961 | 192 1962 | 1963 | rootLayoutTreeNode 1964 | 1965 | CF$UID 1966 | 204 1967 | 1968 | 1969 | 1970 | $class 1971 | 1972 | CF$UID 1973 | 206 1974 | 1975 | children 1976 | 1977 | CF$UID 1978 | 0 1979 | 1980 | contentType 1981 | 1 1982 | documentArchivableRepresentation 1983 | 1984 | CF$UID 1985 | 193 1986 | 1987 | orientation 1988 | 0 1989 | parent 1990 | 1991 | CF$UID 1992 | 204 1993 | 1994 | 1995 | 1996 | $class 1997 | 1998 | CF$UID 1999 | 203 2000 | 2001 | DocumentLocation 2002 | 2003 | CF$UID 2004 | 201 2005 | 2006 | DomainIdentifier 2007 | 2008 | CF$UID 2009 | 194 2010 | 2011 | IdentifierPath 2012 | 2013 | CF$UID 2014 | 195 2015 | 2016 | IndexOfDocumentIdentifier 2017 | 2018 | CF$UID 2019 | 50 2020 | 2021 | 2022 | Xcode.IDENavigableItemDomain.WorkspaceStructure 2023 | 2024 | $class 2025 | 2026 | CF$UID 2027 | 114 2028 | 2029 | NS.objects 2030 | 2031 | 2032 | CF$UID 2033 | 196 2034 | 2035 | 2036 | CF$UID 2037 | 198 2038 | 2039 | 2040 | CF$UID 2041 | 199 2042 | 2043 | 2044 | 2045 | 2046 | $class 2047 | 2048 | CF$UID 2049 | 197 2050 | 2051 | Identifier 2052 | 2053 | CF$UID 2054 | 155 2055 | 2056 | 2057 | 2058 | $classes 2059 | 2060 | IDEArchivableStringIndexPair 2061 | NSObject 2062 | 2063 | $classname 2064 | IDEArchivableStringIndexPair 2065 | 2066 | 2067 | $class 2068 | 2069 | CF$UID 2070 | 197 2071 | 2072 | Identifier 2073 | 2074 | CF$UID 2075 | 154 2076 | 2077 | 2078 | 2079 | $class 2080 | 2081 | CF$UID 2082 | 197 2083 | 2084 | Identifier 2085 | 2086 | CF$UID 2087 | 200 2088 | 2089 | 2090 | iphone-filters 2091 | 2092 | $class 2093 | 2094 | CF$UID 2095 | 202 2096 | 2097 | documentURL 2098 | 2099 | CF$UID 2100 | 28 2101 | 2102 | timestamp 2103 | 2104 | CF$UID 2105 | 0 2106 | 2107 | 2108 | 2109 | $classes 2110 | 2111 | DVTDocumentLocation 2112 | NSObject 2113 | 2114 | $classname 2115 | DVTDocumentLocation 2116 | 2117 | 2118 | $classes 2119 | 2120 | IDENavigableItemArchivableRepresentation 2121 | NSObject 2122 | 2123 | $classname 2124 | IDENavigableItemArchivableRepresentation 2125 | 2126 | 2127 | $class 2128 | 2129 | CF$UID 2130 | 206 2131 | 2132 | children 2133 | 2134 | CF$UID 2135 | 205 2136 | 2137 | contentType 2138 | 0 2139 | documentArchivableRepresentation 2140 | 2141 | CF$UID 2142 | 0 2143 | 2144 | orientation 2145 | 0 2146 | parent 2147 | 2148 | CF$UID 2149 | 0 2150 | 2151 | 2152 | 2153 | $class 2154 | 2155 | CF$UID 2156 | 114 2157 | 2158 | NS.objects 2159 | 2160 | 2161 | CF$UID 2162 | 192 2163 | 2164 | 2165 | 2166 | 2167 | $classes 2168 | 2169 | IDEWorkspaceTabControllerLayoutTreeNode 2170 | NSObject 2171 | 2172 | $classname 2173 | IDEWorkspaceTabControllerLayoutTreeNode 2174 | 2175 | 2176 | $classes 2177 | 2178 | IDEWorkspaceTabControllerLayoutTree 2179 | NSObject 2180 | 2181 | $classname 2182 | IDEWorkspaceTabControllerLayoutTree 2183 | 2184 | 2185 | $class 2186 | 2187 | CF$UID 2188 | 37 2189 | 2190 | NS.keys 2191 | 2192 | 2193 | CF$UID 2194 | 209 2195 | 2196 | 2197 | NS.objects 2198 | 2199 | 2200 | CF$UID 2201 | 210 2202 | 2203 | 2204 | 2205 | EditorLayout_PersistentRepresentation 2206 | 2207 | $class 2208 | 2209 | CF$UID 2210 | 37 2211 | 2212 | NS.keys 2213 | 2214 | 2215 | CF$UID 2216 | 211 2217 | 2218 | 2219 | NS.objects 2220 | 2221 | 2222 | CF$UID 2223 | 212 2224 | 2225 | 2226 | 2227 | Main 2228 | 2229 | $class 2230 | 2231 | CF$UID 2232 | 134 2233 | 2234 | NS.keys 2235 | 2236 | 2237 | CF$UID 2238 | 213 2239 | 2240 | 2241 | CF$UID 2242 | 214 2243 | 2244 | 2245 | CF$UID 2246 | 215 2247 | 2248 | 2249 | NS.objects 2250 | 2251 | 2252 | CF$UID 2253 | 216 2254 | 2255 | 2256 | CF$UID 2257 | 50 2258 | 2259 | 2260 | CF$UID 2261 | 238 2262 | 2263 | 2264 | 2265 | EditorLayout_StateSavingStateDictionaries 2266 | EditorLayout_Selected 2267 | EditorLayout_Geometry 2268 | 2269 | $class 2270 | 2271 | CF$UID 2272 | 114 2273 | 2274 | NS.objects 2275 | 2276 | 2277 | CF$UID 2278 | 217 2279 | 2280 | 2281 | 2282 | 2283 | $class 2284 | 2285 | CF$UID 2286 | 37 2287 | 2288 | NS.keys 2289 | 2290 | 2291 | CF$UID 2292 | 218 2293 | 2294 | 2295 | CF$UID 2296 | 219 2297 | 2298 | 2299 | CF$UID 2300 | 220 2301 | 2302 | 2303 | CF$UID 2304 | 221 2305 | 2306 | 2307 | CF$UID 2308 | 222 2309 | 2310 | 2311 | CF$UID 2312 | 223 2313 | 2314 | 2315 | CF$UID 2316 | 224 2317 | 2318 | 2319 | NS.objects 2320 | 2321 | 2322 | CF$UID 2323 | 225 2324 | 2325 | 2326 | CF$UID 2327 | 226 2328 | 2329 | 2330 | CF$UID 2331 | 232 2332 | 2333 | 2334 | CF$UID 2335 | 155 2336 | 2337 | 2338 | CF$UID 2339 | 155 2340 | 2341 | 2342 | CF$UID 2343 | 17 2344 | 2345 | 2346 | CF$UID 2347 | 236 2348 | 2349 | 2350 | 2351 | FileDataType 2352 | ArchivableRepresentation 2353 | EditorState 2354 | NavigableItemName 2355 | DocumentNavigableItemName 2356 | DocumentExtensionIdentifier 2357 | DocumentURL 2358 | public.c-header 2359 | 2360 | $class 2361 | 2362 | CF$UID 2363 | 203 2364 | 2365 | DocumentLocation 2366 | 2367 | CF$UID 2368 | 201 2369 | 2370 | DomainIdentifier 2371 | 2372 | CF$UID 2373 | 194 2374 | 2375 | IdentifierPath 2376 | 2377 | CF$UID 2378 | 227 2379 | 2380 | IndexOfDocumentIdentifier 2381 | 2382 | CF$UID 2383 | 50 2384 | 2385 | 2386 | 2387 | $class 2388 | 2389 | CF$UID 2390 | 114 2391 | 2392 | NS.objects 2393 | 2394 | 2395 | CF$UID 2396 | 228 2397 | 2398 | 2399 | CF$UID 2400 | 229 2401 | 2402 | 2403 | CF$UID 2404 | 230 2405 | 2406 | 2407 | 2408 | 2409 | $class 2410 | 2411 | CF$UID 2412 | 197 2413 | 2414 | Identifier 2415 | 2416 | CF$UID 2417 | 155 2418 | 2419 | 2420 | 2421 | $class 2422 | 2423 | CF$UID 2424 | 197 2425 | 2426 | Identifier 2427 | 2428 | CF$UID 2429 | 154 2430 | 2431 | 2432 | 2433 | $class 2434 | 2435 | CF$UID 2436 | 197 2437 | 2438 | Identifier 2439 | 2440 | CF$UID 2441 | 231 2442 | 2443 | 2444 | iphone-filters 2445 | 2446 | $class 2447 | 2448 | CF$UID 2449 | 134 2450 | 2451 | NS.keys 2452 | 2453 | 2454 | CF$UID 2455 | 30 2456 | 2457 | 2458 | CF$UID 2459 | 31 2460 | 2461 | 2462 | CF$UID 2463 | 32 2464 | 2465 | 2466 | CF$UID 2467 | 33 2468 | 2469 | 2470 | NS.objects 2471 | 2472 | 2473 | CF$UID 2474 | 233 2475 | 2476 | 2477 | CF$UID 2478 | 234 2479 | 2480 | 2481 | CF$UID 2482 | 15 2483 | 2484 | 2485 | CF$UID 2486 | 235 2487 | 2488 | 2489 | 2490 | 340472562.87252498 2491 | {60, 999} 2492 | {340, 0} 2493 | 2494 | $class 2495 | 2496 | CF$UID 2497 | 22 2498 | 2499 | NS.base 2500 | 2501 | CF$UID 2502 | 0 2503 | 2504 | NS.relative 2505 | 2506 | CF$UID 2507 | 237 2508 | 2509 | 2510 | file://localhost/Users/kiichi/work/iphone/samples/open_source_projects/ios-image-filters/Classes/iphone_filtersViewController.h 2511 | 2512 | $class 2513 | 2514 | CF$UID 2515 | 114 2516 | 2517 | NS.objects 2518 | 2519 | 2520 | CF$UID 2521 | 239 2522 | 2523 | 2524 | 2525 | {{0, 0}, {1102, 511}} 2526 | 2527 | $class 2528 | 2529 | CF$UID 2530 | 37 2531 | 2532 | NS.keys 2533 | 2534 | 2535 | CF$UID 2536 | 241 2537 | 2538 | 2539 | CF$UID 2540 | 242 2541 | 2542 | 2543 | CF$UID 2544 | 243 2545 | 2546 | 2547 | CF$UID 2548 | 244 2549 | 2550 | 2551 | CF$UID 2552 | 245 2553 | 2554 | 2555 | CF$UID 2556 | 246 2557 | 2558 | 2559 | NS.objects 2560 | 2561 | 2562 | CF$UID 2563 | 86 2564 | 2565 | 2566 | CF$UID 2567 | 247 2568 | 2569 | 2570 | CF$UID 2571 | 249 2572 | 2573 | 2574 | CF$UID 2575 | 86 2576 | 2577 | 2578 | CF$UID 2579 | 251 2580 | 2581 | 2582 | CF$UID 2583 | 259 2584 | 2585 | 2586 | 2587 | LayoutFocusMode 2588 | console 2589 | variables 2590 | LayoutMode 2591 | IDEDebugArea_SplitView 2592 | IDEDebuggerAreaSplitView 2593 | 2594 | $class 2595 | 2596 | CF$UID 2597 | 37 2598 | 2599 | NS.keys 2600 | 2601 | 2602 | CF$UID 2603 | 248 2604 | 2605 | 2606 | NS.objects 2607 | 2608 | 2609 | CF$UID 2610 | 50 2611 | 2612 | 2613 | 2614 | ConsoleFilterMode 2615 | 2616 | $class 2617 | 2618 | CF$UID 2619 | 37 2620 | 2621 | NS.keys 2622 | 2623 | 2624 | CF$UID 2625 | 250 2626 | 2627 | 2628 | NS.objects 2629 | 2630 | 2631 | CF$UID 2632 | 86 2633 | 2634 | 2635 | 2636 | VariablesViewSelectedScope 2637 | 2638 | $class 2639 | 2640 | CF$UID 2641 | 37 2642 | 2643 | NS.keys 2644 | 2645 | 2646 | CF$UID 2647 | 127 2648 | 2649 | 2650 | NS.objects 2651 | 2652 | 2653 | CF$UID 2654 | 252 2655 | 2656 | 2657 | 2658 | 2659 | $class 2660 | 2661 | CF$UID 2662 | 90 2663 | 2664 | NS.objects 2665 | 2666 | 2667 | CF$UID 2668 | 253 2669 | 2670 | 2671 | CF$UID 2672 | 256 2673 | 2674 | 2675 | 2676 | 2677 | $class 2678 | 2679 | CF$UID 2680 | 134 2681 | 2682 | NS.keys 2683 | 2684 | 2685 | CF$UID 2686 | 130 2687 | 2688 | 2689 | CF$UID 2690 | 131 2691 | 2692 | 2693 | NS.objects 2694 | 2695 | 2696 | CF$UID 2697 | 254 2698 | 2699 | 2700 | CF$UID 2701 | 255 2702 | 2703 | 2704 | 2705 | VariablesView 2706 | 553 2707 | 2708 | $class 2709 | 2710 | CF$UID 2711 | 134 2712 | 2713 | NS.keys 2714 | 2715 | 2716 | CF$UID 2717 | 130 2718 | 2719 | 2720 | CF$UID 2721 | 131 2722 | 2723 | 2724 | NS.objects 2725 | 2726 | 2727 | CF$UID 2728 | 257 2729 | 2730 | 2731 | CF$UID 2732 | 258 2733 | 2734 | 2735 | 2736 | ConsoleArea 2737 | 548 2738 | 2739 | $class 2740 | 2741 | CF$UID 2742 | 37 2743 | 2744 | NS.keys 2745 | 2746 | 2747 | CF$UID 2748 | 127 2749 | 2750 | 2751 | NS.objects 2752 | 2753 | 2754 | CF$UID 2755 | 260 2756 | 2757 | 2758 | 2759 | 2760 | $class 2761 | 2762 | CF$UID 2763 | 90 2764 | 2765 | NS.objects 2766 | 2767 | 2768 | CF$UID 2769 | 261 2770 | 2771 | 2772 | CF$UID 2773 | 263 2774 | 2775 | 2776 | 2777 | 2778 | $class 2779 | 2780 | CF$UID 2781 | 134 2782 | 2783 | NS.keys 2784 | 2785 | 2786 | CF$UID 2787 | 130 2788 | 2789 | 2790 | CF$UID 2791 | 131 2792 | 2793 | 2794 | NS.objects 2795 | 2796 | 2797 | CF$UID 2798 | 254 2799 | 2800 | 2801 | CF$UID 2802 | 262 2803 | 2804 | 2805 | 2806 | 553 2807 | 2808 | $class 2809 | 2810 | CF$UID 2811 | 134 2812 | 2813 | NS.keys 2814 | 2815 | 2816 | CF$UID 2817 | 130 2818 | 2819 | 2820 | CF$UID 2821 | 131 2822 | 2823 | 2824 | NS.objects 2825 | 2826 | 2827 | CF$UID 2828 | 257 2829 | 2830 | 2831 | CF$UID 2832 | 264 2833 | 2834 | 2835 | 2836 | 548 2837 | 2838 | $class 2839 | 2840 | CF$UID 2841 | 37 2842 | 2843 | NS.keys 2844 | 2845 | 2846 | CF$UID 2847 | 127 2848 | 2849 | 2850 | NS.objects 2851 | 2852 | 2853 | CF$UID 2854 | 266 2855 | 2856 | 2857 | 2858 | 2859 | $class 2860 | 2861 | CF$UID 2862 | 90 2863 | 2864 | NS.objects 2865 | 2866 | 2867 | CF$UID 2868 | 267 2869 | 2870 | 2871 | CF$UID 2872 | 270 2873 | 2874 | 2875 | 2876 | 2877 | $class 2878 | 2879 | CF$UID 2880 | 134 2881 | 2882 | NS.keys 2883 | 2884 | 2885 | CF$UID 2886 | 130 2887 | 2888 | 2889 | CF$UID 2890 | 131 2891 | 2892 | 2893 | NS.objects 2894 | 2895 | 2896 | CF$UID 2897 | 268 2898 | 2899 | 2900 | CF$UID 2901 | 269 2902 | 2903 | 2904 | 2905 | IDEEditor 2906 | 533 2907 | 2908 | $class 2909 | 2910 | CF$UID 2911 | 134 2912 | 2913 | NS.keys 2914 | 2915 | 2916 | CF$UID 2917 | 130 2918 | 2919 | 2920 | CF$UID 2921 | 131 2922 | 2923 | 2924 | NS.objects 2925 | 2926 | 2927 | CF$UID 2928 | 271 2929 | 2930 | 2931 | CF$UID 2932 | 272 2933 | 2934 | 2935 | 2936 | IDEDebuggerArea 2937 | 115 2938 | 2939 | $class 2940 | 2941 | CF$UID 2942 | 37 2943 | 2944 | NS.keys 2945 | 2946 | NS.objects 2947 | 2948 | 2949 | 2950 | $top 2951 | 2952 | State 2953 | 2954 | CF$UID 2955 | 1 2956 | 2957 | 2958 | $version 2959 | 100000 2960 | 2961 | 2962 | -------------------------------------------------------------------------------- /iphone-filters.xcodeproj/xcuserdata/kiichi.xcuserdatad/xcschemes/iphone-filters.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 45 | 46 | 47 | 48 | 49 | 50 | 55 | 56 | 62 | 63 | 64 | 65 | 67 | 68 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /iphone-filters.xcodeproj/xcuserdata/kiichi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iphone-filters.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1D6058900D05DD3D006BFB54 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /iphone_filters-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSMainNibFile 28 | MainWindow 29 | 30 | 31 | -------------------------------------------------------------------------------- /iphone_filtersViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1056 5 | 10J869 6 | 851 7 | 1038.35 8 | 461.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 141 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 274 43 | 44 | YES 45 | 46 | 47 | 274 48 | {{20, 10}, {280, 319}} 49 | 50 | 1 51 | NO 52 | IBCocoaTouchFramework 53 | 54 | 55 | 56 | 292 57 | {{20, 372}, {280, 37}} 58 | 59 | NO 60 | IBCocoaTouchFramework 61 | 0 62 | 0 63 | 64 | Helvetica-Bold 65 | 15 66 | 16 67 | 68 | 1 69 | Choose Adjustable Filter 70 | 71 | 3 72 | MQA 73 | 74 | 75 | 1 76 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 77 | 78 | 79 | 3 80 | MC41AA 81 | 82 | 83 | 84 | 85 | 292 86 | {{20, 417}, {280, 37}} 87 | 88 | NO 89 | IBCocoaTouchFramework 90 | 0 91 | 0 92 | 93 | 1 94 | Apply Pre-Packaged Filter 95 | 96 | 97 | 1 98 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 99 | 100 | 101 | 102 | 103 | 104 | 292 105 | {{18, 342}, {284, 23}} 106 | 107 | NO 108 | IBCocoaTouchFramework 109 | 0 110 | 0 111 | 0.5 112 | 113 | 114 | {320, 460} 115 | 116 | 117 | 3 118 | MC43NQA 119 | 120 | 2 121 | 122 | 123 | NO 124 | 125 | IBCocoaTouchFramework 126 | 127 | 128 | 129 | 130 | YES 131 | 132 | 133 | view 134 | 135 | 136 | 137 | 7 138 | 139 | 140 | 141 | imageView 142 | 143 | 144 | 145 | 11 146 | 147 | 148 | 149 | slider 150 | 151 | 152 | 153 | 14 154 | 155 | 156 | 157 | buttonAdjustable 158 | 159 | 160 | 161 | 16 162 | 163 | 164 | 165 | buttonPackaged 166 | 167 | 168 | 169 | 17 170 | 171 | 172 | 173 | 174 | YES 175 | 176 | 0 177 | 178 | 179 | 180 | 181 | 182 | -1 183 | 184 | 185 | File's Owner 186 | 187 | 188 | -2 189 | 190 | 191 | 192 | 193 | 6 194 | 195 | 196 | YES 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 9 206 | 207 | 208 | 209 | 210 | 10 211 | 212 | 213 | 214 | 215 | 13 216 | 217 | 218 | 219 | 220 | 15 221 | 222 | 223 | 224 | 225 | 226 | 227 | YES 228 | 229 | YES 230 | -1.CustomClassName 231 | -2.CustomClassName 232 | 10.IBPluginDependency 233 | 10.IBViewBoundsToFrameTransform 234 | 13.IBPluginDependency 235 | 13.IBViewBoundsToFrameTransform 236 | 15.IBPluginDependency 237 | 15.IBViewBoundsToFrameTransform 238 | 6.IBEditorWindowLastContentRect 239 | 6.IBPluginDependency 240 | 9.IBPluginDependency 241 | 9.IBViewBoundsToFrameTransform 242 | 243 | 244 | YES 245 | iphone_filtersViewController 246 | UIResponder 247 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 248 | 249 | AUGgAABDugAAA 250 | 251 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 252 | 253 | P4AAAL+AAABBkAAAw7gAAA 254 | 255 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 256 | 257 | P4AAAL+AAABByAAAw84AAA 258 | 259 | {{457, 187}, {320, 480}} 260 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 261 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 262 | 263 | P4AAAL+AAABBoAAAw6iAAA 264 | 265 | 266 | 267 | 268 | YES 269 | 270 | 271 | YES 272 | 273 | 274 | 275 | 276 | YES 277 | 278 | 279 | YES 280 | 281 | 282 | 283 | 17 284 | 285 | 286 | 287 | YES 288 | 289 | iphone_filtersViewController 290 | UIViewController 291 | 292 | YES 293 | 294 | YES 295 | buttonAdjustable 296 | buttonPackaged 297 | imageView 298 | slider 299 | 300 | 301 | YES 302 | UIButton 303 | UIButton 304 | UIImageView 305 | UISlider 306 | 307 | 308 | 309 | YES 310 | 311 | YES 312 | buttonAdjustable 313 | buttonPackaged 314 | imageView 315 | slider 316 | 317 | 318 | YES 319 | 320 | buttonAdjustable 321 | UIButton 322 | 323 | 324 | buttonPackaged 325 | UIButton 326 | 327 | 328 | imageView 329 | UIImageView 330 | 331 | 332 | slider 333 | UISlider 334 | 335 | 336 | 337 | 338 | IBProjectSource 339 | Classes/iphone_filtersViewController.h 340 | 341 | 342 | 343 | 344 | YES 345 | 346 | NSObject 347 | 348 | IBFrameworkSource 349 | Foundation.framework/Headers/NSError.h 350 | 351 | 352 | 353 | NSObject 354 | 355 | IBFrameworkSource 356 | Foundation.framework/Headers/NSFileManager.h 357 | 358 | 359 | 360 | NSObject 361 | 362 | IBFrameworkSource 363 | Foundation.framework/Headers/NSKeyValueCoding.h 364 | 365 | 366 | 367 | NSObject 368 | 369 | IBFrameworkSource 370 | Foundation.framework/Headers/NSKeyValueObserving.h 371 | 372 | 373 | 374 | NSObject 375 | 376 | IBFrameworkSource 377 | Foundation.framework/Headers/NSKeyedArchiver.h 378 | 379 | 380 | 381 | NSObject 382 | 383 | IBFrameworkSource 384 | Foundation.framework/Headers/NSObject.h 385 | 386 | 387 | 388 | NSObject 389 | 390 | IBFrameworkSource 391 | Foundation.framework/Headers/NSRunLoop.h 392 | 393 | 394 | 395 | NSObject 396 | 397 | IBFrameworkSource 398 | Foundation.framework/Headers/NSThread.h 399 | 400 | 401 | 402 | NSObject 403 | 404 | IBFrameworkSource 405 | Foundation.framework/Headers/NSURL.h 406 | 407 | 408 | 409 | NSObject 410 | 411 | IBFrameworkSource 412 | Foundation.framework/Headers/NSURLConnection.h 413 | 414 | 415 | 416 | NSObject 417 | 418 | IBFrameworkSource 419 | UIKit.framework/Headers/UIAccessibility.h 420 | 421 | 422 | 423 | NSObject 424 | 425 | IBFrameworkSource 426 | UIKit.framework/Headers/UINibLoading.h 427 | 428 | 429 | 430 | NSObject 431 | 432 | IBFrameworkSource 433 | UIKit.framework/Headers/UIResponder.h 434 | 435 | 436 | 437 | UIButton 438 | UIControl 439 | 440 | IBFrameworkSource 441 | UIKit.framework/Headers/UIButton.h 442 | 443 | 444 | 445 | UIControl 446 | UIView 447 | 448 | IBFrameworkSource 449 | UIKit.framework/Headers/UIControl.h 450 | 451 | 452 | 453 | UIImageView 454 | UIView 455 | 456 | IBFrameworkSource 457 | UIKit.framework/Headers/UIImageView.h 458 | 459 | 460 | 461 | UIResponder 462 | NSObject 463 | 464 | 465 | 466 | UISearchBar 467 | UIView 468 | 469 | IBFrameworkSource 470 | UIKit.framework/Headers/UISearchBar.h 471 | 472 | 473 | 474 | UISearchDisplayController 475 | NSObject 476 | 477 | IBFrameworkSource 478 | UIKit.framework/Headers/UISearchDisplayController.h 479 | 480 | 481 | 482 | UISlider 483 | UIControl 484 | 485 | IBFrameworkSource 486 | UIKit.framework/Headers/UISlider.h 487 | 488 | 489 | 490 | UIView 491 | 492 | IBFrameworkSource 493 | UIKit.framework/Headers/UIPrintFormatter.h 494 | 495 | 496 | 497 | UIView 498 | 499 | IBFrameworkSource 500 | UIKit.framework/Headers/UITextField.h 501 | 502 | 503 | 504 | UIView 505 | UIResponder 506 | 507 | IBFrameworkSource 508 | UIKit.framework/Headers/UIView.h 509 | 510 | 511 | 512 | UIViewController 513 | 514 | IBFrameworkSource 515 | UIKit.framework/Headers/UINavigationController.h 516 | 517 | 518 | 519 | UIViewController 520 | 521 | IBFrameworkSource 522 | UIKit.framework/Headers/UIPopoverController.h 523 | 524 | 525 | 526 | UIViewController 527 | 528 | IBFrameworkSource 529 | UIKit.framework/Headers/UISplitViewController.h 530 | 531 | 532 | 533 | UIViewController 534 | 535 | IBFrameworkSource 536 | UIKit.framework/Headers/UITabBarController.h 537 | 538 | 539 | 540 | UIViewController 541 | UIResponder 542 | 543 | IBFrameworkSource 544 | UIKit.framework/Headers/UIViewController.h 545 | 546 | 547 | 548 | 549 | 0 550 | IBCocoaTouchFramework 551 | 552 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 553 | 554 | 555 | 556 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 557 | 558 | 559 | YES 560 | iphone-filters.xcodeproj 561 | 3 562 | 141 563 | 564 | 565 | -------------------------------------------------------------------------------- /iphone_filters_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'iphone-filters' target in the 'iphone-filters' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /landscape.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esilverberg/ios-image-filters/7741be1db2345ddbe0f7380df16bb15cb29870ee/landscape.jpg -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // iphone-filters 4 | // 5 | // Created by Eric Silverberg on 6/16/11. 6 | // Copyright 2011 Perry Street Software, Inc. 7 | // 8 | // Licensed under the MIT License. 9 | // 10 | 11 | #import 12 | 13 | int main(int argc, char *argv[]) { 14 | 15 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 16 | int retVal = UIApplicationMain(argc, argv, nil, nil); 17 | [pool release]; 18 | return retVal; 19 | } 20 | --------------------------------------------------------------------------------