├── .gitignore ├── QuartzHelpLibrary ├── en.lproj │ ├── InfoPlist.strings │ ├── iossdkhack.jpg │ ├── iossdkhack.png │ ├── SelectTestViewController_iPad.xib │ ├── SelectTestViewController.xib │ ├── MainWindow.xib │ ├── MainWindow-iPad.xib │ ├── QuartzHelpLibraryViewController.xib │ └── QuartzHelpLibraryViewController_iPad.xib ├── Resources │ └── image │ │ ├── Default.png │ │ ├── icon57x57.png │ │ ├── icon72x72.png │ │ ├── Default@2x.png │ │ ├── icon114x114.png │ │ ├── Default-Landscape.png │ │ └── Default-Portrait.png ├── testImages │ ├── source_gray.psd │ ├── source_rgb.psd │ ├── testImage_Gray_PNG8.png │ ├── testImage_RGB_JPG24.jpg │ ├── testImage_RGB_PNG24.png │ ├── testImage_RGB_PNG8.png │ ├── testImage_Gray_JPG24.jpg │ ├── testImage_Gray_PNG24.png │ ├── testImage_Gray_PNG8Alpha.png │ ├── testImage_RGB_PNG24Alpha.png │ ├── testImage_Gray_PNG24Alpha.png │ └── rawForTest │ │ ├── testImage_RGB_PNG8.raw │ │ ├── testImage_Gray_JPG24.raw │ │ ├── testImage_Gray_PNG24.raw │ │ ├── testImage_Gray_PNG8.raw │ │ ├── testImage_RGB_JPG24.raw │ │ └── testImage_RGB_PNG24.raw ├── SelectTestViewController.h ├── SelectTestViewController_iPad.h ├── QuartzHelpLibrary-Prefix.pch ├── main.m ├── SelectTestViewController_iPad.m ├── QuartzHelpLibrary-Info.plist ├── Test │ ├── test.h │ ├── TestDrawCGImageFromGrayPixel.h │ ├── TestDrawCGImageFromRGBPixel.h │ ├── TestUIImageViewFromGrayPixel.h │ ├── TestUIImageViewFromRGBPixel.h │ ├── testImageOrientation.h │ ├── testTool.h │ ├── TestUIImageViewFromGrayPixel.m │ ├── TestDrawCGImageFromGrayPixel.m │ ├── TestDrawCGImageFromRGBPixel.m │ ├── TestUIImageViewFromRGBPixel.m │ ├── testTool.m │ ├── test.m │ └── testImageOrientation.m ├── TestViewControllers │ ├── UIViewController+test.h │ ├── ImageLoadTestViewController_iPad.m │ ├── OrientationTestViewController_iPad.m │ ├── ImageLoadTestViewController_iPad.h │ ├── UIViewController+test.m │ ├── OrientationTestViewController_iPad.h │ ├── OrientationResizeTestViewController.h │ ├── OrientationResizeTestViewController_iPad.m │ ├── OrientationResizeTestViewController_iPad.h │ ├── QuartzHelpLibraryViewController_iPad.h │ ├── QuartzHelpLibraryViewController.h │ ├── ImageLoadTestViewController.h │ ├── OrientationTestViewController.h │ ├── QuartzHelpLibraryViewController_iPad.m │ ├── OrientationResizeTestViewController.m │ ├── QuartzHelpLibraryViewController.m │ ├── ImageLoadTestViewController.m │ └── OrientationTestViewController.m ├── QuartzHelpLibraryAppDelegate.h ├── SelectTestViewController.m └── QuartzHelpLibraryAppDelegate.m ├── QuartzHelpLibrary.xcodeproj ├── xcuserdata │ └── sonson.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints.xcbkptlist │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── QuartzHelpLibrary.xcscheme └── project.xcworkspace │ └── contents.xcworkspacedata ├── LICENSE ├── QuartzHelpLibrary.h └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | ._* 3 | xcuserdata 4 | *~ 5 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/iossdkhack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/en.lproj/iossdkhack.jpg -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/iossdkhack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/en.lproj/iossdkhack.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/Resources/image/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/Resources/image/Default.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/source_gray.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/source_gray.psd -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/source_rgb.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/source_rgb.psd -------------------------------------------------------------------------------- /QuartzHelpLibrary/Resources/image/icon57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/Resources/image/icon57x57.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/Resources/image/icon72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/Resources/image/icon72x72.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/Resources/image/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/Resources/image/Default@2x.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/Resources/image/icon114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/Resources/image/icon114x114.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_Gray_PNG8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_Gray_PNG8.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_RGB_JPG24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_RGB_JPG24.jpg -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_RGB_PNG24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_RGB_PNG24.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_RGB_PNG8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_RGB_PNG8.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/Resources/image/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/Resources/image/Default-Landscape.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/Resources/image/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/Resources/image/Default-Portrait.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_Gray_JPG24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_Gray_JPG24.jpg -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_Gray_PNG24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_Gray_PNG24.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_Gray_PNG8Alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_Gray_PNG8Alpha.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_RGB_PNG24Alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_RGB_PNG24Alpha.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/testImage_Gray_PNG24Alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/testImage_Gray_PNG24Alpha.png -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/rawForTest/testImage_RGB_PNG8.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/rawForTest/testImage_RGB_PNG8.raw -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/rawForTest/testImage_Gray_JPG24.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/rawForTest/testImage_Gray_JPG24.raw -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/rawForTest/testImage_Gray_PNG24.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/rawForTest/testImage_Gray_PNG24.raw -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/rawForTest/testImage_Gray_PNG8.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/rawForTest/testImage_Gray_PNG8.raw -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/rawForTest/testImage_RGB_JPG24.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/rawForTest/testImage_RGB_JPG24.raw -------------------------------------------------------------------------------- /QuartzHelpLibrary/testImages/rawForTest/testImage_RGB_PNG24.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonsongithub/Quartz-Help-Library/HEAD/QuartzHelpLibrary/testImages/rawForTest/testImage_RGB_PNG24.raw -------------------------------------------------------------------------------- /QuartzHelpLibrary.xcodeproj/xcuserdata/sonson.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /QuartzHelpLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/SelectTestViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SelectTestViewController.h 3 | // QuartzHelpLibrary 4 | // 5 | // Created by sonson on 11/05/18. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface SelectTestViewController : UITableViewController { 13 | NSMutableArray *testNames; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/SelectTestViewController_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // SelectTestViewController_iPad.h 3 | // QuartzHelpLibrary 4 | // 5 | // Created by sonson on 11/05/18. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "SelectTestViewController.h" 10 | 11 | @interface SelectTestViewController_iPad : SelectTestViewController { 12 | 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/QuartzHelpLibrary-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'QuartzHelpLibrary' target in the 'QuartzHelpLibrary' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // QuartzHelpLibrary 4 | // 5 | // Created by sonson on 11/04/11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /QuartzHelpLibrary.xcodeproj/xcuserdata/sonson.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | QuartzHelpLibrary.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 148B5D851352DBBD000DB37B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/SelectTestViewController_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // SelectTestViewController_iPad.m 3 | // QuartzHelpLibrary 4 | // 5 | // Created by sonson on 11/05/18. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "SelectTestViewController_iPad.h" 10 | 11 | 12 | @implementation SelectTestViewController_iPad 13 | 14 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 15 | { 16 | NSString *className = [[testNames objectAtIndex:indexPath.row] stringByAppendingString:@"_iPad"]; 17 | Class targetClass = NSClassFromString(className); 18 | id con = [[targetClass alloc] initWithNibName:nil bundle:nil]; 19 | [self.navigationController pushViewController:con animated:YES]; 20 | [con release]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Quartz Help Library Copyright (c) 2011, Yuichi Yoshida All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the docume ntation and/or other materials provided with the distribution. - Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUD ING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN N O EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR C ONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR P ROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBI LITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /QuartzHelpLibrary/QuartzHelpLibrary-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIconFiles 14 | 15 | icon57x57.png 16 | icon114x114.png 17 | icon72x72.png 18 | 19 | CFBundleIdentifier 20 | com.sonson.${PRODUCT_NAME:rfc1034identifier} 21 | CFBundleInfoDictionaryVersion 22 | 6.0 23 | CFBundleName 24 | ${PRODUCT_NAME} 25 | CFBundlePackageType 26 | APPL 27 | CFBundleShortVersionString 28 | 1.0 29 | CFBundleSignature 30 | ???? 31 | CFBundleVersion 32 | 1.0 33 | LSRequiresIPhoneOS 34 | 35 | NSMainNibFile 36 | MainWindow 37 | NSMainNibFile~ipad 38 | MainWindow-iPad 39 | UILaunchImageFile~ipad 40 | Default 41 | UIPrerenderedIcon 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * test.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | void test(); -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/TestDrawCGImageFromGrayPixel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * TestDrawCGImageFromGrayPixel.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | 34 | @interface TestDrawCGImageFromGrayPixel : UIView { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/TestDrawCGImageFromRGBPixel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * TestDrawCGImageFromRGBPixel.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | 34 | @interface TestDrawCGImageFromRGBPixel : UIView { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/TestUIImageViewFromGrayPixel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * TestUIImageViewFromGrayPixel.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | 34 | @interface TestUIImageViewFromGrayPixel : UIView { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/TestUIImageViewFromRGBPixel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * TestUIImageViewFromRGBPixel.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | 34 | @interface TestUIImageViewFromRGBPixel : UIView { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/UIViewController+test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * UIViewController+test.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/28 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | 34 | @interface UIViewController(test) 35 | 36 | + (NSString*)testDescription; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/ImageLoadTestViewController_iPad.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * ImageLoadTestViewController_iPad.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "ImageLoadTestViewController_iPad.h" 32 | 33 | @implementation ImageLoadTestViewController_iPad 34 | @end 35 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/OrientationTestViewController_iPad.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * OrientationTestViewController_iPad.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "OrientationTestViewController_iPad.h" 32 | 33 | @implementation OrientationTestViewController_iPad 34 | @end 35 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/ImageLoadTestViewController_iPad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * ImageLoadTestViewController_iPad.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "ImageLoadTestViewController.h" 32 | 33 | @interface ImageLoadTestViewController_iPad : ImageLoadTestViewController { 34 | } 35 | @end 36 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/UIViewController+test.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * UIViewController+test.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/28 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "UIViewController+test.h" 32 | 33 | @implementation UIViewController(test) 34 | 35 | + (NSString*)testDescription { 36 | return @""; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/OrientationTestViewController_iPad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * OrientationTestViewController_iPad.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "OrientationTestViewController.h" 32 | 33 | @interface OrientationTestViewController_iPad : OrientationTestViewController { 34 | } 35 | @end 36 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/OrientationResizeTestViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * OrientationResizeTestViewController.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/06/01 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "OrientationTestViewController.h" 32 | 33 | @interface OrientationResizeTestViewController : OrientationTestViewController { 34 | } 35 | @end 36 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/OrientationResizeTestViewController_iPad.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * OrientationResizeTestViewController_iPad.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/06/01 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "OrientationResizeTestViewController_iPad.h" 32 | 33 | 34 | @implementation OrientationResizeTestViewController_iPad 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/OrientationResizeTestViewController_iPad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * OrientationResizeTestViewController_iPad.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/06/01 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "OrientationResizeTestViewController.h" 32 | 33 | 34 | @interface OrientationResizeTestViewController_iPad : OrientationResizeTestViewController { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/QuartzHelpLibraryViewController_iPad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * QuartzHelpLibraryViewController_iPad.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | #import "QuartzHelpLibraryViewController.h" 34 | 35 | 36 | @interface QuartzHelpLibraryViewController_iPad : QuartzHelpLibraryViewController { 37 | UIPopoverController *popOverController; 38 | } 39 | @end 40 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/testImageOrientation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * testImageOrientation.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | #define QH_ORIENTATION_TEST_WIDTH 48 34 | #define QH_ORIENTATION_TEST_HEIGHT 32 35 | #define QH_ORIENTATION_TEST_BYTES_PER_PIXEL 3 36 | 37 | void makeImage(unsigned char **pixel, int *width, int *height, int *bytesPerPixel, UIImageOrientation orientation); 38 | void testImageOrientation(); -------------------------------------------------------------------------------- /QuartzHelpLibrary/QuartzHelpLibraryAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * QuartzHelpLibraryAppDelegate.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | @class QuartzHelpLibraryViewController; 34 | 35 | @interface QuartzHelpLibraryAppDelegate : NSObject { 36 | } 37 | 38 | @property (nonatomic, retain) IBOutlet UIWindow *window; 39 | 40 | @property (nonatomic, retain) IBOutlet UIViewController *viewController; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/QuartzHelpLibraryViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * QuartzHelpLibraryViewController.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | @interface QuartzHelpLibraryViewController : UIViewController { 34 | IBOutlet UIImageView *imageView; 35 | UIImage *image; 36 | } 37 | @property (nonatomic, retain) UIImage *image; 38 | - (IBAction)openImagePicker:(id)sender; 39 | - (void)setBinarizedImageWithInfo:(NSDictionary *)info; 40 | @end 41 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/ImageLoadTestViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * ImageLoadTestViewController.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | @interface ImageLoadTestViewController : UIViewController { 34 | IBOutlet UIImageView *imageView01; 35 | IBOutlet UIImageView *imageView02; 36 | IBOutlet UIImageView *imageView03; 37 | IBOutlet UIImageView *imageView04; 38 | IBOutlet UIImageView *imageView05; 39 | IBOutlet UIImageView *imageView06; 40 | IBOutlet UIImageView *imageView07; 41 | IBOutlet UIImageView *imageView08; 42 | IBOutlet UIImageView *imageView09; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/testTool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * testTool.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/06/01 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | typedef enum { 34 | DUMP_PIXEL_HEX = 0, 35 | DUMP_PIXEL_DEC = 1 36 | }DUMP_PIXEL_FORMAT; 37 | 38 | int compareBuffers(unsigned char* b1, unsigned char *b2, int length, int tolerance); 39 | int compareBuffersWithXandY(unsigned char* b1, unsigned char *b2, int width, int height, int bytesPerPixel, int tolerance); 40 | void dumpPixel(unsigned char *pixel, int width, int height, int bytesPerPixel, int x, int y); 41 | void dumpPixelArray(unsigned char *pixel, int width, int height, int bytesPerPixel, DUMP_PIXEL_FORMAT type); 42 | NSString* makeFilePathInDocumentFolder(NSString *filename); -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/OrientationTestViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * OrientationTestViewController.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | 33 | @interface OrientationTestViewController : UIViewController { 34 | IBOutlet UIImageView *true_up; 35 | IBOutlet UIImageView *true_down; 36 | IBOutlet UIImageView *true_left; 37 | IBOutlet UIImageView *true_right; 38 | IBOutlet UIImageView *true_upMirrored; 39 | IBOutlet UIImageView *true_downMirrored; 40 | IBOutlet UIImageView *true_leftMirrored; 41 | IBOutlet UIImageView *true_rightMirrored; 42 | 43 | IBOutlet UIImageView *up; 44 | IBOutlet UIImageView *down; 45 | IBOutlet UIImageView *left; 46 | IBOutlet UIImageView *right; 47 | IBOutlet UIImageView *upMirrored; 48 | IBOutlet UIImageView *downMirrored; 49 | IBOutlet UIImageView *leftMirrored; 50 | IBOutlet UIImageView *rightMirrored; 51 | } 52 | @end 53 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/SelectTestViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SelectTestViewController.m 3 | // QuartzHelpLibrary 4 | // 5 | // Created by sonson on 11/05/18. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "SelectTestViewController.h" 10 | 11 | #import "QuartzHelpLibraryViewController.h" 12 | 13 | #import "UIViewController+test.h" 14 | 15 | @implementation SelectTestViewController 16 | 17 | - (void)dealloc 18 | { 19 | [testNames release]; 20 | [super dealloc]; 21 | } 22 | 23 | #pragma mark - View lifecycle 24 | 25 | - (void)viewDidLoad 26 | { 27 | [super viewDidLoad]; 28 | 29 | if (testNames == nil) { 30 | testNames = [[NSMutableArray array] retain]; 31 | [testNames addObject:@"QuartzHelpLibraryViewController"]; 32 | [testNames addObject:@"ImageLoadTestViewController"]; 33 | [testNames addObject:@"OrientationTestViewController"]; 34 | [testNames addObject:@"OrientationResizeTestViewController"]; 35 | } 36 | } 37 | 38 | - (void)viewWillAppear:(BOOL)animated 39 | { 40 | [super viewWillAppear:animated]; 41 | [self setTitle:NSLocalizedString(@"Select test", nil)]; 42 | } 43 | #pragma mark - Table view data source 44 | 45 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 46 | { 47 | // Return the number of sections. 48 | return 1; 49 | } 50 | 51 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 52 | { 53 | // Return the number of rows in the section. 54 | return [testNames count]; 55 | } 56 | 57 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 58 | { 59 | static NSString *CellIdentifier = @"Cell"; 60 | 61 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 62 | if (cell == nil) { 63 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 64 | } 65 | 66 | // Configure the cell... 67 | 68 | NSString *className = [testNames objectAtIndex:indexPath.row]; 69 | Class targetClass = NSClassFromString(className); 70 | 71 | [cell.textLabel setText:[targetClass testDescription]]; 72 | [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; 73 | 74 | return cell; 75 | } 76 | 77 | #pragma mark - Table view delegate 78 | 79 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 80 | { 81 | NSString *className = [testNames objectAtIndex:indexPath.row]; 82 | Class targetClass = NSClassFromString(className); 83 | id con = [[targetClass alloc] initWithNibName:nil bundle:nil]; 84 | [self.navigationController pushViewController:con animated:YES]; 85 | [con release]; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /QuartzHelpLibrary.xcodeproj/xcuserdata/sonson.xcuserdatad/xcschemes/QuartzHelpLibrary.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/QuartzHelpLibraryViewController_iPad.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * QuartzHelpLibraryViewController_iPad.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "QuartzHelpLibraryViewController_iPad.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | @implementation QuartzHelpLibraryViewController_iPad 36 | 37 | - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController { 38 | [popoverController autorelease]; 39 | } 40 | 41 | - (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController { 42 | return YES; 43 | } 44 | 45 | - (IBAction)openImagePicker:(id)sender { 46 | UIImagePickerController *controller = [[UIImagePickerController alloc] init]; 47 | [controller setDelegate:self]; 48 | 49 | if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { 50 | [controller setSourceType:UIImagePickerControllerSourceTypeCamera]; 51 | } 52 | 53 | Class UIPopoverControllerClass = NSClassFromString(@"UIPopoverController"); 54 | if (UIPopoverControllerClass) { 55 | popOverController = [[UIPopoverControllerClass alloc] initWithContentViewController:controller]; 56 | [popOverController presentPopoverFromRect:((UIButton*)sender).frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 57 | [popOverController setDelegate:self]; 58 | } 59 | [controller release]; 60 | } 61 | 62 | - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 63 | [self setBinarizedImageWithInfo:info]; 64 | [popOverController dismissPopoverAnimated:YES]; 65 | } 66 | 67 | - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { 68 | [popOverController dismissPopoverAnimated:YES]; 69 | } 70 | 71 | - (void)dealloc { 72 | [super dealloc]; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/TestUIImageViewFromGrayPixel.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * TestUIImageViewFromGrayPixel.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "TestUIImageViewFromGrayPixel.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | @implementation TestUIImageViewFromGrayPixel 36 | 37 | - (void)addImage { 38 | 39 | // original pixel data 40 | int originalWidth = 32; 41 | int originalHeight = 32; 42 | unsigned char* original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight); 43 | 44 | // make test pattern 45 | for (int y = 0; y < originalHeight; y++) { 46 | for (int x = 0; x < originalWidth; x++) { 47 | if (y <= originalHeight / 2 && x <= originalWidth / 2) { 48 | original[y * originalWidth + x] = 0; 49 | } 50 | if (y <= originalHeight / 2 && x > originalWidth / 2) { 51 | original[y * originalWidth + x] = 85; 52 | } 53 | if (y > originalHeight / 2 && x <= originalWidth / 2) { 54 | original[y * originalWidth + x] = 170; 55 | } 56 | if (y > originalHeight / 2 && x > originalWidth / 2) { 57 | original[y * originalWidth + x] = 255; 58 | } 59 | } 60 | } 61 | 62 | CGImageRef image = CGImageCreateWithPixelBuffer(original, originalWidth, originalHeight, QH_BYTES_PER_PIXEL_8BIT, QH_PIXEL_GRAYSCALE); 63 | 64 | UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithCGImage:image]]; 65 | [self addSubview:imageView]; 66 | [imageView release]; 67 | 68 | CGImageRelease(image); 69 | } 70 | 71 | - (id)initWithFrame:(CGRect)frame { 72 | self = [super initWithFrame:frame]; 73 | if (self) { 74 | [self addImage]; 75 | } 76 | return self; 77 | } 78 | 79 | - (id)initWithCoder:(NSCoder *)coder { 80 | self = [super initWithCoder:coder]; 81 | if (self) { 82 | [self addImage]; 83 | } 84 | return self; 85 | } 86 | 87 | - (void)dealloc { 88 | [super dealloc]; 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/TestDrawCGImageFromGrayPixel.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * TestDrawCGImageFromGrayPixel.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "TestDrawCGImageFromGrayPixel.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | @implementation TestDrawCGImageFromGrayPixel 36 | 37 | - (id)initWithFrame:(CGRect)frame 38 | { 39 | self = [super initWithFrame:frame]; 40 | if (self) { 41 | // Initialization code 42 | } 43 | return self; 44 | } 45 | 46 | - (void)makeAndDrawGrayPixels { 47 | CGContextRef context = UIGraphicsGetCurrentContext(); 48 | 49 | // original pixel data 50 | int originalWidth = 32; 51 | int originalHeight = 32; 52 | unsigned char* original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight); 53 | 54 | // make test pattern 55 | for (int y = 0; y < originalHeight; y++) { 56 | for (int x = 0; x < originalWidth; x++) { 57 | if (y <= originalHeight / 2 && x <= originalWidth / 2) { 58 | original[y * originalWidth + x] = 0; 59 | } 60 | if (y <= originalHeight / 2 && x > originalWidth / 2) { 61 | original[y * originalWidth + x] = 85; 62 | } 63 | if (y > originalHeight / 2 && x <= originalWidth / 2) { 64 | original[y * originalWidth + x] = 170; 65 | } 66 | if (y > originalHeight / 2 && x > originalWidth / 2) { 67 | original[y * originalWidth + x] = 255; 68 | } 69 | } 70 | } 71 | 72 | CGImageRef image = CGImageCreateWithPixelBuffer(original, originalWidth, originalHeight, QH_BYTES_PER_PIXEL_8BIT, QH_PIXEL_GRAYSCALE); 73 | 74 | // CGImage is inverted, vertically 75 | CGContextTranslateCTM(context, 0, originalHeight); 76 | CGContextScaleCTM(context, 1, -1); 77 | CGContextDrawImage(context, CGRectMake(0, 0, originalWidth, originalHeight), image); 78 | } 79 | 80 | - (void)drawRect:(CGRect)rect { 81 | [self makeAndDrawGrayPixels]; 82 | } 83 | 84 | - (void)dealloc { 85 | [super dealloc]; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /QuartzHelpLibrary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * QuartzHelpLibrary.h 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import 32 | #import 33 | 34 | #pragma mark - Invaliables 35 | 36 | typedef enum { 37 | QH_PIXEL_GRAYSCALE = 0, 38 | QH_PIXEL_COLOR = 1 << 0, 39 | QH_PIXEL_ANYCOLOR = 1 << 1, 40 | }QH_PIXEL_TYPE; 41 | 42 | typedef enum { 43 | QH_BYTES_PER_PIXEL_UNKNOWN = 0, 44 | QH_BYTES_PER_PIXEL_8BIT = 1, 45 | QH_BYTES_PER_PIXEL_16BIT = 2, 46 | QH_BYTES_PER_PIXEL_24BIT = 3, 47 | QH_BYTES_PER_PIXEL_32BIT = 4, 48 | }QH_BYTES_PER_PIXEL; 49 | 50 | #define QH_DEFAULT_ALPHA_VALUE 0xff 51 | 52 | #define QH_DEFAULT_JPG_QUALITY 1.0 53 | 54 | #pragma mark - UIImage category 55 | 56 | @interface UIImage(QuartzHelpLibrary) 57 | - (NSData*)PNGRepresentaion; 58 | - (NSData*)JPEGRepresentaion; 59 | - (NSData*)JPEGRepresentaionWithCompressionQuality:(float)compressionQuality; 60 | - (UIImage*)getRotatedImage; 61 | - (UIImage*)getRotatedImageWithResizing:(float)scale; 62 | - (CGImageRef)createCGImageRotated; 63 | - (CGImageRef)createCGImageRotatedWithResizing:(float)scale; 64 | @end 65 | 66 | #ifdef __cplusplus 67 | extern "C" { 68 | #endif 69 | 70 | #pragma mark - Load image file 71 | 72 | CGImageRef CGImageCreateWithPNGorJPEGFilePath(CFStringRef filePath); 73 | 74 | #pragma mark - Dump CGImage information 75 | 76 | void CGImageDumpImageInformation(CGImageRef imageRef); 77 | 78 | #pragma mark - Read pixel from CGImage 79 | 80 | void CGCreatePixelBufferWithImage(CGImageRef imageRef, unsigned char **pixel, int *width, int *height, int *bytesPerPixel, QH_PIXEL_TYPE pType); 81 | 82 | #pragma mark - Creating CGImage 83 | 84 | CGImageRef CGImageCreateWithPixelBuffer(unsigned char *pixel, int width, int height, int bytesPerPixel, QH_PIXEL_TYPE target_pType); 85 | 86 | #pragma mark - Convert CGImage to image file binary 87 | 88 | NSData* CGImageGetPNGPresentation(CGImageRef imageRef); 89 | NSData* CGImageGetJPEGPresentation(CGImageRef imageRef); 90 | 91 | #pragma mark - Resize 92 | 93 | CGImageRef CGImageCreateWithResizing(CGImageRef imageRef, float scale); 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/OrientationResizeTestViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * OrientationResizeTestViewController.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/06/01 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "OrientationResizeTestViewController.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | #import "testImageOrientation.h" 35 | 36 | @implementation OrientationResizeTestViewController 37 | 38 | + (NSString*)testDescription { 39 | return NSLocalizedString(@"UIImage orientation and resize", nil); 40 | } 41 | 42 | - (void)showImage { 43 | int width = QH_ORIENTATION_TEST_WIDTH; 44 | int height = QH_ORIENTATION_TEST_HEIGHT; 45 | int bytesPerPixel = QH_ORIENTATION_TEST_BYTES_PER_PIXEL; 46 | unsigned char *pixel = NULL; 47 | 48 | makeImage(&pixel, &width, &height, &bytesPerPixel, UIImageOrientationUp); 49 | CGImageRef source = CGImageCreateWithPixelBuffer(pixel, width, height, bytesPerPixel, QH_PIXEL_COLOR); 50 | free(pixel); 51 | 52 | int rot[8]; 53 | { 54 | int *p = rot; 55 | *p++ = UIImageOrientationUp; 56 | *p++ = UIImageOrientationUpMirrored; 57 | *p++ = UIImageOrientationDown; 58 | *p++ = UIImageOrientationDownMirrored; 59 | *p++ = UIImageOrientationLeft; 60 | *p++ = UIImageOrientationLeftMirrored; 61 | *p++ = UIImageOrientationRight; 62 | *p++ = UIImageOrientationRightMirrored; 63 | } 64 | 65 | UIImageView *trueImageViews[8]; 66 | { 67 | UIImageView **p = trueImageViews; 68 | *p++ = true_up; 69 | *p++ = true_upMirrored; 70 | *p++ = true_down; 71 | *p++ = true_downMirrored; 72 | *p++ = true_left; 73 | *p++ = true_leftMirrored; 74 | *p++ = true_right; 75 | *p++ = true_rightMirrored; 76 | } 77 | 78 | UIImageView *testImageViews[8]; 79 | { 80 | UIImageView **p = testImageViews; 81 | *p++ = up; 82 | *p++ = upMirrored; 83 | *p++ = down; 84 | *p++ = downMirrored; 85 | *p++ = left; 86 | *p++ = leftMirrored; 87 | *p++ = right; 88 | *p++ = rightMirrored; 89 | } 90 | 91 | for (int i = 0; i < 8; i++) { 92 | UIImage *image = [UIImage imageWithCGImage:source scale:1 orientation:rot[i]]; 93 | [trueImageViews[i] setImage:image]; 94 | [testImageViews[i] setImage:[image getRotatedImageWithResizing:0.5]]; 95 | } 96 | 97 | CGImageRelease(source); 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/TestDrawCGImageFromRGBPixel.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * TestDrawCGImageFromRGBPixel.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "TestDrawCGImageFromRGBPixel.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | @implementation TestDrawCGImageFromRGBPixel 36 | 37 | - (id)initWithFrame:(CGRect)frame { 38 | self = [super initWithFrame:frame]; 39 | if (self) { 40 | // Initialization code 41 | } 42 | return self; 43 | } 44 | 45 | - (void)makeAndDrawRGBPixels { 46 | CGContextRef context = UIGraphicsGetCurrentContext(); 47 | 48 | // original pixel data 49 | int originalWidth = 32; 50 | int originalHeight = 32; 51 | unsigned char* original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight * 3); 52 | 53 | // make test pattern 54 | for (int x = 0; x < originalWidth; x++) { 55 | for (int y = 0; y < originalHeight; y++) { 56 | if (y <= originalHeight / 2 && x <= originalWidth / 2) { 57 | original[y * originalWidth * 3 + x * 3 + 0] = 255; 58 | original[y * originalWidth * 3 + x * 3 + 1] = 0; 59 | original[y * originalWidth * 3 + x * 3 + 2] = 0; 60 | } 61 | else if (y <= originalHeight / 2 && x > originalWidth / 2) { 62 | original[y * originalWidth * 3 + x * 3 + 0] = 0; 63 | original[y * originalWidth * 3 + x * 3 + 1] = 255; 64 | original[y * originalWidth * 3 + x * 3 + 2] = 0; 65 | } 66 | else if (y > originalHeight / 2 && x <= originalWidth / 2) { 67 | original[y * originalWidth * 3 + x * 3 + 0] = 0; 68 | original[y * originalWidth * 3 + x * 3 + 1] = 0; 69 | original[y * originalWidth * 3 + x * 3 + 2] = 255; 70 | } 71 | else if (y > originalHeight / 2 && x > originalWidth / 2) { 72 | original[y * originalWidth * 3 + x * 3 + 0] = 255; 73 | original[y * originalWidth * 3 + x * 3 + 1] = 255; 74 | original[y * originalWidth * 3 + x * 3 + 2] = 255; 75 | } 76 | } 77 | } 78 | 79 | CGImageRef image = CGImageCreateWithPixelBuffer(original, originalWidth, originalHeight, QH_BYTES_PER_PIXEL_24BIT, QH_PIXEL_COLOR); 80 | 81 | // CGImage is inverted, vertically 82 | CGContextTranslateCTM(context, 0, originalHeight); 83 | CGContextScaleCTM(context, 1, -1); 84 | CGContextDrawImage(context, CGRectMake(0, 0, originalWidth, originalHeight), image); 85 | } 86 | 87 | - (void)drawRect:(CGRect)rect { 88 | // Drawing code 89 | [self makeAndDrawRGBPixels]; 90 | } 91 | 92 | - (void)dealloc { 93 | [super dealloc]; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/TestUIImageViewFromRGBPixel.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * TestUIImageViewFromRGBPixel.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "TestUIImageViewFromRGBPixel.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | @implementation TestUIImageViewFromRGBPixel 36 | 37 | - (void)addImage { 38 | 39 | // original pixel data 40 | int originalWidth = 32; 41 | int originalHeight = 32; 42 | unsigned char* original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight * 3); 43 | 44 | // make test pattern 45 | for (int x = 0; x < originalWidth; x++) { 46 | for (int y = 0; y < originalHeight; y++) { 47 | if (y <= originalHeight / 2 && x <= originalWidth / 2) { 48 | original[y * originalWidth * 3 + x * 3 + 0] = 255; 49 | original[y * originalWidth * 3 + x * 3 + 1] = 0; 50 | original[y * originalWidth * 3 + x * 3 + 2] = 0; 51 | } 52 | else if (y <= originalHeight / 2 && x > originalWidth / 2) { 53 | original[y * originalWidth * 3 + x * 3 + 0] = 0; 54 | original[y * originalWidth * 3 + x * 3 + 1] = 255; 55 | original[y * originalWidth * 3 + x * 3 + 2] = 0; 56 | } 57 | else if (y > originalHeight / 2 && x <= originalWidth / 2) { 58 | original[y * originalWidth * 3 + x * 3 + 0] = 0; 59 | original[y * originalWidth * 3 + x * 3 + 1] = 0; 60 | original[y * originalWidth * 3 + x * 3 + 2] = 255; 61 | } 62 | else if (y > originalHeight / 2 && x > originalWidth / 2) { 63 | original[y * originalWidth * 3 + x * 3 + 0] = 255; 64 | original[y * originalWidth * 3 + x * 3 + 1] = 255; 65 | original[y * originalWidth * 3 + x * 3 + 2] = 255; 66 | } 67 | } 68 | } 69 | 70 | CGImageRef image = CGImageCreateWithPixelBuffer(original, originalWidth, originalHeight, QH_BYTES_PER_PIXEL_24BIT, QH_PIXEL_COLOR); 71 | 72 | UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithCGImage:image]]; 73 | [self addSubview:imageView]; 74 | [imageView release]; 75 | 76 | CGImageRelease(image); 77 | } 78 | 79 | - (id)initWithFrame:(CGRect)frame { 80 | self = [super initWithFrame:frame]; 81 | if (self) { 82 | [self addImage]; 83 | } 84 | return self; 85 | } 86 | 87 | - (id)initWithCoder:(NSCoder *)coder { 88 | self = [super initWithCoder:coder]; 89 | if (self) { 90 | [self addImage]; 91 | } 92 | return self; 93 | } 94 | 95 | - (void)dealloc { 96 | [super dealloc]; 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/testTool.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * testTool.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/06/01 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "testTool.h" 32 | 33 | #pragma mark - help tool 34 | 35 | int compareBuffers(unsigned char* b1, unsigned char *b2, int length, int tolerance) { 36 | for (int i = 0; i < length; i++) { 37 | if (abs(*(b1 + i) - *(b2 + i)) > tolerance) { 38 | printf("diff = %d (%02X) (%02X)\n", *(b1 + i) - *(b2 + i), *(b1 + i), *(b2 + i)); 39 | return 0; 40 | } 41 | } 42 | return 1; 43 | } 44 | 45 | int compareBuffersWithXandY(unsigned char* b1, unsigned char *b2, int width, int height, int bytesPerPixel, int tolerance) { 46 | for (int y = 0; y < height; y++) { 47 | for (int x = 0; x < width; x++) { 48 | for (int i = 0; i < bytesPerPixel; i++) { 49 | int offset = (y * width + x) * bytesPerPixel + i; 50 | unsigned char v1 = *(b1 + offset); 51 | unsigned char v2 = *(b2 + offset); 52 | if (abs(v1 - v2) > tolerance) { 53 | printf("%d,%d(%d)....%02x vs %02x\n", x, y, i, v1, v2); 54 | return 0; 55 | } 56 | } 57 | } 58 | } 59 | return 1; 60 | } 61 | 62 | void dumpPixel(unsigned char *pixel, int width, int height, int bytesPerPixel, int x, int y) { 63 | for (int i = 0; i < bytesPerPixel; i++) { 64 | int offset = (y * width + x) * bytesPerPixel + i; 65 | printf("%02x", pixel[offset]); 66 | } 67 | printf("\n"); 68 | } 69 | 70 | void dumpPixelArray(unsigned char *pixel, int width, int height, int bytesPerPixel, DUMP_PIXEL_FORMAT type) { 71 | // make test pattern 72 | if (type == DUMP_PIXEL_HEX) { 73 | for (int y = 0; y < height; y++) { 74 | for (int x = 0; x < width; x++) { 75 | for (int i = 0; i < bytesPerPixel; i++) { 76 | printf("%02x", pixel[y * width * bytesPerPixel + x * bytesPerPixel + i]); 77 | } 78 | printf(" "); 79 | } 80 | printf("\n"); 81 | } 82 | } 83 | else { 84 | for (int y = 0; y < height; y++) { 85 | for (int x = 0; x < width/2; x++) { 86 | for (int i = 0; i < bytesPerPixel; i++) { 87 | printf("%03d", pixel[y * width * bytesPerPixel + x * bytesPerPixel + i]); 88 | } 89 | printf(" "); 90 | } 91 | printf("\n"); 92 | } 93 | } 94 | } 95 | 96 | NSString* makeFilePathInDocumentFolder(NSString *filename) { 97 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 98 | NSString *documentsDirectory = [paths objectAtIndex:0]; 99 | return [documentsDirectory stringByAppendingPathComponent:filename]; 100 | } 101 | 102 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/QuartzHelpLibraryViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * QuartzHelpLibraryViewController.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "QuartzHelpLibraryViewController.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | @implementation QuartzHelpLibraryViewController 36 | 37 | @synthesize image; 38 | 39 | + (NSString*)testDescription { 40 | return NSLocalizedString(@"Image picker", nil); 41 | } 42 | 43 | - (void)viewWillAppear:(BOOL)animated 44 | { 45 | [super viewWillAppear:animated]; 46 | [self setTitle:[[self class] testDescription]]; 47 | } 48 | 49 | - (IBAction)openImagePicker:(id)sender { 50 | 51 | UIImagePickerController *controller = [[UIImagePickerController alloc] init]; 52 | [controller setDelegate:self]; 53 | 54 | if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { 55 | [controller setSourceType:UIImagePickerControllerSourceTypeCamera]; 56 | } 57 | 58 | [self presentModalViewController:controller animated:YES]; 59 | [controller release]; 60 | } 61 | 62 | - (void)setBinarizedImageWithInfo:(NSDictionary *)info { 63 | UIImage *cameraImage = [info objectForKey:UIImagePickerControllerOriginalImage]; 64 | 65 | int copiedWidth = 0; 66 | int copiedHeight = 0; 67 | int copiedBytesPerPixel = 0; 68 | unsigned char *copiedPixel = NULL; 69 | 70 | CGCreatePixelBufferWithImage([cameraImage CGImage], &copiedPixel, &copiedWidth, &copiedHeight, &copiedBytesPerPixel, QH_PIXEL_GRAYSCALE); 71 | 72 | int threshold = 120; 73 | 74 | // binarize 75 | for (int y = 0; y < copiedHeight; y++) { 76 | for (int x = 0; x < copiedWidth; x++) { 77 | copiedPixel[y * copiedWidth+ x] = copiedPixel[y * copiedWidth+ x] > threshold ? 255 : 0; 78 | } 79 | } 80 | 81 | CGImageRef binarizedImageRef = CGImageCreateWithPixelBuffer(copiedPixel, copiedWidth, copiedHeight, QH_BYTES_PER_PIXEL_8BIT, QH_PIXEL_COLOR); 82 | 83 | free(copiedPixel); 84 | 85 | self.image = [UIImage imageWithCGImage:binarizedImageRef]; 86 | 87 | [imageView setImage:self.image]; 88 | 89 | CGImageRelease(binarizedImageRef); 90 | } 91 | 92 | - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 93 | [self setBinarizedImageWithInfo:info]; 94 | [picker dismissModalViewControllerAnimated:YES]; 95 | } 96 | 97 | - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { 98 | [picker dismissModalViewControllerAnimated:YES]; 99 | } 100 | 101 | - (void)dealloc { 102 | self.image = nil; 103 | [super dealloc]; 104 | } 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/ImageLoadTestViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * ImageLoadTestViewController.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "ImageLoadTestViewController.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | @implementation ImageLoadTestViewController 36 | 37 | + (NSString*)testDescription { 38 | return NSLocalizedString(@"Image load test", nil); 39 | } 40 | 41 | - (void)viewWillAppear:(BOOL)animated { 42 | [super viewWillAppear:animated]; 43 | [self setTitle:[[self class] testDescription]]; 44 | } 45 | 46 | - (void)viewDidLoad { 47 | [super viewDidLoad]; 48 | 49 | // make file path 50 | NSArray *paths = [NSArray arrayWithObjects: 51 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_JPG24.jpg" ofType:nil], 52 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG8.png" ofType:nil], 53 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG8Alpha.png" ofType:nil], 54 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG24.png" ofType:nil], 55 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG24Alpha.png" ofType:nil], 56 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_JPG24.jpg" ofType:nil], 57 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_PNG8.png" ofType:nil], 58 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_PNG24.png" ofType:nil], 59 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_PNG24Alpha.png" ofType:nil], 60 | nil]; 61 | 62 | UIImageView *imageViews[9]; 63 | 64 | imageViews[0] = imageView01; 65 | imageViews[1] = imageView02; 66 | imageViews[2] = imageView03; 67 | imageViews[3] = imageView04; 68 | imageViews[4] = imageView05; 69 | imageViews[5] = imageView06; 70 | imageViews[6] = imageView07; 71 | imageViews[7] = imageView08; 72 | imageViews[8] = imageView09; 73 | 74 | UIImageView **p = imageViews; 75 | 76 | // update image views 77 | for (NSString *path in paths) { 78 | unsigned char *pixel = NULL; 79 | int width, height, bytesPerPixel; 80 | printf("Image file2 = %s\n", [[path lastPathComponent] UTF8String]); 81 | CGImageRef imageRef = CGImageCreateWithPNGorJPEGFilePath((CFStringRef)path); 82 | CGImageDumpImageInformation(imageRef); 83 | 84 | CGCreatePixelBufferWithImage(imageRef, &pixel, &width, &height, &bytesPerPixel, QH_PIXEL_COLOR); 85 | 86 | CGImageRef duplicatedImage = CGImageCreateWithPixelBuffer(pixel, width, height, QH_BYTES_PER_PIXEL_24BIT, QH_PIXEL_COLOR); 87 | 88 | UIImageView *v = *p; 89 | 90 | [v setImage:[UIImage imageWithCGImage:duplicatedImage]]; 91 | 92 | p++; 93 | 94 | free(pixel); 95 | } 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/QuartzHelpLibraryAppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * QuartzHelpLibraryAppDelegate.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "QuartzHelpLibraryAppDelegate.h" 32 | 33 | #import "QuartzHelpLibraryViewController.h" 34 | 35 | #import "test.h" 36 | 37 | @implementation QuartzHelpLibraryAppDelegate 38 | 39 | 40 | @synthesize window=_window; 41 | 42 | @synthesize viewController=_viewController; 43 | 44 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 45 | { 46 | // Override point for customization after application launch. 47 | test(); 48 | 49 | self.window.rootViewController = self.viewController; 50 | 51 | [self.window makeKeyAndVisible]; 52 | return YES; 53 | } 54 | 55 | - (void)applicationWillResignActive:(UIApplication *)application 56 | { 57 | /* 58 | 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. 59 | 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. 60 | */ 61 | } 62 | 63 | - (void)applicationDidEnterBackground:(UIApplication *)application 64 | { 65 | /* 66 | 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. 67 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 68 | */ 69 | } 70 | 71 | - (void)applicationWillEnterForeground:(UIApplication *)application 72 | { 73 | /* 74 | 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. 75 | */ 76 | } 77 | 78 | - (void)applicationDidBecomeActive:(UIApplication *)application 79 | { 80 | /* 81 | 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. 82 | */ 83 | } 84 | 85 | - (void)applicationWillTerminate:(UIApplication *)application 86 | { 87 | /* 88 | Called when the application is about to terminate. 89 | Save data if appropriate. 90 | See also applicationDidEnterBackground:. 91 | */ 92 | } 93 | 94 | - (void)dealloc 95 | { 96 | [_window release]; 97 | [_viewController release]; 98 | [super dealloc]; 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/SelectTestViewController_iPad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 800 5 | 10C540 6 | 759 7 | 1038.25 8 | 458.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 77 12 | 13 | 14 | 15 | 16 | 17 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 18 | 19 | 20 | 21 | 22 | IBFilesOwner 23 | IBIPadFramework 24 | 25 | 26 | IBFirstResponder 27 | IBIPadFramework 28 | 29 | 30 | 31 | 274 32 | {768, 1024} 33 | 34 | 35 | 3 36 | MQA 37 | 38 | NO 39 | YES 40 | NO 41 | IBIPadFramework 42 | NO 43 | 1 44 | 0 45 | YES 46 | 44 47 | 22 48 | 22 49 | 50 | 51 | 52 | 53 | 54 | 55 | dataSource 56 | 57 | 58 | 59 | 9 60 | 61 | 62 | 63 | delegate 64 | 65 | 66 | 67 | 10 68 | 69 | 70 | 71 | view 72 | 73 | 74 | 75 | 11 76 | 77 | 78 | 79 | 80 | 81 | 0 82 | 83 | 84 | 85 | 86 | 87 | -1 88 | 89 | 90 | File's Owner 91 | 92 | 93 | -2 94 | 95 | 96 | 97 | 98 | 8 99 | 100 | 101 | 102 | 103 | 104 | 105 | SelectTestViewController_iPad 106 | UIResponder 107 | {{45, 132}, {768, 1024}} 108 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 109 | 110 | 111 | 112 | 113 | 114 | 11 115 | 116 | 117 | 118 | 119 | SelectTestViewController_iPad 120 | UIViewController 121 | 122 | IBProjectSource 123 | SelectTestViewController_iPad.h 124 | 125 | 126 | 127 | 128 | 0 129 | IBIPadFramework 130 | YES 131 | 132 | 3 133 | 77 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/TestViewControllers/OrientationTestViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * OrientationTestViewController.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "OrientationTestViewController.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | #import "testImageOrientation.h" 36 | 37 | @implementation OrientationTestViewController 38 | 39 | + (NSString*)testDescription { 40 | return NSLocalizedString(@"UIImage orientation", nil); 41 | } 42 | 43 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 44 | BOOL hidden = self.navigationController.navigationBar.hidden; 45 | [self.navigationController setNavigationBarHidden:!hidden animated:YES]; 46 | } 47 | 48 | - (void)viewWillAppear:(BOOL)animated { 49 | [super viewWillAppear:animated]; 50 | [self setTitle:[[self class] testDescription]]; 51 | [self.navigationController.navigationBar setTranslucent:YES]; 52 | [self.navigationController setNavigationBarHidden:YES animated:YES]; 53 | } 54 | 55 | - (void)viewWillDisappear:(BOOL)animated { 56 | [super viewWillDisappear:animated]; 57 | [self.navigationController.navigationBar setTranslucent:NO]; 58 | } 59 | 60 | - (void)showRotatedPixel { 61 | int width = QH_ORIENTATION_TEST_WIDTH; 62 | int height = QH_ORIENTATION_TEST_HEIGHT; 63 | int bytesPerPixel = QH_ORIENTATION_TEST_BYTES_PER_PIXEL; 64 | unsigned char *pixel = NULL; 65 | 66 | makeImage(&pixel, &width, &height, &bytesPerPixel, UIImageOrientationUp); 67 | CGImageRef source = CGImageCreateWithPixelBuffer(pixel, width, height, bytesPerPixel, QH_PIXEL_COLOR); 68 | free(pixel); 69 | 70 | int rot[8]; 71 | { 72 | int *p = rot; 73 | *p++ = UIImageOrientationUp; 74 | *p++ = UIImageOrientationUpMirrored; 75 | *p++ = UIImageOrientationDown; 76 | *p++ = UIImageOrientationDownMirrored; 77 | *p++ = UIImageOrientationLeft; 78 | *p++ = UIImageOrientationLeftMirrored; 79 | *p++ = UIImageOrientationRight; 80 | *p++ = UIImageOrientationRightMirrored; 81 | } 82 | 83 | UIImageView *trueImageViews[8]; 84 | { 85 | UIImageView **p = trueImageViews; 86 | *p++ = true_up; 87 | *p++ = true_upMirrored; 88 | *p++ = true_down; 89 | *p++ = true_downMirrored; 90 | *p++ = true_left; 91 | *p++ = true_leftMirrored; 92 | *p++ = true_right; 93 | *p++ = true_rightMirrored; 94 | } 95 | 96 | UIImageView *testImageViews[8]; 97 | { 98 | UIImageView **p = testImageViews; 99 | *p++ = up; 100 | *p++ = upMirrored; 101 | *p++ = down; 102 | *p++ = downMirrored; 103 | *p++ = left; 104 | *p++ = leftMirrored; 105 | *p++ = right; 106 | *p++ = rightMirrored; 107 | } 108 | 109 | for (int i = 0; i < 8; i++) { 110 | UIImage *image = [UIImage imageWithCGImage:source scale:1 orientation:rot[i]]; 111 | [trueImageViews[i] setImage:image]; 112 | 113 | // test 114 | int width = QH_ORIENTATION_TEST_WIDTH; 115 | int height = QH_ORIENTATION_TEST_HEIGHT; 116 | int bytesPerPixel = QH_ORIENTATION_TEST_BYTES_PER_PIXEL; 117 | unsigned char *pixel = NULL; 118 | 119 | makeImage(&pixel, &width, &height, &bytesPerPixel, rot[i]); 120 | CGImageRef rotated = CGImageCreateWithPixelBuffer(pixel, width, height, bytesPerPixel, QH_PIXEL_COLOR); 121 | free(pixel); 122 | [testImageViews[i] setImage:[UIImage imageWithCGImage:rotated]]; 123 | } 124 | } 125 | 126 | - (void)showImage { 127 | int width = QH_ORIENTATION_TEST_WIDTH; 128 | int height = QH_ORIENTATION_TEST_HEIGHT; 129 | int bytesPerPixel = QH_ORIENTATION_TEST_BYTES_PER_PIXEL; 130 | unsigned char *pixel = NULL; 131 | 132 | makeImage(&pixel, &width, &height, &bytesPerPixel, UIImageOrientationUp); 133 | CGImageRef source = CGImageCreateWithPixelBuffer(pixel, width, height, bytesPerPixel, QH_PIXEL_COLOR); 134 | free(pixel); 135 | 136 | int rot[8]; 137 | { 138 | int *p = rot; 139 | *p++ = UIImageOrientationUp; 140 | *p++ = UIImageOrientationUpMirrored; 141 | *p++ = UIImageOrientationDown; 142 | *p++ = UIImageOrientationDownMirrored; 143 | *p++ = UIImageOrientationLeft; 144 | *p++ = UIImageOrientationLeftMirrored; 145 | *p++ = UIImageOrientationRight; 146 | *p++ = UIImageOrientationRightMirrored; 147 | } 148 | 149 | UIImageView *trueImageViews[8]; 150 | { 151 | UIImageView **p = trueImageViews; 152 | *p++ = true_up; 153 | *p++ = true_upMirrored; 154 | *p++ = true_down; 155 | *p++ = true_downMirrored; 156 | *p++ = true_left; 157 | *p++ = true_leftMirrored; 158 | *p++ = true_right; 159 | *p++ = true_rightMirrored; 160 | } 161 | 162 | UIImageView *testImageViews[8]; 163 | { 164 | UIImageView **p = testImageViews; 165 | *p++ = up; 166 | *p++ = upMirrored; 167 | *p++ = down; 168 | *p++ = downMirrored; 169 | *p++ = left; 170 | *p++ = leftMirrored; 171 | *p++ = right; 172 | *p++ = rightMirrored; 173 | } 174 | 175 | for (int i = 0; i < 8; i++) { 176 | UIImage *image = [UIImage imageWithCGImage:source scale:1 orientation:rot[i]]; 177 | [trueImageViews[i] setImage:image]; 178 | [testImageViews[i] setImage:[image getRotatedImage]]; 179 | } 180 | 181 | CGImageRelease(source); 182 | } 183 | 184 | #pragma mark - View lifecycle 185 | 186 | - (void)viewDidLoad { 187 | [super viewDidLoad]; 188 | [self showImage]; 189 | } 190 | 191 | @end 192 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/SelectTestViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1056 5 | 10J869 6 | 1306 7 | 1038.35 8 | 461.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 301 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUITableView 17 | 18 | 19 | YES 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | YES 24 | 25 | YES 26 | 27 | 28 | 29 | 30 | YES 31 | 32 | IBFilesOwner 33 | IBCocoaTouchFramework 34 | 35 | 36 | IBFirstResponder 37 | IBCocoaTouchFramework 38 | 39 | 40 | 41 | 274 42 | {{0, 20}, {320, 460}} 43 | 44 | 45 | 46 | 3 47 | MQA 48 | 49 | NO 50 | YES 51 | NO 52 | 53 | IBCocoaTouchFramework 54 | NO 55 | 1 56 | 0 57 | YES 58 | 44 59 | 22 60 | 22 61 | 62 | 63 | 64 | 65 | YES 66 | 67 | 68 | view 69 | 70 | 71 | 72 | 5 73 | 74 | 75 | 76 | dataSource 77 | 78 | 79 | 80 | 6 81 | 82 | 83 | 84 | delegate 85 | 86 | 87 | 88 | 7 89 | 90 | 91 | 92 | 93 | YES 94 | 95 | 0 96 | 97 | 98 | 99 | 100 | 101 | -1 102 | 103 | 104 | File's Owner 105 | 106 | 107 | -2 108 | 109 | 110 | 111 | 112 | 4 113 | 114 | 115 | 116 | 117 | 118 | 119 | YES 120 | 121 | YES 122 | -1.CustomClassName 123 | -2.CustomClassName 124 | 4.IBEditorWindowLastContentRect 125 | 4.IBPluginDependency 126 | 127 | 128 | YES 129 | SelectTestViewController 130 | UIResponder 131 | {{329, 504}, {320, 480}} 132 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 133 | 134 | 135 | 136 | YES 137 | 138 | 139 | 140 | 141 | 142 | YES 143 | 144 | 145 | 146 | 147 | 7 148 | 149 | 150 | 151 | YES 152 | 153 | SelectTestViewController 154 | UITableViewController 155 | 156 | IBProjectSource 157 | ./Classes/SelectTestViewController.h 158 | 159 | 160 | 161 | 162 | 0 163 | IBCocoaTouchFramework 164 | 165 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 166 | 167 | 168 | YES 169 | 3 170 | 301 171 | 172 | 173 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Quartz Help Library ======= ![sample image](http://sonson.jp/wp/wp-content/uploads/2011/04/qhl.png) This library helps image processing programming on iOS. Currently, it includes a mutual converter CGImage <-> pixel array.. You can convert them mutually without complicated codes. // original pixel data int originalWidth = 32; int originalHeight = 32; unsigned char* original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight); // make test pattern for (int y = 0; y < originalHeight; y++) { for (int x = 0; x < originalWidth; x++) { if (y <= originalHeight / 2 && x <= originalWidth / 2) { original[y * originalWidth + x] = 0; } if (y <= originalHeight / 2 && x > originalWidth / 2) { original[y * originalWidth + x] = 85; } if (y > originalHeight / 2 && x <= originalWidth / 2) { original[y * originalWidth + x] = 170; } if (y > originalHeight / 2 && x > originalWidth / 2) { original[y * originalWidth + x] = 255; } } } CGImageRef image = CGImageGrayColorCreateWithGrayPixelBuffer(original, originalWidth, originalHeight); UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithCGImage:image]]; [self addSubview:imageView]; [imageView release]; How to use ======= * Import QuartzCVHelpLibrary.h/m into your project. License ======= BSD License. UIImage Quartz Help Library Additions Reference ======= - (NSData*)PNGRepresentaion; ###Return value An autoreleased NSData object containing the PNG data, or nil if there was a problem generating the data. ###Discussion You can obtain PNG data as NSData from UIImage directly. - (NSData*)JPEGRepresentaion; ###Return value An autoreleased NSData object containing the JPEG data, or nil if there was a problem generating the data. This method uses default JPG compression quiality. ###Discussion You can obtain JPEG data as NSData from UIImage directly. - (NSData*)JPEGRepresentaionWithCompressionQuality:(float)compressionQuality; ###Parameters ###compressionQuality The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). ###Return value An autoreleased NSData object containing the JPEG data, or nil if there was a problem generating the data. This method uses default JPG compression quiality. ###Discussion You can obtain JPEG data as NSData from UIImage directly. - (UIImage*)getRotatedImage; ###Return value An autoreleased bitmap image as UIImage. ###Discussion Bitmap image is copied from UIImage which is rotated according to "imageOrienation" attribute. Therefore, the size of the image you obtain is not as same as the original UIImage's. - (UIImage*)getRotatedImageWithResizing:(float)scale; ###Parameters ###scale The scale factor to used when "imageRef" is resized. ###Return value An autoreleased bitmap image as UIImage. ###Discussion Resized bitmap image is copied from UIImage which is rotated according to "imageOrienation" attribute. Therefore, the size of the image you obtain is not as same as the original UIImage's. - (CGImageRef)createCGImageRotated; ###Return value A new Quartz bitmap image. You are responsible for releasing this object by calling CGImageRelease. ###Discussion Bitmap image is copied from UIImage which is rotated according to "imageOrienation" attribute. Therefore, the size of the image you obtain is not as same as the original UIImage's. - (CGImageRef)createCGImageRotatedWithResizing:(float)scale; ###Parameters ###scale The scale factor to used when "imageRef" is resized. ###Return value A new Quartz bitmap image. You are responsible for releasing this object by calling CGImageRelease. ###Discussion Resized bitmap image is copied from UIImage which is rotated according to "imageOrienation" attribute. Because createCGImageRotatedWithResizing simultaneously resizes image and adjusts rotation of UIImage with low memory usage, this method has to be used in - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info. Quartz Help Library Reference ======= CGImageRef CGImageCreateWithPNGorJPEGFilePath( CFStringRef filePath ); ###Parameters ###filePath The full or relative pathname of your image file, as CFStringRef(NSString). ###Return value A new Quartz bitmap image. You are responsible for releasing this object by calling CGImageRelease. ###Discussion You can obtain the Quartz bitmap image from the filepath of PNG or JPG file directly. void CGImageDumpImageInformation( CGImageRef imageRef ); ###Parameters ###imageRef The image to print its information. ###Discussion Print information of the image to standard output (stdout). The information incudes width, height, bytes per pixel, alpha, byte order, and so on. void CGCreatePixelBufferWithImage( CGImageRef imageRef, unsigned char **pixel, int *width, int *height, int *bytesPerPixel, QH_PIXEL_TYPE pType ); ###Parameters ###imageRef The image to be copied. ###pixel Return contains pixel buffer of the image. You are responsible for free this data. ###width Return contains width of the image. ###height Return contains pixel of the image. ###bytesPerPixel Return contains bytes per pixel of returned the pixel buffer. ###pType Your favourite pixel type as specified QH\_PIXEL\_TYPE when copying pixel buffer. ###Discussion pType is very important. Specifying QH\_PIXEL\_GRAYSCALE, pixel contains gray scale pixel buffer of the image. And then if the image is RGB or RGBA color scale, it is converted to gray scale automatically. The converting algorithm is based on YUV-RGB(Alpha components are filled with default value as 255). On the contrary, specifying QH\_PIXEL\_COLOR or QH\_PIXEL\_ANYCOLOR when the image is gray scale, automatically pixels' each components are filled with each gray scale value except alpha. CGImageRef CGImageCreateWithPixelBuffer( unsigned char *pixel, int width, int height, int bytesPerPixel, QH_PIXEL_TYPE target_pType ); ###Parameters ###pixel The pointer of the pixel buffer to be used to make a new CGImage. ###width Width of the pixel buffer. ###height Height of the pixel buffer. ###bytesPerPixel Bytes per pixel of the pixel buffer. ###target_pType Pixel type of the image to be created with above parameters. Specified QH\_PIXEL\_TYPE. ###Return value A new Quartz bitmap image. You are responsible for releasing this object by calling CGImageRelease. ###Discussion Upconverting or downconverting is to be done according to your spceifying `bytesPerPixel` and `target_pType`, like `CGCreatePixelBufferWithImage`. I doubt that CGImage supports the image whose format is 24 bit per pixel. So, CGImage this method returns is 8bit or 32bit bitmap. NSData* CGImageGetPNGPresentation( CGImageRef imageRef ); ###Parameters ###imageRef The image to be converted to PNG data. ###Return value An autoreleased NSData object containing the PNG data, or nil if there was a problem generating the data. ###Discussion To be written. NSData* CGImageGetJPEGPresentation( CGImageRef imageRef ); ###Parameters ###imageRef The image to be converted to JPG data. ###Return value An autoreleased NSData object containing the JPG data, or nil if there was a problem generating the data. ###Discussion To be written. CGImageRef CGImageCreateWithResizing( CGImageRef imageRef, float scale ); ###Parameters ###imageRef The image to be resized. ###scale The scale factor to used when "imageRef" is resized. ###Return value A new and rotated Quartz bitmap image. You are responsible for releasing this object by calling CGImageRelease. ###Discussion This function has not been tested yet. Be careful of using this function :-) Constants ======= ###In/Out pixel type typedef enum { QH_PIXEL_GRAYSCALE = 0, QH_PIXEL_COLOR = 1 << 0, QH_PIXEL_ANYCOLOR = 1 << 1, }QH_PIXEL_TYPE; ###QH\_PIXEL\_GRAYSCALE Gray scale pixel for the output/input image. Typically, bits per pixel is 8bits. ###QH\_PIXEL\_COLOR RGB color scale pixel for the output/input image. Typically, bits per pixel is 24bits. ###QH\_PIXEL\_ANYCOLOR The appropriate color scale pixel for the output/input image. I believe that it does suit to output/input image format.... ###Bytes per pixel type typedef enum { QH_BYTES_PER_PIXEL_UNKNOWN = 0, QH_BYTES_PER_PIXEL_8BIT = 1, QH_BYTES_PER_PIXEL_16BIT = 2, QH_BYTES_PER_PIXEL_24BIT = 3, QH_BYTES_PER_PIXEL_32BIT = 4, }QH_BYTES_PER_PIXEL; ###QH\_BYTES\_PER_PIXEL\_UNKNOWN Typically, error. ###QH\_BYTES\_PER_PIXEL\_8BIT Bytes per pixel is 1. In short, bits per pixel is 8 bit. Typically, index color or gray color image. ###QH\_BYTES\_PER_PIXEL\_16BIT Bytes per pixel is 2. In short, bits per pixel is 16 bit. Typically, index color or gray color image with alpha component. ###QH\_BYTES\_PER_PIXEL\_24BIT Bytes per pixel is 3. In short, bits per pixel is 24 bit. Typically, RGB color image. ###QH\_BYTES\_PER_PIXEL\_32BIT Bytes per pixel is 4. In short, bits per pixel is 32 bit. Typically, RGB color image with alpha component. Blog ======= * [sonson.jp][] Sorry, Japanese only.... Dependency ======= * none [Quartz Help Library]: https://github.com/sonsongithub/Quartz-Help-Library [sonson.jp]: http://sonson.jp -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/test.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * test.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/04/20 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "test.h" 32 | 33 | #include "QuartzHelpLibrary.h" 34 | 35 | #import "testTool.h" 36 | #import "testImageOrientation.h" 37 | 38 | #pragma mark - 39 | #pragma mark CGImage and image file 40 | 41 | typedef enum { 42 | QH_TEST_JPG = 0, 43 | QH_TEST_PNG = 1, 44 | }QH_TEST_IMAGE_TYPE; 45 | 46 | void copyTestPixelPattern(unsigned char *pixel, int width, int height, QH_PIXEL_TYPE testType) { 47 | if (testType == QH_PIXEL_GRAYSCALE) { 48 | // make test pattern 49 | for (int y = 0; y < height; y++) { 50 | for (int x = 0; x < width; x++) { 51 | if (y <= height / 2 && x <= width / 2) { 52 | pixel[y * width + x] = 0; 53 | } 54 | if (y <= height / 2 && x > width / 2) { 55 | pixel[y * width + x] = 85; 56 | } 57 | if (y > height / 2 && x <= width / 2) { 58 | pixel[y * width + x] = 170; 59 | } 60 | if (y > height / 2 && x > width / 2) { 61 | pixel[y * width + x] = 255; 62 | } 63 | } 64 | } 65 | } 66 | else if (testType == QH_PIXEL_COLOR) { 67 | // make test pattern 68 | for (int x = 0; x < width; x++) { 69 | for (int y = 0; y < height; y++) { 70 | if (y <= height / 2 && x <= width / 2) { 71 | pixel[y * width * 3 + x * 3 + 0] = 255; 72 | pixel[y * width * 3 + x * 3 + 1] = 0; 73 | pixel[y * width * 3 + x * 3 + 2] = 0; 74 | } 75 | else if (y <= height / 2 && x > width / 2) { 76 | pixel[y * width * 3 + x * 3 + 0] = 0; 77 | pixel[y * width * 3 + x * 3 + 1] = 255; 78 | pixel[y * width * 3 + x * 3 + 2] = 0; 79 | } 80 | else if (y > height / 2 && x <= width / 2) { 81 | pixel[y * width * 3 + x * 3 + 0] = 0; 82 | pixel[y * width * 3 + x * 3 + 1] = 0; 83 | pixel[y * width * 3 + x * 3 + 2] = 255; 84 | } 85 | else if (y > height / 2 && x > width / 2) { 86 | pixel[y * width * 3 + x * 3 + 0] = 255; 87 | pixel[y * width * 3 + x * 3 + 1] = 255; 88 | pixel[y * width * 3 + x * 3 + 2] = 255; 89 | } 90 | } 91 | } 92 | } 93 | else { 94 | printf("Unsupported test condition.\n"); 95 | assert(0); 96 | } 97 | } 98 | 99 | void testPixel2CGImage2File2CGImage2Pixel(QH_PIXEL_TYPE testType, QH_TEST_IMAGE_TYPE fileType) { 100 | // parameter 101 | int tolerance = 2; 102 | QH_BYTES_PER_PIXEL bytesPerPixel = QH_BYTES_PER_PIXEL_UNKNOWN; 103 | 104 | // original pixel data 105 | int originalWidth = 32; 106 | int originalHeight = 32; 107 | unsigned char* original = NULL; 108 | 109 | // alloc test pattern 110 | if (testType == QH_PIXEL_GRAYSCALE) { 111 | bytesPerPixel = QH_BYTES_PER_PIXEL_8BIT; 112 | original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight * QH_BYTES_PER_PIXEL_8BIT); 113 | } 114 | else if (testType == QH_PIXEL_COLOR) { 115 | bytesPerPixel = QH_BYTES_PER_PIXEL_24BIT; 116 | original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight * QH_BYTES_PER_PIXEL_24BIT); 117 | } 118 | else { 119 | printf("Unsupported test condition.\n"); 120 | assert(0); 121 | } 122 | 123 | // copy test pattern 124 | copyTestPixelPattern(original, originalWidth, originalHeight, testType); 125 | 126 | // make CGImage 127 | CGImageRef image = CGImageCreateWithPixelBuffer(original, originalWidth, originalHeight, bytesPerPixel, testType); 128 | 129 | // write CGImage as image file 130 | NSData *data = nil; 131 | if (fileType == QH_TEST_JPG) { 132 | data = CGImageGetJPEGPresentation(image); 133 | } 134 | else if (fileType == QH_TEST_PNG) { 135 | data = CGImageGetPNGPresentation(image); 136 | } 137 | else { 138 | printf("Unsupported test condition.\n"); 139 | assert(0); 140 | } 141 | NSString *path = makeFilePathInDocumentFolder(@"tempfile"); 142 | [data writeToFile:path atomically:YES]; 143 | 144 | // load CGImage from image file 145 | CGImageRef imageReloaded = CGImageCreateWithPNGorJPEGFilePath((CFStringRef)path); 146 | 147 | // load pixel array from CGImage 148 | int reloadedWidth = 0; 149 | int reloadedHeight = 0; 150 | int reloadedBytesPerPixel = 0; 151 | unsigned char *reloadedPixel = NULL; 152 | CGCreatePixelBufferWithImage(imageReloaded, &reloadedPixel, &reloadedWidth, &reloadedHeight, &reloadedBytesPerPixel, testType); 153 | 154 | assert(compareBuffers(original, reloadedPixel, reloadedWidth * reloadedHeight, tolerance)); 155 | 156 | free(reloadedPixel); 157 | CGImageRelease(imageReloaded); 158 | 159 | // release memory 160 | CGImageRelease(image); 161 | free(original); 162 | 163 | printf("testPixel2CGImage2File2CGImage2Pixel OK\n\n"); 164 | } 165 | 166 | void testPixel2CGImage2Pixel(QH_PIXEL_TYPE testType) { 167 | // parameter 168 | int tolerance = 2; 169 | QH_BYTES_PER_PIXEL bytesPerPixel = QH_BYTES_PER_PIXEL_UNKNOWN; 170 | 171 | // original pixel data 172 | int originalWidth = 32; 173 | int originalHeight = 32; 174 | unsigned char* original = NULL; 175 | 176 | // alloc test pattern 177 | if (testType == QH_PIXEL_GRAYSCALE) { 178 | bytesPerPixel = QH_BYTES_PER_PIXEL_8BIT; 179 | original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight * QH_BYTES_PER_PIXEL_8BIT); 180 | } 181 | else if (testType == QH_PIXEL_COLOR) { 182 | bytesPerPixel = QH_BYTES_PER_PIXEL_24BIT; 183 | original = (unsigned char*)malloc(sizeof(unsigned char) * originalWidth * originalHeight * QH_BYTES_PER_PIXEL_24BIT); 184 | } 185 | else { 186 | printf("Unsupported test condition.\n"); 187 | assert(0); 188 | } 189 | 190 | // copy test pattern 191 | copyTestPixelPattern(original, originalWidth, originalHeight, testType); 192 | 193 | // make CGImage 194 | CGImageRef image = CGImageCreateWithPixelBuffer(original, originalWidth, originalHeight, bytesPerPixel, testType); 195 | 196 | // copy pixel from CGImage 197 | int copiedWidth = 0; 198 | int copiedHeight = 0; 199 | int copiedBytesPerPixel = 0; 200 | unsigned char *copiedPixel = NULL; 201 | CGCreatePixelBufferWithImage(image, &copiedPixel, &copiedWidth, &copiedHeight, &copiedBytesPerPixel, testType); 202 | 203 | // test 204 | assert(compareBuffers(original, copiedPixel, originalWidth * originalHeight, tolerance)); 205 | 206 | // release memory 207 | CGImageRelease(image); 208 | free(original); 209 | 210 | printf("testPixel2CGImage2Pixel OK\n\n"); 211 | } 212 | 213 | #pragma mark - 214 | #pragma mark Dump 215 | 216 | void testCGImageDump() { 217 | // test file paths 218 | NSArray *paths = [NSArray arrayWithObjects: 219 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_JPG24.jpg" ofType:nil], 220 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG8.png" ofType:nil], 221 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG8Alpha.png" ofType:nil], 222 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG24.png" ofType:nil], 223 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG24Alpha.png" ofType:nil], 224 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_JPG24.jpg" ofType:nil], 225 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_PNG8.png" ofType:nil], 226 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_PNG24.png" ofType:nil], 227 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_PNG24Alpha.png" ofType:nil], 228 | nil]; 229 | for (NSString *path in paths) { 230 | printf("Image file = %s\n", [[path lastPathComponent] UTF8String]); 231 | CGImageRef imageRef = CGImageCreateWithPNGorJPEGFilePath((CFStringRef)path); 232 | CGImageDumpImageInformation(imageRef); 233 | printf("\n"); 234 | } 235 | printf("testCGImageDump OK\n\n"); 236 | } 237 | 238 | #pragma mark - Image load test 239 | 240 | void imageLoadTest() { 241 | // 242 | // test code Image file->CGImage->pixel vs RAW data. 243 | // only RGB 244 | // 245 | // make file path 246 | NSArray *paths = [NSArray arrayWithObjects: 247 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG24.png" ofType:nil], 248 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_JPG24.jpg" ofType:nil], 249 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG8.png" ofType:nil], 250 | [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG24.png" ofType:nil], 251 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_JPG24.jpg" ofType:nil], 252 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_PNG8.png" ofType:nil], 253 | [[NSBundle mainBundle] pathForResource:@"testImage_RGB_PNG24.png" ofType:nil], 254 | nil]; 255 | for (NSString *path in paths) { 256 | // file name 257 | printf("%s\n", [[path lastPathComponent] UTF8String]); 258 | 259 | // load grand truth raw data file 260 | NSString *rawPath = [[path stringByDeletingPathExtension] stringByAppendingPathExtension:@"raw"]; 261 | NSData *data = [NSData dataWithContentsOfFile:rawPath]; 262 | 263 | // image data 264 | unsigned char *pixel = NULL; 265 | int width, height, bytesPerPixel; 266 | int tolerance = 2; 267 | 268 | // load image file as CGImage 269 | CGImageRef imageRef = CGImageCreateWithPNGorJPEGFilePath((CFStringRef)path); 270 | 271 | // copy image to pixel array from CGImage 272 | CGCreatePixelBufferWithImage(imageRef, &pixel, &width, &height, &bytesPerPixel, QH_PIXEL_COLOR); 273 | 274 | // test 275 | assert(compareBuffersWithXandY(pixel, (unsigned char*)[data bytes], width, height, bytesPerPixel, tolerance)); 276 | 277 | // release pixel array 278 | free(pixel); 279 | } 280 | printf("imageLoadTest OK\n\n"); 281 | } 282 | 283 | #pragma mark - Test 284 | 285 | void test() { 286 | testCGImageDump(); 287 | 288 | testPixel2CGImage2Pixel(QH_PIXEL_COLOR); 289 | testPixel2CGImage2Pixel(QH_PIXEL_GRAYSCALE); 290 | 291 | testPixel2CGImage2File2CGImage2Pixel(QH_PIXEL_COLOR, QH_TEST_JPG); 292 | testPixel2CGImage2File2CGImage2Pixel(QH_PIXEL_GRAYSCALE, QH_TEST_JPG); 293 | 294 | testPixel2CGImage2File2CGImage2Pixel(QH_PIXEL_COLOR, QH_TEST_PNG); 295 | testPixel2CGImage2File2CGImage2Pixel(QH_PIXEL_GRAYSCALE, QH_TEST_PNG); 296 | 297 | imageLoadTest(); 298 | 299 | testImageOrientation(); 300 | } 301 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/Test/testImageOrientation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Quartz Help Library 3 | * testImageOrientation.m 4 | * 5 | * Copyright (c) Yuichi YOSHIDA, 11/05/19 6 | * All rights reserved. 7 | * 8 | * BSD License 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, are 11 | * permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, this list of 13 | * conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, this list 15 | * of conditions and the following disclaimer in the documentation and/or other materia 16 | * ls provided with the distribution. 17 | * - Neither the name of the "Yuichi Yoshida" nor the names of its contributors may be u 18 | * sed to endorse or promote products derived from this software without specific prior 19 | * written permission. 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY E 21 | * XPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES O 22 | * F MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SH 23 | * ALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENT 24 | * AL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROC 25 | * UREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS I 26 | * NTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI 27 | * CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF T 28 | * HE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #import "testImageOrientation.h" 32 | 33 | #import "QuartzHelpLibrary.h" 34 | 35 | #import "testTool.h" 36 | 37 | void makeImage(unsigned char **pixel, int *width, int *height, int *bytesPerPixel, UIImageOrientation orientation) { 38 | int defaultWidth = QH_ORIENTATION_TEST_WIDTH; 39 | int defaultHeight = QH_ORIENTATION_TEST_HEIGHT; 40 | int defaultBytesPerPixel = QH_ORIENTATION_TEST_BYTES_PER_PIXEL; 41 | 42 | unsigned char *source = (unsigned char*)malloc(sizeof(unsigned char) * (defaultWidth) * (defaultHeight) * (defaultBytesPerPixel)); 43 | for (int x = 0; x < (defaultWidth); x++) { 44 | for (int y = 0; y < defaultHeight; y++) { 45 | if (y < defaultHeight / 2 && x < (*width) / 2) { 46 | source[y * (defaultWidth) * 3 + x * 3 + 0] = 255; 47 | source[y * (defaultWidth) * 3 + x * 3 + 1] = 0; 48 | source[y * (defaultWidth) * 3 + x * 3 + 2] = 0; 49 | } 50 | else if (y <= defaultHeight / 2 && x >= (defaultWidth) / 2) { 51 | source[y * (defaultWidth) * 3 + x * 3 + 0] = 0; 52 | source[y * (defaultWidth) * 3 + x * 3 + 1] = 255; 53 | source[y * (defaultWidth) * 3 + x * 3 + 2] = 0; 54 | } 55 | else if (y >= defaultHeight / 2 && x < (defaultWidth) / 2) { 56 | source[y * (defaultWidth) * 3 + x * 3 + 0] = 0; 57 | source[y * (defaultWidth) * 3 + x * 3 + 1] = 0; 58 | source[y * (defaultWidth) * 3 + x * 3 + 2] = 255; 59 | } 60 | else if (y >= defaultHeight / 2 && x >= (defaultWidth) / 2) { 61 | source[y * (defaultWidth) * 3 + x * 3 + 0] = 200; 62 | source[y * (defaultWidth) * 3 + x * 3 + 1] = 200; 63 | source[y * (defaultWidth) * 3 + x * 3 + 2] = 200; 64 | } 65 | } 66 | } 67 | 68 | switch(orientation) { 69 | case UIImageOrientationUp: 70 | *width = defaultWidth; 71 | *height = defaultHeight; 72 | *bytesPerPixel = defaultBytesPerPixel; 73 | *pixel = (unsigned char*)malloc(sizeof(unsigned char) * (*width) * (*height) * (*bytesPerPixel)); 74 | for (int x = 0; x < (*width); x++) { 75 | for (int y = 0; y < (*height); y++) { 76 | (*pixel)[y * (*width) * 3 + x * 3 + 0] = source[y * (defaultWidth) * 3 + x * 3 + 0]; 77 | (*pixel)[y * (*width) * 3 + x * 3 + 1] = source[y * (defaultWidth) * 3 + x * 3 + 1]; 78 | (*pixel)[y * (*width) * 3 + x * 3 + 2] = source[y * (defaultWidth) * 3 + x * 3 + 2]; 79 | } 80 | } 81 | break; 82 | case UIImageOrientationUpMirrored: 83 | *width = defaultWidth; 84 | *height = defaultHeight; 85 | *bytesPerPixel = defaultBytesPerPixel; 86 | *pixel = (unsigned char*)malloc(sizeof(unsigned char) * (*width) * (*height) * (*bytesPerPixel)); 87 | for (int x = 0; x < (*width); x++) { 88 | int tx = *width - 1 - x; 89 | for (int y = 0; y < (*height); y++) { 90 | (*pixel)[y * (*width) * 3 + tx * 3 + 0] = source[y * (defaultWidth) * 3 + x * 3 + 0]; 91 | (*pixel)[y * (*width) * 3 + tx * 3 + 1] = source[y * (defaultWidth) * 3 + x * 3 + 1]; 92 | (*pixel)[y * (*width) * 3 + tx * 3 + 2] = source[y * (defaultWidth) * 3 + x * 3 + 2]; 93 | } 94 | } 95 | break; 96 | case UIImageOrientationDown: 97 | *width = defaultWidth; 98 | *height = defaultHeight; 99 | *bytesPerPixel = defaultBytesPerPixel; 100 | *pixel = (unsigned char*)malloc(sizeof(unsigned char) * (*width) * (*height) * (*bytesPerPixel)); 101 | for (int x = 0; x < (*width); x++) { 102 | int tx = *width - 1 - x; 103 | for (int y = 0; y < (*height); y++) { 104 | int ty = *height - 1 - y; 105 | (*pixel)[ty * (*width) * 3 + tx * 3 + 0] = source[y * (defaultWidth) * 3 + x * 3 + 0]; 106 | (*pixel)[ty * (*width) * 3 + tx * 3 + 1] = source[y * (defaultWidth) * 3 + x * 3 + 1]; 107 | (*pixel)[ty * (*width) * 3 + tx * 3 + 2] = source[y * (defaultWidth) * 3 + x * 3 + 2]; 108 | } 109 | } 110 | break; 111 | 112 | case UIImageOrientationDownMirrored: 113 | *width = defaultWidth; 114 | *height = defaultHeight; 115 | *bytesPerPixel = defaultBytesPerPixel; 116 | *pixel = (unsigned char*)malloc(sizeof(unsigned char) * (*width) * (*height) * (*bytesPerPixel)); 117 | for (int x = 0; x < (*width); x++) { 118 | for (int y = 0; y < (*height); y++) { 119 | int ty = *height - 1 - y; 120 | (*pixel)[ty * (*width) * 3 + x * 3 + 0] = source[y * (defaultWidth) * 3 + x * 3 + 0]; 121 | (*pixel)[ty * (*width) * 3 + x * 3 + 1] = source[y * (defaultWidth) * 3 + x * 3 + 1]; 122 | (*pixel)[ty * (*width) * 3 + x * 3 + 2] = source[y * (defaultWidth) * 3 + x * 3 + 2]; 123 | } 124 | } 125 | break; 126 | case UIImageOrientationLeft: 127 | *width = defaultHeight; 128 | *height = defaultWidth; 129 | *bytesPerPixel = defaultBytesPerPixel; 130 | *pixel = (unsigned char*)malloc(sizeof(unsigned char) * (*width) * (*height) * (*bytesPerPixel)); 131 | for (int x = 0; x < (*width); x++) { 132 | for (int y = 0; y < (*height); y++) { 133 | int tx = *height - y - 1; 134 | int ty = x; 135 | (*pixel)[y * (*width) * 3 + x * 3 + 0] = source[ty * (defaultWidth) * 3 + tx * 3 + 0]; 136 | (*pixel)[y * (*width) * 3 + x * 3 + 1] = source[ty * (defaultWidth) * 3 + tx * 3 + 1]; 137 | (*pixel)[y * (*width) * 3 + x * 3 + 2] = source[ty * (defaultWidth) * 3 + tx * 3 + 2]; 138 | } 139 | } 140 | break; 141 | case UIImageOrientationLeftMirrored: 142 | *width = defaultHeight; 143 | *height = defaultWidth; 144 | *bytesPerPixel = defaultBytesPerPixel; 145 | *pixel = (unsigned char*)malloc(sizeof(unsigned char) * (*width) * (*height) * (*bytesPerPixel)); 146 | for (int x = 0; x < (*width); x++) { 147 | for (int y = 0; y < (*height); y++) { 148 | int tx = y; 149 | int ty = x; 150 | (*pixel)[y * (*width) * 3 + x * 3 + 0] = source[ty * (defaultWidth) * 3 + tx * 3 + 0]; 151 | (*pixel)[y * (*width) * 3 + x * 3 + 1] = source[ty * (defaultWidth) * 3 + tx * 3 + 1]; 152 | (*pixel)[y * (*width) * 3 + x * 3 + 2] = source[ty * (defaultWidth) * 3 + tx * 3 + 2]; 153 | } 154 | } 155 | break; 156 | case UIImageOrientationRight: 157 | *width = defaultHeight; 158 | *height = defaultWidth; 159 | *bytesPerPixel = defaultBytesPerPixel; 160 | *pixel = (unsigned char*)malloc(sizeof(unsigned char) * (*width) * (*height) * (*bytesPerPixel)); 161 | for (int x = 0; x < (*width); x++) { 162 | for (int y = 0; y < (*height); y++) { 163 | int tx = y; 164 | int ty = *width - x - 1; 165 | (*pixel)[y * (*width) * 3 + x * 3 + 0] = source[ty * (defaultWidth) * 3 + tx * 3 + 0]; 166 | (*pixel)[y * (*width) * 3 + x * 3 + 1] = source[ty * (defaultWidth) * 3 + tx * 3 + 1]; 167 | (*pixel)[y * (*width) * 3 + x * 3 + 2] = source[ty * (defaultWidth) * 3 + tx * 3 + 2]; 168 | } 169 | } 170 | break; 171 | case UIImageOrientationRightMirrored: 172 | *width = defaultHeight; 173 | *height = defaultWidth; 174 | *bytesPerPixel = defaultBytesPerPixel; 175 | *pixel = (unsigned char*)malloc(sizeof(unsigned char) * (*width) * (*height) * (*bytesPerPixel)); 176 | for (int x = 0; x < (*width); x++) { 177 | for (int y = 0; y < (*height); y++) { 178 | int tx = *height - y - 1; 179 | int ty = *width - x - 1; 180 | (*pixel)[y * (*width) * 3 + x * 3 + 0] = source[ty * (defaultWidth) * 3 + tx * 3 + 0]; 181 | (*pixel)[y * (*width) * 3 + x * 3 + 1] = source[ty * (defaultWidth) * 3 + tx * 3 + 1]; 182 | (*pixel)[y * (*width) * 3 + x * 3 + 2] = source[ty * (defaultWidth) * 3 + tx * 3 + 2]; 183 | } 184 | } 185 | break; 186 | default: 187 | break; 188 | } 189 | free(source); 190 | } 191 | 192 | void testImageOrientation() { 193 | int tolerance = 2; 194 | int width = QH_ORIENTATION_TEST_WIDTH; 195 | int height = QH_ORIENTATION_TEST_HEIGHT; 196 | int bytesPerPixel = QH_ORIENTATION_TEST_BYTES_PER_PIXEL; 197 | unsigned char *pixel = NULL; 198 | 199 | makeImage(&pixel, &width, &height, &bytesPerPixel, UIImageOrientationUp); 200 | CGImageRef source = CGImageCreateWithPixelBuffer(pixel, width, height, bytesPerPixel, QH_PIXEL_COLOR); 201 | free(pixel); 202 | 203 | int rot[8]; 204 | { 205 | int *p = rot; 206 | *p++ = UIImageOrientationUp; 207 | *p++ = UIImageOrientationUpMirrored; 208 | *p++ = UIImageOrientationDown; 209 | *p++ = UIImageOrientationDownMirrored; 210 | *p++ = UIImageOrientationLeft; 211 | *p++ = UIImageOrientationLeftMirrored; 212 | *p++ = UIImageOrientationRight; 213 | *p++ = UIImageOrientationRightMirrored; 214 | } 215 | 216 | NSMutableArray *titles = [NSMutableArray arrayWithCapacity:8]; 217 | [titles addObject:NSLocalizedString(@"UIImageOrientationUp", nil)]; 218 | [titles addObject:NSLocalizedString(@"UIImageOrientationUpMirrored", nil)]; 219 | [titles addObject:NSLocalizedString(@"UIImageOrientationDown", nil)]; 220 | [titles addObject:NSLocalizedString(@"UIImageOrientationDownMirrored", nil)]; 221 | [titles addObject:NSLocalizedString(@"UIImageOrientationLeft", nil)]; 222 | [titles addObject:NSLocalizedString(@"UIImageOrientationLeftMirrored", nil)]; 223 | [titles addObject:NSLocalizedString(@"UIImageOrientationRight", nil)]; 224 | [titles addObject:NSLocalizedString(@"UIImageOrientationRightMirrored", nil)]; 225 | 226 | for (int i = 0; i < 8; i++) { 227 | printf("%s\n", [[titles objectAtIndex:i] UTF8String]); 228 | int width = QH_ORIENTATION_TEST_WIDTH; 229 | int height = QH_ORIENTATION_TEST_HEIGHT; 230 | int bytesPerPixel = QH_ORIENTATION_TEST_BYTES_PER_PIXEL; 231 | unsigned char *pixel = NULL; 232 | 233 | makeImage(&pixel, &width, &height, &bytesPerPixel, rot[i]); 234 | UIImage *image = [UIImage imageWithCGImage:source scale:1 orientation:rot[i]]; 235 | CGImageRef rotated = [image createCGImageRotated]; 236 | 237 | int r_width = 0; 238 | int r_height = 0; 239 | int r_bytesPerPixel = 0; 240 | unsigned char *r_pixel = NULL; 241 | 242 | CGCreatePixelBufferWithImage(rotated, &r_pixel, &r_width, &r_height, &r_bytesPerPixel, QH_PIXEL_COLOR); 243 | 244 | assert(width == r_width); 245 | assert(height == r_height); 246 | assert(bytesPerPixel == r_bytesPerPixel); 247 | assert(compareBuffersWithXandY(pixel, r_pixel, r_width, r_height, r_bytesPerPixel, tolerance)); 248 | 249 | free(pixel); 250 | free(r_pixel); 251 | } 252 | CGImageRelease(source); 253 | printf("testImageOrientation OK\n\n"); 254 | } 255 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10J869 6 | 1306 7 | 1038.35 8 | 461.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 301 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUINavigationController 17 | IBUIViewController 18 | IBUICustomObject 19 | IBUIWindow 20 | IBUINavigationBar 21 | IBUINavigationItem 22 | 23 | 24 | YES 25 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 26 | 27 | 28 | YES 29 | 30 | YES 31 | 32 | 33 | 34 | 35 | YES 36 | 37 | IBFilesOwner 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBFirstResponder 42 | IBCocoaTouchFramework 43 | 44 | 45 | IBCocoaTouchFramework 46 | 47 | 48 | 49 | 301 50 | {320, 480} 51 | 52 | 53 | 54 | 55 | 3 56 | MQA 57 | 58 | NO 59 | NO 60 | 61 | IBCocoaTouchFramework 62 | YES 63 | 64 | 65 | 66 | 67 | 1 68 | 1 69 | 70 | IBCocoaTouchFramework 71 | NO 72 | 73 | 74 | 256 75 | {0, 0} 76 | NO 77 | YES 78 | YES 79 | IBCocoaTouchFramework 80 | 81 | 82 | YES 83 | 84 | 85 | 86 | Item 87 | IBCocoaTouchFramework 88 | 89 | 90 | 91 | 92 | 1 93 | 1 94 | 95 | IBCocoaTouchFramework 96 | NO 97 | 98 | 99 | 100 | 101 | 102 | 103 | YES 104 | 105 | 106 | delegate 107 | 108 | 109 | 110 | 4 111 | 112 | 113 | 114 | window 115 | 116 | 117 | 118 | 14 119 | 120 | 121 | 122 | viewController 123 | 124 | 125 | 126 | 28 127 | 128 | 129 | 130 | 131 | YES 132 | 133 | 0 134 | 135 | 136 | 137 | 138 | 139 | -1 140 | 141 | 142 | File's Owner 143 | 144 | 145 | 3 146 | 147 | 148 | QuartzHelpLibrary App Delegate 149 | 150 | 151 | -2 152 | 153 | 154 | 155 | 156 | 12 157 | 158 | 159 | 160 | 161 | 22 162 | 163 | 164 | YES 165 | 166 | 167 | 168 | 169 | 170 | 171 | 23 172 | 173 | 174 | 175 | 176 | 26 177 | 178 | 179 | YES 180 | 181 | 182 | 183 | 184 | 185 | 27 186 | 187 | 188 | 189 | 190 | 191 | 192 | YES 193 | 194 | YES 195 | -1.CustomClassName 196 | -2.CustomClassName 197 | 12.IBEditorWindowLastContentRect 198 | 12.IBPluginDependency 199 | 22.IBPluginDependency 200 | 23.IBPluginDependency 201 | 26.CustomClassName 202 | 26.IBPluginDependency 203 | 3.CustomClassName 204 | 3.IBPluginDependency 205 | 206 | 207 | YES 208 | UIApplication 209 | UIResponder 210 | {{525, 346}, {320, 480}} 211 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 212 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 213 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 214 | SelectTestViewController 215 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 216 | QuartzHelpLibraryAppDelegate 217 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 218 | 219 | 220 | 221 | YES 222 | 223 | 224 | 225 | 226 | 227 | YES 228 | 229 | 230 | 231 | 232 | 28 233 | 234 | 235 | 236 | YES 237 | 238 | QuartzHelpLibraryAppDelegate 239 | NSObject 240 | 241 | YES 242 | 243 | YES 244 | viewController 245 | window 246 | 247 | 248 | YES 249 | UIViewController 250 | UIWindow 251 | 252 | 253 | 254 | YES 255 | 256 | YES 257 | viewController 258 | window 259 | 260 | 261 | YES 262 | 263 | viewController 264 | UIViewController 265 | 266 | 267 | window 268 | UIWindow 269 | 270 | 271 | 272 | 273 | IBProjectSource 274 | ./Classes/QuartzHelpLibraryAppDelegate.h 275 | 276 | 277 | 278 | SelectTestViewController 279 | UITableViewController 280 | 281 | IBProjectSource 282 | ./Classes/SelectTestViewController.h 283 | 284 | 285 | 286 | 287 | 0 288 | IBCocoaTouchFramework 289 | 290 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 291 | 292 | 293 | 294 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 295 | 296 | 297 | YES 298 | 3 299 | 301 300 | 301 | 302 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/MainWindow-iPad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 768 5 | 10J869 6 | 1306 7 | 1038.35 8 | 461.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 301 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUINavigationController 17 | IBUIViewController 18 | IBUICustomObject 19 | IBUIWindow 20 | IBUINavigationBar 21 | IBUINavigationItem 22 | 23 | 24 | YES 25 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 26 | 27 | 28 | YES 29 | 30 | YES 31 | 32 | 33 | 34 | 35 | YES 36 | 37 | IBFilesOwner 38 | IBIPadFramework 39 | 40 | 41 | IBFirstResponder 42 | IBIPadFramework 43 | 44 | 45 | IBIPadFramework 46 | 47 | 48 | 49 | 1325 50 | 51 | {768, 1024} 52 | 53 | 54 | 55 | 56 | 1 57 | MSAxIDEAA 58 | 59 | NO 60 | NO 61 | 62 | 2 63 | 64 | IBIPadFramework 65 | 66 | 67 | 68 | 2 69 | 70 | 71 | 1 72 | 1 73 | 74 | IBIPadFramework 75 | NO 76 | 77 | 78 | 256 79 | {0, 0} 80 | YES 81 | YES 82 | IBIPadFramework 83 | 84 | 85 | YES 86 | 87 | 88 | 89 | Item 90 | IBIPadFramework 91 | 92 | 93 | 94 | 2 95 | 96 | 97 | 1 98 | 1 99 | 100 | IBIPadFramework 101 | NO 102 | 103 | 104 | 105 | 106 | 107 | 108 | YES 109 | 110 | 111 | delegate 112 | 113 | 114 | 115 | 21 116 | 117 | 118 | 119 | window 120 | 121 | 122 | 123 | 25 124 | 125 | 126 | 127 | viewController 128 | 129 | 130 | 131 | 38 132 | 133 | 134 | 135 | 136 | YES 137 | 138 | 0 139 | 140 | 141 | 142 | 143 | 144 | 2 145 | 146 | 147 | YES 148 | 149 | 150 | 151 | 152 | -1 153 | 154 | 155 | File's Owner 156 | 157 | 158 | 3 159 | 160 | 161 | 162 | 163 | -2 164 | 165 | 166 | 167 | 168 | 34 169 | 170 | 171 | YES 172 | 173 | 174 | 175 | 176 | 177 | 178 | 35 179 | 180 | 181 | 182 | 183 | 39 184 | 185 | 186 | YES 187 | 188 | 189 | 190 | 191 | 192 | 40 193 | 194 | 195 | 196 | 197 | 198 | 199 | YES 200 | 201 | YES 202 | -1.CustomClassName 203 | -2.CustomClassName 204 | 2.IBAttributePlaceholdersKey 205 | 2.IBEditorWindowLastContentRect 206 | 2.IBLastUsedUIStatusBarStylesToTargetRuntimesMap 207 | 2.IBPluginDependency 208 | 3.CustomClassName 209 | 3.IBPluginDependency 210 | 34.IBPluginDependency 211 | 35.IBPluginDependency 212 | 39.CustomClassName 213 | 39.IBPluginDependency 214 | 215 | 216 | YES 217 | UIApplication 218 | UIResponder 219 | 220 | YES 221 | 222 | 223 | 224 | {{637, 276}, {320, 480}} 225 | 226 | IBCocoaTouchFramework 227 | 228 | 229 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 230 | QuartzHelpLibraryAppDelegate 231 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 232 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 233 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 234 | SelectTestViewController_iPad 235 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 236 | 237 | 238 | 239 | YES 240 | 241 | 242 | 243 | 244 | 245 | YES 246 | 247 | 248 | 249 | 250 | 40 251 | 252 | 253 | 254 | YES 255 | 256 | QuartzHelpLibraryAppDelegate 257 | NSObject 258 | 259 | YES 260 | 261 | YES 262 | viewController 263 | window 264 | 265 | 266 | YES 267 | UIViewController 268 | UIWindow 269 | 270 | 271 | 272 | YES 273 | 274 | YES 275 | viewController 276 | window 277 | 278 | 279 | YES 280 | 281 | viewController 282 | UIViewController 283 | 284 | 285 | window 286 | UIWindow 287 | 288 | 289 | 290 | 291 | IBProjectSource 292 | ./Classes/QuartzHelpLibraryAppDelegate.h 293 | 294 | 295 | 296 | SelectTestViewController 297 | UITableViewController 298 | 299 | IBProjectSource 300 | ./Classes/SelectTestViewController.h 301 | 302 | 303 | 304 | SelectTestViewController_iPad 305 | SelectTestViewController 306 | 307 | IBProjectSource 308 | ./Classes/SelectTestViewController_iPad.h 309 | 310 | 311 | 312 | 313 | 0 314 | IBIPadFramework 315 | 316 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 317 | 318 | 319 | 320 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 321 | 322 | 323 | 324 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 325 | 326 | 327 | YES 328 | 3 329 | 301 330 | 331 | 332 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/QuartzHelpLibraryViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1056 5 | 10J869 6 | 1306 7 | 1038.35 8 | 461.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 301 12 | 13 | 14 | YES 15 | IBUIButton 16 | IBUIImageView 17 | IBUIView 18 | IBProxyObject 19 | 20 | 21 | YES 22 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 23 | 24 | 25 | YES 26 | 27 | YES 28 | 29 | 30 | 31 | 32 | YES 33 | 34 | IBFilesOwner 35 | IBCocoaTouchFramework 36 | 37 | 38 | IBFirstResponder 39 | IBCocoaTouchFramework 40 | 41 | 42 | 43 | 274 44 | 45 | YES 46 | 47 | 48 | 292 49 | {{20, 20}, {32, 32}} 50 | 51 | 52 | 53 | 54 | 3 55 | MQA 56 | 57 | IBCocoaTouchFramework 58 | 59 | 60 | 61 | 292 62 | {{76, 20}, {32, 32}} 63 | 64 | 65 | 66 | 67 | IBCocoaTouchFramework 68 | 69 | 70 | 71 | 292 72 | {{20, 80}, {32, 32}} 73 | 74 | 75 | 76 | 77 | IBCocoaTouchFramework 78 | 79 | 80 | 81 | 292 82 | {{76, 80}, {32, 32}} 83 | 84 | 85 | 86 | 87 | IBCocoaTouchFramework 88 | 89 | 90 | 91 | 292 92 | {{74, 347}, {173, 37}} 93 | 94 | 95 | 96 | NO 97 | IBCocoaTouchFramework 98 | 0 99 | 0 100 | 101 | Helvetica-Bold 102 | 15 103 | 16 104 | 105 | 1 106 | Open Image Picker 107 | 108 | 109 | 1 110 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 111 | 112 | 113 | 3 114 | MC41AA 115 | 116 | 117 | 118 | 119 | 319 120 | {{20, 139}, {280, 200}} 121 | 122 | 123 | 124 | 1 125 | NO 126 | IBCocoaTouchFramework 127 | 128 | 129 | {{0, 20}, {320, 460}} 130 | 131 | 132 | 133 | 134 | 3 135 | MC43NQA 136 | 137 | 2 138 | 139 | 140 | NO 141 | 142 | IBCocoaTouchFramework 143 | 144 | 145 | 146 | 147 | YES 148 | 149 | 150 | view 151 | 152 | 153 | 154 | 7 155 | 156 | 157 | 158 | openImagePicker: 159 | 160 | 161 | 7 162 | 163 | 13 164 | 165 | 166 | 167 | imageView 168 | 169 | 170 | 171 | 15 172 | 173 | 174 | 175 | 176 | YES 177 | 178 | 0 179 | 180 | 181 | 182 | 183 | 184 | -1 185 | 186 | 187 | File's Owner 188 | 189 | 190 | -2 191 | 192 | 193 | 194 | 195 | 6 196 | 197 | 198 | YES 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 8 210 | 211 | 212 | 213 | 214 | 9 215 | 216 | 217 | 218 | 219 | 10 220 | 221 | 222 | 223 | 224 | 11 225 | 226 | 227 | 228 | 229 | 12 230 | 231 | 232 | 233 | 234 | 14 235 | 236 | 237 | 238 | 239 | 240 | 241 | YES 242 | 243 | YES 244 | -1.CustomClassName 245 | -2.CustomClassName 246 | 10.CustomClassName 247 | 10.IBPluginDependency 248 | 11.CustomClassName 249 | 11.IBPluginDependency 250 | 12.IBPluginDependency 251 | 14.IBPluginDependency 252 | 6.IBEditorWindowLastContentRect 253 | 6.IBPluginDependency 254 | 8.CustomClassName 255 | 8.IBPluginDependency 256 | 9.CustomClassName 257 | 9.IBPluginDependency 258 | 259 | 260 | YES 261 | QuartzHelpLibraryViewController 262 | UIResponder 263 | TestUIImageViewFromGrayPixel 264 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 265 | TestUIImageViewFromRGBPixel 266 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 267 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 268 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 269 | {{239, 654}, {320, 480}} 270 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 271 | TestDrawCGImageFromGrayPixel 272 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 273 | TestDrawCGImageFromRGBPixel 274 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 275 | 276 | 277 | 278 | YES 279 | 280 | 281 | 282 | 283 | 284 | YES 285 | 286 | 287 | 288 | 289 | 43 290 | 291 | 292 | 293 | YES 294 | 295 | QuartzHelpLibraryViewController 296 | UIViewController 297 | 298 | openImagePicker: 299 | id 300 | 301 | 302 | openImagePicker: 303 | 304 | openImagePicker: 305 | id 306 | 307 | 308 | 309 | imageView 310 | UIImageView 311 | 312 | 313 | imageView 314 | 315 | imageView 316 | UIImageView 317 | 318 | 319 | 320 | IBProjectSource 321 | ./Classes/QuartzHelpLibraryViewController.h 322 | 323 | 324 | 325 | TestDrawCGImageFromGrayPixel 326 | UIView 327 | 328 | IBProjectSource 329 | ./Classes/TestDrawCGImageFromGrayPixel.h 330 | 331 | 332 | 333 | TestDrawCGImageFromRGBPixel 334 | UIView 335 | 336 | IBProjectSource 337 | ./Classes/TestDrawCGImageFromRGBPixel.h 338 | 339 | 340 | 341 | TestUIImageViewFromGrayPixel 342 | UIView 343 | 344 | IBProjectSource 345 | ./Classes/TestUIImageViewFromGrayPixel.h 346 | 347 | 348 | 349 | TestUIImageViewFromRGBPixel 350 | UIView 351 | 352 | IBProjectSource 353 | ./Classes/TestUIImageViewFromRGBPixel.h 354 | 355 | 356 | 357 | 358 | 0 359 | IBCocoaTouchFramework 360 | 361 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 362 | 363 | 364 | YES 365 | 3 366 | 301 367 | 368 | 369 | -------------------------------------------------------------------------------- /QuartzHelpLibrary/en.lproj/QuartzHelpLibraryViewController_iPad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1056 5 | 10J869 6 | 1306 7 | 1038.35 8 | 461.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 301 12 | 13 | 14 | YES 15 | IBUIButton 16 | IBUIImageView 17 | IBUIView 18 | IBProxyObject 19 | 20 | 21 | YES 22 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 23 | 24 | 25 | YES 26 | 27 | YES 28 | 29 | 30 | 31 | 32 | YES 33 | 34 | IBFilesOwner 35 | IBIPadFramework 36 | 37 | 38 | IBFirstResponder 39 | IBIPadFramework 40 | 41 | 42 | 43 | 292 44 | 45 | YES 46 | 47 | 48 | 292 49 | {{29, 27}, {32, 32}} 50 | 51 | 52 | 53 | 54 | 3 55 | MQA 56 | 57 | IBIPadFramework 58 | 59 | 60 | 61 | 292 62 | {{85, 27}, {32, 32}} 63 | 64 | 65 | 66 | 67 | IBIPadFramework 68 | 69 | 70 | 71 | 292 72 | {{29, 87}, {32, 32}} 73 | 74 | 75 | 76 | 77 | IBIPadFramework 78 | 79 | 80 | 81 | 292 82 | {{85, 87}, {32, 32}} 83 | 84 | 85 | 86 | 87 | IBIPadFramework 88 | 89 | 90 | 91 | 271 92 | {{155, 471}, {228, 37}} 93 | 94 | 95 | 96 | NO 97 | IBIPadFramework 98 | 0 99 | 0 100 | 101 | Helvetica-Bold 102 | 15 103 | 16 104 | 105 | 1 106 | Open Image Picker 107 | 108 | 109 | 1 110 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 111 | 112 | 113 | 3 114 | MC41AA 115 | 116 | 117 | 118 | 119 | 319 120 | {{29, 143}, {480, 320}} 121 | 122 | 123 | 124 | 1 125 | NO 126 | IBIPadFramework 127 | 128 | 129 | {{0, 20}, {1024, 748}} 130 | 131 | 132 | 133 | 134 | 1 135 | MC43MDEwODY5NTY1IDAuNzAxMDg2OTU2NSAwLjcwMTA4Njk1NjUAA 136 | 137 | NO 138 | 139 | 2 140 | 141 | 142 | 3 143 | 3 144 | 145 | IBIPadFramework 146 | 147 | 148 | 149 | 150 | YES 151 | 152 | 153 | view 154 | 155 | 156 | 157 | 3 158 | 159 | 160 | 161 | openImagePicker: 162 | 163 | 164 | 7 165 | 166 | 14 167 | 168 | 169 | 170 | imageView 171 | 172 | 173 | 174 | 21 175 | 176 | 177 | 178 | 179 | YES 180 | 181 | 0 182 | 183 | 184 | 185 | 186 | 187 | -1 188 | 189 | 190 | File's Owner 191 | 192 | 193 | -2 194 | 195 | 196 | 197 | 198 | 2 199 | 200 | 201 | YES 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 9 213 | 214 | 215 | 216 | 217 | 10 218 | 219 | 220 | 221 | 222 | 11 223 | 224 | 225 | 226 | 227 | 12 228 | 229 | 230 | 231 | 232 | 13 233 | 234 | 235 | 236 | 237 | 20 238 | 239 | 240 | 241 | 242 | 243 | 244 | YES 245 | 246 | YES 247 | -1.CustomClassName 248 | -2.CustomClassName 249 | 10.CustomClassName 250 | 10.IBPluginDependency 251 | 11.CustomClassName 252 | 11.IBPluginDependency 253 | 12.CustomClassName 254 | 12.IBPluginDependency 255 | 13.IBPluginDependency 256 | 2.IBEditorWindowLastContentRect 257 | 2.IBPluginDependency 258 | 20.IBPluginDependency 259 | 9.CustomClassName 260 | 9.IBPluginDependency 261 | 262 | 263 | YES 264 | QuartzHelpLibraryViewController 265 | UIResponder 266 | TestDrawCGImageFromRGBPixel 267 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 268 | TestUIImageViewFromGrayPixel 269 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 270 | TestUIImageViewFromRGBPixel 271 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 272 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 273 | {{353, 156}, {1024, 768}} 274 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 275 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 276 | TestDrawCGImageFromGrayPixel 277 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 278 | 279 | 280 | 281 | YES 282 | 283 | 284 | 285 | 286 | 287 | YES 288 | 289 | 290 | 291 | 292 | 48 293 | 294 | 295 | 296 | YES 297 | 298 | QuartzHelpLibraryViewController 299 | UIViewController 300 | 301 | openImagePicker: 302 | id 303 | 304 | 305 | openImagePicker: 306 | 307 | openImagePicker: 308 | id 309 | 310 | 311 | 312 | imageView 313 | UIImageView 314 | 315 | 316 | imageView 317 | 318 | imageView 319 | UIImageView 320 | 321 | 322 | 323 | IBProjectSource 324 | ./Classes/QuartzHelpLibraryViewController.h 325 | 326 | 327 | 328 | TestDrawCGImageFromGrayPixel 329 | UIView 330 | 331 | IBProjectSource 332 | ./Classes/TestDrawCGImageFromGrayPixel.h 333 | 334 | 335 | 336 | TestDrawCGImageFromRGBPixel 337 | UIView 338 | 339 | IBProjectSource 340 | ./Classes/TestDrawCGImageFromRGBPixel.h 341 | 342 | 343 | 344 | TestUIImageViewFromGrayPixel 345 | UIView 346 | 347 | IBProjectSource 348 | ./Classes/TestUIImageViewFromGrayPixel.h 349 | 350 | 351 | 352 | TestUIImageViewFromRGBPixel 353 | UIView 354 | 355 | IBProjectSource 356 | ./Classes/TestUIImageViewFromRGBPixel.h 357 | 358 | 359 | 360 | 361 | 0 362 | IBIPadFramework 363 | 364 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 365 | 366 | 367 | YES 368 | 3 369 | 301 370 | 371 | 372 | --------------------------------------------------------------------------------