Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit a6988d218f18b05b42847a79a9b57d358a391992 @kishikawakatsumi committed Apr 29, 2009
Showing with 1,327 additions and 0 deletions.
  1. +10 −0 .gitignore
  2. +22 −0 Classes/TiledLayerViewAppDelegate.h
  3. +28 −0 Classes/TiledLayerViewAppDelegate.m
  4. +19 −0 Classes/TiledLayerViewController.h
  5. +42 −0 Classes/TiledLayerViewController.m
  6. +18 −0 Classes/TiledView.h
  7. +53 −0 Classes/TiledView.m
  8. +30 −0 Info.plist
  9. +224 −0 MainWindow.xib
  10. +32 −0 README
  11. +673 −0 TiledLayerView.xcodeproj/project.pbxproj
  12. +151 −0 TiledLayerViewViewController.xib
  13. +8 −0 TiledLayerView_Prefix.pch
  14. BIN image-01-01.jpg
  15. BIN image-01-02.jpg
  16. BIN image-01-03.jpg
  17. BIN image-01-04.jpg
  18. BIN image-01-05.jpg
  19. BIN image-01-06.jpg
  20. BIN image-01-07.jpg
  21. BIN image-01-08.jpg
  22. BIN image-01-09.jpg
  23. BIN image-01-10.jpg
  24. BIN image-02-01.jpg
  25. BIN image-02-02.jpg
  26. BIN image-02-03.jpg
  27. BIN image-02-04.jpg
  28. BIN image-02-05.jpg
  29. BIN image-02-06.jpg
  30. BIN image-02-07.jpg
  31. BIN image-02-08.jpg
  32. BIN image-02-09.jpg
  33. BIN image-02-10.jpg
  34. BIN image-03-01.jpg
  35. BIN image-03-02.jpg
  36. BIN image-03-03.jpg
  37. BIN image-03-04.jpg
  38. BIN image-03-05.jpg
  39. BIN image-03-06.jpg
  40. BIN image-03-07.jpg
  41. BIN image-03-08.jpg
  42. BIN image-03-09.jpg
  43. BIN image-03-10.jpg
  44. BIN image-04-01.jpg
  45. BIN image-04-02.jpg
  46. BIN image-04-03.jpg
  47. BIN image-04-04.jpg
  48. BIN image-04-05.jpg
  49. BIN image-04-06.jpg
  50. BIN image-04-07.jpg
  51. BIN image-04-08.jpg
  52. BIN image-04-09.jpg
  53. BIN image-04-10.jpg
  54. BIN image-05-01.jpg
  55. BIN image-05-02.jpg
  56. BIN image-05-03.jpg
  57. BIN image-05-04.jpg
  58. BIN image-05-05.jpg
  59. BIN image-05-06.jpg
  60. BIN image-05-07.jpg
  61. BIN image-05-08.jpg
  62. BIN image-05-09.jpg
  63. BIN image-05-10.jpg
  64. BIN image-06-01.jpg
  65. BIN image-06-02.jpg
  66. BIN image-06-03.jpg
  67. BIN image-06-04.jpg
  68. BIN image-06-05.jpg
  69. BIN image-06-06.jpg
  70. BIN image-06-07.jpg
  71. BIN image-06-08.jpg
  72. BIN image-06-09.jpg
  73. BIN image-06-10.jpg
  74. BIN image-07-01.jpg
  75. BIN image-07-02.jpg
  76. BIN image-07-03.jpg
  77. BIN image-07-04.jpg
  78. BIN image-07-05.jpg
  79. BIN image-07-06.jpg
  80. BIN image-07-07.jpg
  81. BIN image-07-08.jpg
  82. BIN image-07-09.jpg
  83. BIN image-07-10.jpg
  84. BIN image-08-01.jpg
  85. BIN image-08-02.jpg
  86. BIN image-08-03.jpg
  87. BIN image-08-04.jpg
  88. BIN image-08-05.jpg
  89. BIN image-08-06.jpg
  90. BIN image-08-07.jpg
  91. BIN image-08-08.jpg
  92. BIN image-08-09.jpg
  93. BIN image-08-10.jpg
  94. BIN image-09-01.jpg
  95. BIN image-09-02.jpg
  96. BIN image-09-03.jpg
  97. BIN image-09-04.jpg
  98. BIN image-09-05.jpg
  99. BIN image-09-06.jpg
  100. BIN image-09-07.jpg
  101. BIN image-09-08.jpg
  102. BIN image-09-09.jpg
  103. BIN image-09-10.jpg
  104. BIN image-10-01.jpg
  105. BIN image-10-02.jpg
  106. BIN image-10-03.jpg
  107. BIN image-10-04.jpg
  108. BIN image-10-05.jpg
  109. BIN image-10-06.jpg
  110. BIN image-10-07.jpg
  111. BIN image-10-08.jpg
  112. BIN image-10-09.jpg
  113. BIN image-10-10.jpg
  114. +17 −0 main.m
  115. BIN original_image.jpg
@@ -0,0 +1,10 @@
+build
+.DS_Store
+*.o
+*.ob
+*.pbxuser
+*.tmproj
+*.mode1*
+*.build
+*~.nib
+
@@ -0,0 +1,22 @@
+//
+// TiledLayerViewAppDelegate.h
+// TiledLayerView
+//
+// Created by KISHIKAWA Katsumi on 09/04/29.
+// Copyright KISHIKAWA Katsumi 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class TiledLayerViewController;
+
+@interface TiledLayerViewAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ TiledLayerViewController *viewController;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet TiledLayerViewController *viewController;
+
+@end
+
@@ -0,0 +1,28 @@
+//
+// TiledLayerViewAppDelegate.m
+// TiledLayerView
+//
+// Created by KISHIKAWA Katsumi on 09/04/29.
+// Copyright KISHIKAWA Katsumi 2009. All rights reserved.
+//
+
+#import "TiledLayerViewAppDelegate.h"
+#import "TiledLayerViewController.h"
+
+@implementation TiledLayerViewAppDelegate
+
+@synthesize window;
+@synthesize viewController;
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+ [window addSubview:viewController.view];
+ [window makeKeyAndVisible];
+}
+
+- (void)dealloc {
+ [viewController release];
+ [window release];
+ [super dealloc];
+}
+
+@end
@@ -0,0 +1,19 @@
+//
+// TiledLayerViewViewController.h
+// TiledLayerView
+//
+// Created by KISHIKAWA Katsumi on 09/04/29.
+// Copyright KISHIKAWA Katsumi 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class TiledView;
+
+@interface TiledLayerViewController : UIViewController {
+ UIScrollView *scrollView;
+ TiledView *tiledView;
+}
+
+@end
+
@@ -0,0 +1,42 @@
+//
+// TiledLayerViewViewController.m
+// TiledLayerView
+//
+// Created by KISHIKAWA Katsumi on 09/04/29.
+// Copyright KISHIKAWA Katsumi 2009. All rights reserved.
+//
+
+#import "TiledLayerViewController.h"
+#import "TiledView.h"
+
+@implementation TiledLayerViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ tiledView = [[TiledView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 2448.0f, 3264.0f)];
+ tiledView.tiledLayer.tileSize = CGSizeMake(245.0f, 327.0f);
+ tiledView.tiledLayer.levelsOfDetail = 1;
+ tiledView.tiledLayer.levelsOfDetailBias = 0;
+
+ scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 460.0f)];
+ scrollView.contentSize = tiledView.bounds.size;
+ scrollView.maximumZoomScale = 4.0f;
+ scrollView.minimumZoomScale = 0.5f;
+ scrollView.delegate = tiledView;
+ [scrollView addSubview:tiledView];
+
+ [self.view addSubview:scrollView];
+}
+
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+}
+
+- (void)dealloc {
+ [scrollView release];
+ [tiledView release];
+ [super dealloc];
+}
+
+@end
@@ -0,0 +1,18 @@
+//
+// TiledView.h
+// TSRM
+//
+// Created by KISHIKAWA Katsumi on 09/04/26.
+// Copyright 2009 KISHIKAWA Katsumi. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <QuartzCore/QuartzCore.h>
+
+@interface TiledView : UIView <UIScrollViewDelegate> {
+ CATiledLayer *tiledLayer;
+}
+
+@property (nonatomic, readonly) CATiledLayer *tiledLayer;
+
+@end
@@ -0,0 +1,53 @@
+//
+// TiledView.m
+// TSRM
+//
+// Created by KISHIKAWA Katsumi on 09/04/26.
+// Copyright 2009 KISHIKAWA Katsumi. All rights reserved.
+//
+
+#import "TiledView.h"
+
+@implementation TiledView
+
++ (Class)layerClass {
+ return [CATiledLayer class];
+}
+
+- (CATiledLayer *)tiledLayer {
+ return (CATiledLayer *)self.layer;
+}
+
+- (void)drawRect:(CGRect)rect {
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ CGAffineTransform t = CGContextGetCTM(context);
+
+ int xmin = CGRectGetMinX(rect);
+ int ymin = CGRectGetMinY(rect);
+ int xmax = CGRectGetMaxX(rect);
+ int ymax = CGRectGetMaxY(rect);
+ int x = xmin / CGRectGetWidth(rect);
+ int y = ymin / CGRectGetHeight(rect);
+
+ NSLog(@"%@", [NSString stringWithFormat:@"%gx [%d,%d] (%d,%d)-(%d,%d)", t.a, x, y, xmin, ymin, xmax, ymax]);
+
+ NSString *fileName = [NSString stringWithFormat:@"image-%02d-%02d.jpg", x + 1, y + 1];
+ UIImage *image = [UIImage imageNamed:fileName];
+ [image drawInRect:rect];
+}
+
+- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView {
+ [self setNeedsDisplay];
+ return NO;
+}
+
+- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
+ return self;
+}
+
+- (void)dealloc {
+ [tiledLayer release];
+ [super dealloc];
+}
+
+@end
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+</dict>
+</plist>
Oops, something went wrong.

0 comments on commit a6988d2

Please sign in to comment.