Permalink
Browse files

indentation of sources...better use spaces

  • Loading branch information...
1 parent 8527748 commit d3e2f757b4d60ae53f79bc9ae40cedbbee99e28b Edward Patel committed May 5, 2009
Showing with 29 additions and 29 deletions.
  1. +29 −29 Cocoa/tagimg/tagimg.m
View
@@ -9,25 +9,25 @@
int main (int argc, const char * argv[]) {
[NSApplication sharedApplication];
-
+
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-
+
if (argc == 3) {
-
- NSString *filename = [NSString stringWithFormat:@"%s", argv[1]];
- NSString *extension = [filename pathExtension];
-
- if ([extension caseInsensitiveCompare:@"png"] != NSOrderedSame) {
- printf("Image file should be a .png file\n");
- return -1;
- }
-
+
+ NSString *filename = [NSString stringWithFormat:@"%s", argv[1]];
+ NSString *extension = [filename pathExtension];
+
+ if ([extension caseInsensitiveCompare:@"png"] != NSOrderedSame) {
+ printf("Image file should be a .png file\n");
+ return -1;
+ }
+
NSImage *image = [[NSImage alloc] initWithContentsOfFile:filename];
-
+
if (image) {
-
+
[image lockFocus];
-
+
NSString *string = [NSString stringWithFormat:@"%@\n%s", [NSDate date], argv[2]];
NSShadow *shadow = [[[NSShadow alloc] init] autorelease];
@@ -37,38 +37,38 @@ int main (int argc, const char * argv[]) {
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
[attributes setObject:[NSColor whiteColor]
- forKey:NSForegroundColorAttributeName];
+ forKey:NSForegroundColorAttributeName];
[attributes setObject:[NSFont fontWithName:@"Andale Mono" size:14]
- forKey:NSFontAttributeName];
+ forKey:NSFontAttributeName];
[attributes setObject:shadow
- forKey:NSShadowAttributeName];
-
+ forKey:NSShadowAttributeName];
+
[string drawAtPoint:NSMakePoint(10, 10) withAttributes:attributes];
-
+
[image unlockFocus];
-
+
NSBitmapImageRep *bits = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
-
+
NSData *data = [bits representationUsingType:NSPNGFileType
- properties:nil];
-
+ properties:nil];
+
[data writeToFile:filename atomically:YES];
-
+
} else {
printf("Could not open file '%s'\n", argv[1]);
- return -1;
+ return -1;
}
} else {
printf("Usage: tagimg <filename.png> <text>\n");
- return -1;
-
+ return -1;
+
}
-
+
[pool drain];
-
+
return 0;
}

0 comments on commit d3e2f75

Please sign in to comment.