├── ABImageMapping ├── en.lproj │ └── InfoPlist.strings ├── ABViewController.h ├── ABFastImageCell.h ├── ABAppDelegate.h ├── ABImageMapping-Prefix.pch ├── main.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── ABImageMapping-Info.plist ├── ABFastImageCell.m ├── ABAppDelegate.m ├── ABViewController.m └── Base.lproj │ └── Main.storyboard ├── ABImageMappingTests ├── en.lproj │ └── InfoPlist.strings ├── ABImageMappingTests-Info.plist └── ABImageMappingTests.m ├── Demo Images └── README ├── fetch_demo_images.sh ├── ABImageMapping.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcuserdata │ └── k06a.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── ABImageMapping.xcscheme └── project.pbxproj ├── .gitignore ├── UIImage+DecompressAndMap.podspec ├── LICENSE ├── UIImage+DecompressAndMap.h └── UIImage+DecompressAndMap.m /ABImageMapping/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ABImageMappingTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Demo Images/README: -------------------------------------------------------------------------------- 1 | Either place your own .jpg files in this directory, or run the fetch_demo_images.sh script in the FastImageCacheDemo directory. -------------------------------------------------------------------------------- /fetch_demo_images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Fetching demo images..." 4 | `curl "https://s3.amazonaws.com/fast-image-cache/demo-images/FICDDemoImage[000-099].jpg" --create-dirs -o "Demo Images/FICDDemoImage#1.jpg" --silent` -------------------------------------------------------------------------------- /ABImageMapping.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ABImageMapping/ABViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABViewController.h 3 | // ABImageMapping 4 | // 5 | // Created by Антон Буков on 23.02.14. 6 | // Copyright (c) 2014 Codeless Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ABViewController : UICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ABImageMapping/ABFastImageCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABFastImageCell.h 3 | // ABImageMapping 4 | // 5 | // Created by Антон Буков on 23.02.14. 6 | // Copyright (c) 2014 Codeless Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ABFastImageCell : UICollectionViewCell 12 | 13 | @property (strong, nonatomic) UIImage *image; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X 2 | *.DS_Store 3 | 4 | # Xcode 5 | Build/ 6 | **/build/* 7 | *.pbxuser 8 | !default.pbxuser 9 | *.mode1v3 10 | !default.mode1v3 11 | *.mode2v3 12 | !default.mode2v3 13 | *.perspectivev3 14 | !default.perspectivev3 15 | *.xcworkspace 16 | !default.xcworkspace 17 | xcuserdata 18 | profile 19 | *.moved-aside 20 | 21 | # CocoaPods 22 | Pods/ 23 | Demo Images 24 | -------------------------------------------------------------------------------- /ABImageMapping/ABAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABAppDelegate.h 3 | // ABImageMapping 4 | // 5 | // Created by Антон Буков on 23.02.14. 6 | // Copyright (c) 2014 Codeless Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ABAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ABImageMapping/ABImageMapping-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /ABImageMapping/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ABImageMapping 4 | // 5 | // Created by Антон Буков on 23.02.14. 6 | // Copyright (c) 2014 Codeless Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "ABAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([ABAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ABImageMapping/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /UIImage+DecompressAndMap.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "UIImage+DecompressAndMap" 3 | s.version = "0.1.3" 4 | s.summary = "iOS library for quickly displaying images while scrolling" 5 | s.homepage = "https://github.com/k06a/UIImage-DecompressAndMap" 6 | s.license = 'MIT' 7 | s.author = { "Anton Bukov" => "k06aaa@gmail.com" } 8 | s.source = { :git => "https://github.com/k06a/UIImage-DecompressAndMap.git", :tag => '0.1.3' } 9 | s.platform = :ios, '1.0' 10 | s.source_files = '*.{h,m}' 11 | s.requires_arc = true 12 | end 13 | -------------------------------------------------------------------------------- /ABImageMapping/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /ABImageMapping.xcodeproj/xcuserdata/k06a.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ABImageMapping.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 25F3FB7618B96EC4002BB17F 16 | 17 | primary 18 | 19 | 20 | 25F3FB9718B96EC4002BB17F 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ABImageMappingTests/ABImageMappingTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.codeless.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ABImageMappingTests/ABImageMappingTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ABImageMappingTests.m 3 | // ABImageMappingTests 4 | // 5 | // Created by Антон Буков on 23.02.14. 6 | // Copyright (c) 2014 Codeless Solutions. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ABImageMappingTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ABImageMappingTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Anton Bukov 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /UIImage+DecompressAndMap.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+ImageWithDataNoCopy.h 3 | // DailyPhoto 4 | // 5 | // Created by Антон Буков on 30.11.13. 6 | // Copyright (c) 2013 Codeless Solution. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (DecompressAndMap) 12 | 13 | - (UIImage *)decompressAndMapToData:(NSData **)data; 14 | - (UIImage *)decompressAndMapToData:(NSData **)data withCrop:(CGRect)cropRect; 15 | - (UIImage *)decompressAndMapToData:(NSData **)data withResize:(CGSize)resizeSize; 16 | - (UIImage *)decompressAndMapToData:(NSData **)data withCrop:(CGRect)cropRect andResize:(CGSize)resizeSize; 17 | 18 | - (UIImage *)decompressAndMapToPath:(NSString *)path; 19 | - (UIImage *)decompressAndMapToPath:(NSString *)path withCrop:(CGRect)cropRect; 20 | - (UIImage *)decompressAndMapToPath:(NSString *)path withResize:(CGSize)resizeSize; 21 | - (UIImage *)decompressAndMapToPath:(NSString *)path withCrop:(CGRect)cropRect andResize:(CGSize)resizeSize; 22 | 23 | + (UIImage *)imageMapFromData:(NSData *)data; 24 | + (UIImage *)imageMapFromPath:(NSString *)path; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /ABImageMapping/ABImageMapping-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.codeless.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarHidden 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ABImageMapping/ABFastImageCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ABFastImageCell.m 3 | // ABImageMapping 4 | // 5 | // Created by Антон Буков on 23.02.14. 6 | // Copyright (c) 2014 Codeless Solutions. All rights reserved. 7 | // 8 | 9 | #import "ABFastImageCell.h" 10 | 11 | @implementation ABFastImageCell 12 | 13 | static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight) 14 | { 15 | if (ovalWidth == 0 || ovalHeight == 0) { 16 | CGContextAddRect(context, rect); 17 | return; 18 | } 19 | CGContextSaveGState(context); 20 | CGContextTranslateCTM(context, CGRectGetMinX(rect), CGRectGetMinY(rect)); 21 | CGContextScaleCTM(context, ovalWidth, ovalHeight); 22 | float fw = CGRectGetWidth(rect) / ovalWidth; 23 | float fh = CGRectGetHeight(rect) / ovalHeight; 24 | CGContextMoveToPoint(context, fw, fh/2); 25 | CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1); 26 | CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1); 27 | CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1); 28 | CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1); 29 | CGContextClosePath(context); 30 | CGContextRestoreGState(context); 31 | } 32 | 33 | - (void)drawRect:(CGRect)rect 34 | { 35 | CGContextRef context = UIGraphicsGetCurrentContext(); 36 | CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor); 37 | CGContextFillRect(context, self.bounds); 38 | 39 | CGContextSaveGState(context); 40 | NSInteger dx = (self.bounds.size.width/10)/2; 41 | addRoundedRectToPath(context, CGRectInset(self.bounds, dx, dx), 2*dx, 2*dx); 42 | CGContextClip(context); 43 | [self.image drawInRect:CGRectInset(self.bounds, dx, dx)]; 44 | CGContextRestoreGState(context); 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /ABImageMapping/ABAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // ABAppDelegate.m 3 | // ABImageMapping 4 | // 5 | // Created by Антон Буков on 23.02.14. 6 | // Copyright (c) 2014 Codeless Solutions. All rights reserved. 7 | // 8 | 9 | #import "ABAppDelegate.h" 10 | 11 | @implementation ABAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /ABImageMapping.xcodeproj/xcuserdata/k06a.xcuserdatad/xcschemes/ABImageMapping.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /ABImageMapping/ABViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ABViewController.m 3 | // ABImageMapping 4 | // 5 | // Created by Антон Буков on 23.02.14. 6 | // Copyright (c) 2014 Codeless Solutions. All rights reserved. 7 | // 8 | 9 | #import "ABViewController.h" 10 | #import "ABFastImageCell.h" 11 | #import "UIImage+DecompressAndMap.h" 12 | 13 | @interface ABViewController () 14 | @property (weak, nonatomic) IBOutlet UISegmentedControl *segmentControl; 15 | 16 | @property (strong, nonatomic) NSArray *imageNames; 17 | @property (strong, nonatomic) NSMutableArray *images; 18 | @end 19 | 20 | @implementation ABViewController 21 | 22 | - (NSArray *)imageNames 23 | { 24 | if (_imageNames == nil) 25 | { 26 | _imageNames = @[]; 27 | for (NSString *ext in @[@"jpg",@"png"]) 28 | _imageNames = [_imageNames arrayByAddingObjectsFromArray:[[NSBundle mainBundle] URLsForResourcesWithExtension:ext subdirectory:@"Demo Images"]]; 29 | } 30 | return _imageNames; 31 | } 32 | 33 | - (NSMutableArray *)images 34 | { 35 | if (_images == nil || _images.count != self.imageNames.count) 36 | { 37 | _images = [NSMutableArray arrayWithCapacity:self.imageNames.count]; 38 | for (id a in self.imageNames) 39 | [_images addObject:[NSNull null]]; 40 | } 41 | return _images; 42 | } 43 | 44 | #pragma mark - Collection View 45 | 46 | - (CGSize)collectionView:(UICollectionView *)collectionView 47 | layout:(UICollectionViewLayout *)collectionViewLayout 48 | sizeForItemAtIndexPath:(NSIndexPath *)indexPath 49 | { 50 | if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) 51 | return CGSizeMake(85,85); 52 | return CGSizeMake(32,32); 53 | } 54 | 55 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 56 | { 57 | return self.imageNames.count * 1000; 58 | } 59 | 60 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 61 | { 62 | ABFastImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell_1" forIndexPath:indexPath]; 63 | //cell.layer.rasterizationScale = [UIScreen mainScreen].scale; 64 | //cell.layer.shouldRasterize = YES; 65 | 66 | NSInteger imageIndex = indexPath.row % self.imageNames.count; 67 | NSURL *photoUrl = self.imageNames[imageIndex]; 68 | 69 | cell.image = nil; 70 | 71 | if (self.segmentControl.selectedSegmentIndex == 0) 72 | { 73 | cell.image = [UIImage imageWithContentsOfFile:photoUrl.path]; 74 | return cell; 75 | } 76 | 77 | if (self.images[imageIndex] != [NSNull null]) 78 | cell.image = self.images[imageIndex]; 79 | 80 | if (cell.image == nil) 81 | { 82 | static NSString *documentDir = nil; 83 | if (documentDir == nil) 84 | documentDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; 85 | 86 | NSString *photoPath = photoUrl.path; 87 | NSString *path = [documentDir stringByAppendingFormat:@"/%i-%i-%i", 88 | (int)photoPath.hash, 89 | (int)cell.bounds.size.width, 90 | (int)cell.bounds.size.height]; 91 | 92 | cell.image = [UIImage imageMapFromPath:path]; 93 | if (cell.image == nil) 94 | { 95 | cell.image = [UIImage imageWithContentsOfFile:photoPath]; 96 | cell.image = [cell.image decompressAndMapToPath:path withResize:CGSizeMake((int)cell.bounds.size.width*9/10, (int)cell.bounds.size.height*9/10)]; 97 | } 98 | if (cell.image) 99 | self.images[imageIndex] = cell.image; 100 | } 101 | 102 | return cell; 103 | } 104 | 105 | #pragma mark - View 106 | 107 | - (void)viewDidLoad 108 | { 109 | [super viewDidLoad]; 110 | 111 | [self.collectionView registerClass:[ABFastImageCell class] forCellWithReuseIdentifier:@"cell_1"]; 112 | } 113 | 114 | - (void)didReceiveMemoryWarning 115 | { 116 | [super didReceiveMemoryWarning]; 117 | // Dispose of any resources that can be recreated. 118 | } 119 | 120 | @end 121 | -------------------------------------------------------------------------------- /ABImageMapping/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /UIImage+DecompressAndMap.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+ImageWithDataNoCopy.m 3 | // DailyPhoto 4 | // 5 | // Created by Антон Буков on 30.11.13. 6 | // Copyright (c) 2013 Codeless Solution. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIImage+DecompressAndMap.h" 11 | 12 | @implementation UIImage (DecompressAndMap) 13 | 14 | // conform to CGDataProviderReleaseDataCallback 15 | void munmap_wrapper(void *p, const void *cp, size_t l) { munmap(p,l); } 16 | 17 | - (UIImage *)decompressAndMapToData:(NSData *__autoreleasing *)data 18 | { 19 | return [self decompressAndMapToData:data 20 | withCrop:(CGRect){CGPointZero,self.size} 21 | andResize:self.size]; 22 | } 23 | 24 | - (UIImage *)decompressAndMapToData:(NSData *__autoreleasing *)data withCrop:(CGRect)cropRect 25 | { 26 | return [self decompressAndMapToData:data 27 | withCrop:cropRect 28 | andResize:cropRect.size]; 29 | } 30 | 31 | - (UIImage *)decompressAndMapToData:(NSData *__autoreleasing *)data withResize:(CGSize)resizeSize; 32 | { 33 | return [self decompressAndMapToData:data 34 | withCrop:(CGRect){CGPointZero,self.size} 35 | andResize:resizeSize]; 36 | } 37 | 38 | - (UIImage *)decompressAndMapToData:(NSData *__autoreleasing *)data withCrop:(CGRect)cropRect andResize:(CGSize)resizeSize; 39 | { 40 | CGImageRef sourceImage = self.CGImage; 41 | 42 | //Parameters needed to create the bitmap context 43 | CGFloat scale = [UIScreen mainScreen].scale; 44 | uint32_t width = resizeSize.width*scale;//CGImageGetWidth(sourceImage); 45 | uint32_t height = resizeSize.height*scale;//CGImageGetHeight(sourceImage); 46 | NSInteger bitsPerComponent = 8; //Each component is 1 byte, so 8 bits 47 | NSInteger bytesPerRow = 4 * width; //Uncompressed RGBA is 4 bytes per pixel 48 | 49 | size_t size = height*bytesPerRow+4+4+4; 50 | NSMutableData *buffer = [NSMutableData dataWithLength:size]; 51 | uint8_t *bytes = buffer.mutableBytes; 52 | *(uint32_t *)(bytes+0) = (uint32_t)width; 53 | *(uint32_t *)(bytes+4) = (uint32_t)height; 54 | *(float *)(bytes+8) = (float)scale; 55 | bytes += 12; 56 | *data = buffer; 57 | 58 | //Create uncompressed context, draw the compressed source image into it 59 | //and save the resulting image. 60 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 61 | CGContextRef context = CGBitmapContextCreate(bytes, width, height, bitsPerComponent, bytesPerRow, colorSpace, (uint32_t)kCGImageAlphaPremultipliedLast); 62 | 63 | CGFloat kx = resizeSize.width*scale / cropRect.size.width; 64 | CGFloat ky = resizeSize.height*scale / cropRect.size.height; 65 | CGRect drawRect = CGRectMake(-cropRect.origin.x*kx, 66 | -cropRect.origin.y*kx, 67 | self.size.width*kx, 68 | self.size.height*ky); 69 | CGContextDrawImage(context, drawRect, sourceImage); 70 | 71 | //Tidy up 72 | CGColorSpaceRelease(colorSpace); 73 | CGContextRelease(context); 74 | 75 | return [UIImage imageMapFromData:buffer]; 76 | } 77 | 78 | /// 79 | 80 | - (UIImage *)decompressAndMapToPath:(NSString *)path 81 | { 82 | return [self decompressAndMapToPath:path 83 | withCrop:(CGRect){CGPointZero,self.size} 84 | andResize:self.size]; 85 | } 86 | 87 | - (UIImage *)decompressAndMapToPath:(NSString *)path withCrop:(CGRect)cropRect 88 | { 89 | return [self decompressAndMapToPath:path 90 | withCrop:cropRect 91 | andResize:cropRect.size]; 92 | } 93 | 94 | - (UIImage *)decompressAndMapToPath:(NSString *)path withResize:(CGSize)resizeSize; 95 | { 96 | return [self decompressAndMapToPath:path 97 | withCrop:(CGRect){CGPointZero,self.size} 98 | andResize:resizeSize]; 99 | } 100 | 101 | - (UIImage *)decompressAndMapToPath:(NSString *)path withCrop:(CGRect)cropRect andResize:(CGSize)resizeSize; 102 | { 103 | CGImageRef sourceImage = self.CGImage; 104 | 105 | //Parameters needed to create the bitmap context 106 | CGFloat scale = [UIScreen mainScreen].scale; 107 | uint32_t width = resizeSize.width*scale;//CGImageGetWidth(sourceImage); 108 | uint32_t height = resizeSize.height*scale;//CGImageGetHeight(sourceImage); 109 | NSInteger bitsPerComponent = 8; //Each component is 1 byte, so 8 bits 110 | NSInteger bytesPerRow = 4 * width; //Uncompressed RGBA is 4 bytes per pixel 111 | 112 | FILE *file = fopen([path UTF8String], "w+"); 113 | if (file == NULL) 114 | return nil; 115 | int filed = fileno(file); 116 | size_t size = height*bytesPerRow+4+4+4; 117 | ftruncate(filed, size); 118 | char *data = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, filed, 0); 119 | *(uint32_t *)(data+0) = (uint32_t)width; 120 | *(uint32_t *)(data+4) = (uint32_t)height; 121 | *(float *)(data+8) = (float)scale; 122 | 123 | data += 12; 124 | size -= 12; 125 | fclose(file); 126 | 127 | //Create uncompressed context, draw the compressed source image into it 128 | //and save the resulting image. 129 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 130 | CGContextRef context = CGBitmapContextCreate(data, width, height, bitsPerComponent, bytesPerRow, colorSpace, (uint32_t)kCGImageAlphaPremultipliedFirst); 131 | 132 | CGFloat kx = resizeSize.width*scale / cropRect.size.width; 133 | CGFloat ky = resizeSize.height*scale / cropRect.size.height; 134 | CGRect drawRect = CGRectMake(-cropRect.origin.x*kx, 135 | -cropRect.origin.y*kx, 136 | self.size.width*kx, 137 | self.size.height*ky); 138 | CGContextDrawImage(context, drawRect, sourceImage); 139 | 140 | CGDataProviderRef provider = CGDataProviderCreateWithData(data, data, size, munmap_wrapper); 141 | CGImageRef inflatedImage = CGImageCreate(width, height, bitsPerComponent, 4*8, bytesPerRow, colorSpace, (uint32_t)kCGImageAlphaPremultipliedLast, provider, NULL, NO, kCGRenderingIntentDefault); 142 | 143 | //Tidy up 144 | CGColorSpaceRelease(colorSpace); 145 | CGContextRelease(context); 146 | CGDataProviderRelease(provider); 147 | 148 | UIImage *img = [UIImage imageWithCGImage:inflatedImage scale:self.scale orientation:UIImageOrientationUp]; 149 | CGImageRelease(inflatedImage); 150 | return img; 151 | } 152 | 153 | + (UIImage *)imageMapFromData:(NSData *)data 154 | { 155 | uint8_t *bytes = (uint8_t *)data.bytes; 156 | uint32_t width = *(uint32_t *)(bytes + 0); 157 | uint32_t height = *(uint32_t *)(bytes + 4); 158 | float scale = *(float *)(bytes + 8); 159 | bytes += 12; 160 | 161 | NSInteger bitsPerComponent = 8; 162 | NSInteger bytesPerRow = 4 * width; 163 | size_t size = height*bytesPerRow; 164 | 165 | if (data.length < size + 12) 166 | return nil; 167 | 168 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 169 | CGDataProviderRef provider = CGDataProviderCreateWithData(bytes, bytes, size, munmap_wrapper); 170 | CGImageRef inflatedImage = CGImageCreate(width, height, bitsPerComponent, 4*8, bytesPerRow, colorSpace, (uint32_t)kCGImageAlphaPremultipliedLast, provider, NULL, NO, kCGRenderingIntentDefault); 171 | 172 | //Tidy up 173 | CGColorSpaceRelease(colorSpace); 174 | CGDataProviderRelease(provider); 175 | 176 | UIImage *img = [UIImage imageWithCGImage:inflatedImage scale:scale orientation:UIImageOrientationUp]; 177 | CGImageRelease(inflatedImage); 178 | return img; 179 | } 180 | 181 | + (UIImage *)imageMapFromPath:(NSString *)path 182 | { 183 | NSError *error = nil; 184 | NSData *data = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedAlways error:&error]; 185 | if (error != nil || data == nil) 186 | return nil; 187 | return [UIImage imageMapFromData:data]; 188 | } 189 | 190 | @end 191 | -------------------------------------------------------------------------------- /ABImageMapping.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 25F3FB7B18B96EC4002BB17F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25F3FB7A18B96EC4002BB17F /* Foundation.framework */; }; 11 | 25F3FB7D18B96EC4002BB17F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25F3FB7C18B96EC4002BB17F /* CoreGraphics.framework */; }; 12 | 25F3FB7F18B96EC4002BB17F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25F3FB7E18B96EC4002BB17F /* UIKit.framework */; }; 13 | 25F3FB8518B96EC4002BB17F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 25F3FB8318B96EC4002BB17F /* InfoPlist.strings */; }; 14 | 25F3FB8718B96EC4002BB17F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 25F3FB8618B96EC4002BB17F /* main.m */; }; 15 | 25F3FB8B18B96EC4002BB17F /* ABAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 25F3FB8A18B96EC4002BB17F /* ABAppDelegate.m */; }; 16 | 25F3FB8E18B96EC4002BB17F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 25F3FB8C18B96EC4002BB17F /* Main.storyboard */; }; 17 | 25F3FB9118B96EC4002BB17F /* ABViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 25F3FB9018B96EC4002BB17F /* ABViewController.m */; }; 18 | 25F3FB9318B96EC4002BB17F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 25F3FB9218B96EC4002BB17F /* Images.xcassets */; }; 19 | 25F3FB9A18B96EC4002BB17F /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25F3FB9918B96EC4002BB17F /* XCTest.framework */; }; 20 | 25F3FB9B18B96EC4002BB17F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25F3FB7A18B96EC4002BB17F /* Foundation.framework */; }; 21 | 25F3FB9C18B96EC4002BB17F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25F3FB7E18B96EC4002BB17F /* UIKit.framework */; }; 22 | 25F3FBA418B96EC4002BB17F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 25F3FBA218B96EC4002BB17F /* InfoPlist.strings */; }; 23 | 25F3FBA618B96EC4002BB17F /* ABImageMappingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 25F3FBA518B96EC4002BB17F /* ABImageMappingTests.m */; }; 24 | 25F3FBB018B9705D002BB17F /* Demo Images in Resources */ = {isa = PBXBuildFile; fileRef = 25F3FBAF18B9705D002BB17F /* Demo Images */; }; 25 | 25F3FBB618B97643002BB17F /* UIImage+DecompressAndMap.m in Sources */ = {isa = PBXBuildFile; fileRef = 25F3FBB518B97643002BB17F /* UIImage+DecompressAndMap.m */; }; 26 | 25F3FBB918B98342002BB17F /* ABFastImageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 25F3FBB818B98342002BB17F /* ABFastImageCell.m */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXContainerItemProxy section */ 30 | 25F3FB9D18B96EC4002BB17F /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 25F3FB6F18B96EC4002BB17F /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 25F3FB7618B96EC4002BB17F; 35 | remoteInfo = ABImageMapping; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 25F3FB7718B96EC4002BB17F /* ABImageMapping.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ABImageMapping.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 25F3FB7A18B96EC4002BB17F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 42 | 25F3FB7C18B96EC4002BB17F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 43 | 25F3FB7E18B96EC4002BB17F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 44 | 25F3FB8218B96EC4002BB17F /* ABImageMapping-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ABImageMapping-Info.plist"; sourceTree = ""; }; 45 | 25F3FB8418B96EC4002BB17F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 46 | 25F3FB8618B96EC4002BB17F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 47 | 25F3FB8818B96EC4002BB17F /* ABImageMapping-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ABImageMapping-Prefix.pch"; sourceTree = ""; }; 48 | 25F3FB8918B96EC4002BB17F /* ABAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ABAppDelegate.h; sourceTree = ""; }; 49 | 25F3FB8A18B96EC4002BB17F /* ABAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ABAppDelegate.m; sourceTree = ""; }; 50 | 25F3FB8D18B96EC4002BB17F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 25F3FB8F18B96EC4002BB17F /* ABViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ABViewController.h; sourceTree = ""; }; 52 | 25F3FB9018B96EC4002BB17F /* ABViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ABViewController.m; sourceTree = ""; }; 53 | 25F3FB9218B96EC4002BB17F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 54 | 25F3FB9818B96EC4002BB17F /* ABImageMappingTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ABImageMappingTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 25F3FB9918B96EC4002BB17F /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 56 | 25F3FBA118B96EC4002BB17F /* ABImageMappingTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ABImageMappingTests-Info.plist"; sourceTree = ""; }; 57 | 25F3FBA318B96EC4002BB17F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 58 | 25F3FBA518B96EC4002BB17F /* ABImageMappingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ABImageMappingTests.m; sourceTree = ""; }; 59 | 25F3FBAF18B9705D002BB17F /* Demo Images */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Demo Images"; sourceTree = SOURCE_ROOT; }; 60 | 25F3FBB418B97643002BB17F /* UIImage+DecompressAndMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+DecompressAndMap.h"; sourceTree = SOURCE_ROOT; }; 61 | 25F3FBB518B97643002BB17F /* UIImage+DecompressAndMap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+DecompressAndMap.m"; sourceTree = SOURCE_ROOT; }; 62 | 25F3FBB718B98342002BB17F /* ABFastImageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABFastImageCell.h; sourceTree = ""; }; 63 | 25F3FBB818B98342002BB17F /* ABFastImageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ABFastImageCell.m; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 25F3FB7418B96EC4002BB17F /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 25F3FB7D18B96EC4002BB17F /* CoreGraphics.framework in Frameworks */, 72 | 25F3FB7F18B96EC4002BB17F /* UIKit.framework in Frameworks */, 73 | 25F3FB7B18B96EC4002BB17F /* Foundation.framework in Frameworks */, 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | 25F3FB9518B96EC4002BB17F /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | 25F3FB9A18B96EC4002BB17F /* XCTest.framework in Frameworks */, 82 | 25F3FB9C18B96EC4002BB17F /* UIKit.framework in Frameworks */, 83 | 25F3FB9B18B96EC4002BB17F /* Foundation.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 25F3FB6E18B96EC4002BB17F = { 91 | isa = PBXGroup; 92 | children = ( 93 | 25F3FB8018B96EC4002BB17F /* ABImageMapping */, 94 | 25F3FB9F18B96EC4002BB17F /* ABImageMappingTests */, 95 | 25F3FB7918B96EC4002BB17F /* Frameworks */, 96 | 25F3FB7818B96EC4002BB17F /* Products */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | 25F3FB7818B96EC4002BB17F /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 25F3FB7718B96EC4002BB17F /* ABImageMapping.app */, 104 | 25F3FB9818B96EC4002BB17F /* ABImageMappingTests.xctest */, 105 | ); 106 | name = Products; 107 | sourceTree = ""; 108 | }; 109 | 25F3FB7918B96EC4002BB17F /* Frameworks */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 25F3FB7A18B96EC4002BB17F /* Foundation.framework */, 113 | 25F3FB7C18B96EC4002BB17F /* CoreGraphics.framework */, 114 | 25F3FB7E18B96EC4002BB17F /* UIKit.framework */, 115 | 25F3FB9918B96EC4002BB17F /* XCTest.framework */, 116 | ); 117 | name = Frameworks; 118 | sourceTree = ""; 119 | }; 120 | 25F3FB8018B96EC4002BB17F /* ABImageMapping */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 25F3FBB418B97643002BB17F /* UIImage+DecompressAndMap.h */, 124 | 25F3FBB518B97643002BB17F /* UIImage+DecompressAndMap.m */, 125 | 25F3FB8918B96EC4002BB17F /* ABAppDelegate.h */, 126 | 25F3FB8A18B96EC4002BB17F /* ABAppDelegate.m */, 127 | 25F3FB8C18B96EC4002BB17F /* Main.storyboard */, 128 | 25F3FB8F18B96EC4002BB17F /* ABViewController.h */, 129 | 25F3FB9018B96EC4002BB17F /* ABViewController.m */, 130 | 25F3FBB718B98342002BB17F /* ABFastImageCell.h */, 131 | 25F3FBB818B98342002BB17F /* ABFastImageCell.m */, 132 | 25F3FB9218B96EC4002BB17F /* Images.xcassets */, 133 | 25F3FBAF18B9705D002BB17F /* Demo Images */, 134 | 25F3FB8118B96EC4002BB17F /* Supporting Files */, 135 | ); 136 | path = ABImageMapping; 137 | sourceTree = ""; 138 | }; 139 | 25F3FB8118B96EC4002BB17F /* Supporting Files */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 25F3FB8218B96EC4002BB17F /* ABImageMapping-Info.plist */, 143 | 25F3FB8318B96EC4002BB17F /* InfoPlist.strings */, 144 | 25F3FB8618B96EC4002BB17F /* main.m */, 145 | 25F3FB8818B96EC4002BB17F /* ABImageMapping-Prefix.pch */, 146 | ); 147 | name = "Supporting Files"; 148 | sourceTree = ""; 149 | }; 150 | 25F3FB9F18B96EC4002BB17F /* ABImageMappingTests */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 25F3FBA518B96EC4002BB17F /* ABImageMappingTests.m */, 154 | 25F3FBA018B96EC4002BB17F /* Supporting Files */, 155 | ); 156 | path = ABImageMappingTests; 157 | sourceTree = ""; 158 | }; 159 | 25F3FBA018B96EC4002BB17F /* Supporting Files */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 25F3FBA118B96EC4002BB17F /* ABImageMappingTests-Info.plist */, 163 | 25F3FBA218B96EC4002BB17F /* InfoPlist.strings */, 164 | ); 165 | name = "Supporting Files"; 166 | sourceTree = ""; 167 | }; 168 | /* End PBXGroup section */ 169 | 170 | /* Begin PBXNativeTarget section */ 171 | 25F3FB7618B96EC4002BB17F /* ABImageMapping */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = 25F3FBA918B96EC4002BB17F /* Build configuration list for PBXNativeTarget "ABImageMapping" */; 174 | buildPhases = ( 175 | 25F3FB7318B96EC4002BB17F /* Sources */, 176 | 25F3FB7418B96EC4002BB17F /* Frameworks */, 177 | 25F3FB7518B96EC4002BB17F /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | ); 183 | name = ABImageMapping; 184 | productName = ABImageMapping; 185 | productReference = 25F3FB7718B96EC4002BB17F /* ABImageMapping.app */; 186 | productType = "com.apple.product-type.application"; 187 | }; 188 | 25F3FB9718B96EC4002BB17F /* ABImageMappingTests */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = 25F3FBAC18B96EC4002BB17F /* Build configuration list for PBXNativeTarget "ABImageMappingTests" */; 191 | buildPhases = ( 192 | 25F3FB9418B96EC4002BB17F /* Sources */, 193 | 25F3FB9518B96EC4002BB17F /* Frameworks */, 194 | 25F3FB9618B96EC4002BB17F /* Resources */, 195 | ); 196 | buildRules = ( 197 | ); 198 | dependencies = ( 199 | 25F3FB9E18B96EC4002BB17F /* PBXTargetDependency */, 200 | ); 201 | name = ABImageMappingTests; 202 | productName = ABImageMappingTests; 203 | productReference = 25F3FB9818B96EC4002BB17F /* ABImageMappingTests.xctest */; 204 | productType = "com.apple.product-type.bundle.unit-test"; 205 | }; 206 | /* End PBXNativeTarget section */ 207 | 208 | /* Begin PBXProject section */ 209 | 25F3FB6F18B96EC4002BB17F /* Project object */ = { 210 | isa = PBXProject; 211 | attributes = { 212 | CLASSPREFIX = AB; 213 | LastUpgradeCheck = 0510; 214 | ORGANIZATIONNAME = "Codeless Solutions"; 215 | TargetAttributes = { 216 | 25F3FB7618B96EC4002BB17F = { 217 | DevelopmentTeam = U9FF7SJK5F; 218 | }; 219 | 25F3FB9718B96EC4002BB17F = { 220 | TestTargetID = 25F3FB7618B96EC4002BB17F; 221 | }; 222 | }; 223 | }; 224 | buildConfigurationList = 25F3FB7218B96EC4002BB17F /* Build configuration list for PBXProject "ABImageMapping" */; 225 | compatibilityVersion = "Xcode 3.2"; 226 | developmentRegion = English; 227 | hasScannedForEncodings = 0; 228 | knownRegions = ( 229 | en, 230 | Base, 231 | ); 232 | mainGroup = 25F3FB6E18B96EC4002BB17F; 233 | productRefGroup = 25F3FB7818B96EC4002BB17F /* Products */; 234 | projectDirPath = ""; 235 | projectRoot = ""; 236 | targets = ( 237 | 25F3FB7618B96EC4002BB17F /* ABImageMapping */, 238 | 25F3FB9718B96EC4002BB17F /* ABImageMappingTests */, 239 | ); 240 | }; 241 | /* End PBXProject section */ 242 | 243 | /* Begin PBXResourcesBuildPhase section */ 244 | 25F3FB7518B96EC4002BB17F /* Resources */ = { 245 | isa = PBXResourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | 25F3FB9318B96EC4002BB17F /* Images.xcassets in Resources */, 249 | 25F3FB8518B96EC4002BB17F /* InfoPlist.strings in Resources */, 250 | 25F3FBB018B9705D002BB17F /* Demo Images in Resources */, 251 | 25F3FB8E18B96EC4002BB17F /* Main.storyboard in Resources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | 25F3FB9618B96EC4002BB17F /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | 25F3FBA418B96EC4002BB17F /* InfoPlist.strings in Resources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXResourcesBuildPhase section */ 264 | 265 | /* Begin PBXSourcesBuildPhase section */ 266 | 25F3FB7318B96EC4002BB17F /* Sources */ = { 267 | isa = PBXSourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | 25F3FB8718B96EC4002BB17F /* main.m in Sources */, 271 | 25F3FB9118B96EC4002BB17F /* ABViewController.m in Sources */, 272 | 25F3FB8B18B96EC4002BB17F /* ABAppDelegate.m in Sources */, 273 | 25F3FBB918B98342002BB17F /* ABFastImageCell.m in Sources */, 274 | 25F3FBB618B97643002BB17F /* UIImage+DecompressAndMap.m in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 25F3FB9418B96EC4002BB17F /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 25F3FBA618B96EC4002BB17F /* ABImageMappingTests.m in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | /* End PBXSourcesBuildPhase section */ 287 | 288 | /* Begin PBXTargetDependency section */ 289 | 25F3FB9E18B96EC4002BB17F /* PBXTargetDependency */ = { 290 | isa = PBXTargetDependency; 291 | target = 25F3FB7618B96EC4002BB17F /* ABImageMapping */; 292 | targetProxy = 25F3FB9D18B96EC4002BB17F /* PBXContainerItemProxy */; 293 | }; 294 | /* End PBXTargetDependency section */ 295 | 296 | /* Begin PBXVariantGroup section */ 297 | 25F3FB8318B96EC4002BB17F /* InfoPlist.strings */ = { 298 | isa = PBXVariantGroup; 299 | children = ( 300 | 25F3FB8418B96EC4002BB17F /* en */, 301 | ); 302 | name = InfoPlist.strings; 303 | sourceTree = ""; 304 | }; 305 | 25F3FB8C18B96EC4002BB17F /* Main.storyboard */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 25F3FB8D18B96EC4002BB17F /* Base */, 309 | ); 310 | name = Main.storyboard; 311 | sourceTree = ""; 312 | }; 313 | 25F3FBA218B96EC4002BB17F /* InfoPlist.strings */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | 25F3FBA318B96EC4002BB17F /* en */, 317 | ); 318 | name = InfoPlist.strings; 319 | sourceTree = ""; 320 | }; 321 | /* End PBXVariantGroup section */ 322 | 323 | /* Begin XCBuildConfiguration section */ 324 | 25F3FBA718B96EC4002BB17F /* Debug */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 340 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 341 | COPY_PHASE_STRIP = NO; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_DYNAMIC_NO_PIC = NO; 344 | GCC_OPTIMIZATION_LEVEL = 0; 345 | GCC_PREPROCESSOR_DEFINITIONS = ( 346 | "DEBUG=1", 347 | "$(inherited)", 348 | ); 349 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 350 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 351 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 352 | GCC_WARN_UNDECLARED_SELECTOR = YES; 353 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 354 | GCC_WARN_UNUSED_FUNCTION = YES; 355 | GCC_WARN_UNUSED_VARIABLE = YES; 356 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 357 | ONLY_ACTIVE_ARCH = YES; 358 | SDKROOT = iphoneos; 359 | }; 360 | name = Debug; 361 | }; 362 | 25F3FBA818B96EC4002BB17F /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ALWAYS_SEARCH_USER_PATHS = NO; 366 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 367 | CLANG_CXX_LIBRARY = "libc++"; 368 | CLANG_ENABLE_MODULES = YES; 369 | CLANG_ENABLE_OBJC_ARC = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_CONSTANT_CONVERSION = YES; 372 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 373 | CLANG_WARN_EMPTY_BODY = YES; 374 | CLANG_WARN_ENUM_CONVERSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 377 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 378 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 379 | COPY_PHASE_STRIP = YES; 380 | ENABLE_NS_ASSERTIONS = NO; 381 | GCC_C_LANGUAGE_STANDARD = gnu99; 382 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 383 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 384 | GCC_WARN_UNDECLARED_SELECTOR = YES; 385 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 386 | GCC_WARN_UNUSED_FUNCTION = YES; 387 | GCC_WARN_UNUSED_VARIABLE = YES; 388 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 389 | SDKROOT = iphoneos; 390 | VALIDATE_PRODUCT = YES; 391 | }; 392 | name = Release; 393 | }; 394 | 25F3FBAA18B96EC4002BB17F /* Debug */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 398 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 399 | CODE_SIGN_IDENTITY = ""; 400 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 401 | GCC_PREFIX_HEADER = "ABImageMapping/ABImageMapping-Prefix.pch"; 402 | INFOPLIST_FILE = "ABImageMapping/ABImageMapping-Info.plist"; 403 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | PROVISIONING_PROFILE = "562900D6-9A7E-451B-8C79-EDC37E123D88"; 406 | TARGETED_DEVICE_FAMILY = "1,2"; 407 | WRAPPER_EXTENSION = app; 408 | }; 409 | name = Debug; 410 | }; 411 | 25F3FBAB18B96EC4002BB17F /* Release */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 415 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 416 | CODE_SIGN_IDENTITY = "iPhone Distribution: Anton Bukov (U9FF7SJK5F)"; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Anton Bukov (U9FF7SJK5F)"; 418 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 419 | GCC_PREFIX_HEADER = "ABImageMapping/ABImageMapping-Prefix.pch"; 420 | INFOPLIST_FILE = "ABImageMapping/ABImageMapping-Info.plist"; 421 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 422 | PRODUCT_NAME = "$(TARGET_NAME)"; 423 | PROVISIONING_PROFILE = "1D500251-FD41-45DD-91A5-31CE5EC1752D"; 424 | TARGETED_DEVICE_FAMILY = "1,2"; 425 | WRAPPER_EXTENSION = app; 426 | }; 427 | name = Release; 428 | }; 429 | 25F3FBAD18B96EC4002BB17F /* Debug */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ABImageMapping.app/ABImageMapping"; 433 | FRAMEWORK_SEARCH_PATHS = ( 434 | "$(SDKROOT)/Developer/Library/Frameworks", 435 | "$(inherited)", 436 | "$(DEVELOPER_FRAMEWORKS_DIR)", 437 | ); 438 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 439 | GCC_PREFIX_HEADER = "ABImageMapping/ABImageMapping-Prefix.pch"; 440 | GCC_PREPROCESSOR_DEFINITIONS = ( 441 | "DEBUG=1", 442 | "$(inherited)", 443 | ); 444 | INFOPLIST_FILE = "ABImageMappingTests/ABImageMappingTests-Info.plist"; 445 | PRODUCT_NAME = "$(TARGET_NAME)"; 446 | TEST_HOST = "$(BUNDLE_LOADER)"; 447 | WRAPPER_EXTENSION = xctest; 448 | }; 449 | name = Debug; 450 | }; 451 | 25F3FBAE18B96EC4002BB17F /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | buildSettings = { 454 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ABImageMapping.app/ABImageMapping"; 455 | FRAMEWORK_SEARCH_PATHS = ( 456 | "$(SDKROOT)/Developer/Library/Frameworks", 457 | "$(inherited)", 458 | "$(DEVELOPER_FRAMEWORKS_DIR)", 459 | ); 460 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 461 | GCC_PREFIX_HEADER = "ABImageMapping/ABImageMapping-Prefix.pch"; 462 | INFOPLIST_FILE = "ABImageMappingTests/ABImageMappingTests-Info.plist"; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | TEST_HOST = "$(BUNDLE_LOADER)"; 465 | WRAPPER_EXTENSION = xctest; 466 | }; 467 | name = Release; 468 | }; 469 | /* End XCBuildConfiguration section */ 470 | 471 | /* Begin XCConfigurationList section */ 472 | 25F3FB7218B96EC4002BB17F /* Build configuration list for PBXProject "ABImageMapping" */ = { 473 | isa = XCConfigurationList; 474 | buildConfigurations = ( 475 | 25F3FBA718B96EC4002BB17F /* Debug */, 476 | 25F3FBA818B96EC4002BB17F /* Release */, 477 | ); 478 | defaultConfigurationIsVisible = 0; 479 | defaultConfigurationName = Release; 480 | }; 481 | 25F3FBA918B96EC4002BB17F /* Build configuration list for PBXNativeTarget "ABImageMapping" */ = { 482 | isa = XCConfigurationList; 483 | buildConfigurations = ( 484 | 25F3FBAA18B96EC4002BB17F /* Debug */, 485 | 25F3FBAB18B96EC4002BB17F /* Release */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | defaultConfigurationName = Release; 489 | }; 490 | 25F3FBAC18B96EC4002BB17F /* Build configuration list for PBXNativeTarget "ABImageMappingTests" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | 25F3FBAD18B96EC4002BB17F /* Debug */, 494 | 25F3FBAE18B96EC4002BB17F /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | defaultConfigurationName = Release; 498 | }; 499 | /* End XCConfigurationList section */ 500 | }; 501 | rootObject = 25F3FB6F18B96EC4002BB17F /* Project object */; 502 | } 503 | --------------------------------------------------------------------------------