fix screenshots
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@34 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
e30fdfb6fc
commit
58c0f6866a
@ -267,6 +267,20 @@ Your fair use and other rights are in no way affected by the above.
|
||||
|
||||
NSString *filepath = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
|
||||
int imageNo = 1;
|
||||
|
||||
// In the GNUstep source, representationUsingType is marked as
|
||||
// TODO: and does nothing but return NIL! So for GNUstep we fall
|
||||
// back to the methods used in oolite 1.30.
|
||||
#ifdef GNUSTEP
|
||||
NSString *pathToPic =
|
||||
[filepath stringByAppendingPathComponent:
|
||||
[NSString stringWithFormat:@"oolite-%03d.tiff",imageNo]];
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:pathToPic])
|
||||
{
|
||||
imageNo++;
|
||||
pathToPic = [filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"oolite-%03d.tiff",imageNo]];
|
||||
}
|
||||
#else
|
||||
NSString *pathToPic = [filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"oolite-%03d.png",imageNo]];
|
||||
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:pathToPic])
|
||||
@ -275,9 +289,8 @@ Your fair use and other rights are in no way affected by the above.
|
||||
pathToPic = [filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"oolite-%03d.png",imageNo]];
|
||||
}
|
||||
|
||||
// NSString *pathToTiff = [[pathToPic stringByDeletingPathExtension] stringByAppendingPathExtension:@"tiff"];
|
||||
// NSString *pathToJpeg = [[pathToPic stringByDeletingPathExtension] stringByAppendingPathExtension:@"jpg"];
|
||||
NSString *pathToPng = [[pathToPic stringByDeletingPathExtension] stringByAppendingPathExtension:@"png"];
|
||||
#endif
|
||||
|
||||
NSLog(@">>>>> Snapshot %d x %d file path chosen = %@", w, h, pathToPic);
|
||||
|
||||
@ -319,8 +332,10 @@ Your fair use and other rights are in no way affected by the above.
|
||||
// [[bitmapRep representationUsingType:NSJPEGFileType properties:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:0.75], NSImageCompressionFactor, NULL]]
|
||||
// writeToFile:pathToJpeg atomically:YES]; // save JPEG representation of Image
|
||||
#ifdef GNUSTEP
|
||||
[[bitmapRep representationUsingType:NSPNGFileType properties:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], nil, NULL]]
|
||||
writeToFile:pathToPng atomically:YES]; // save PNG representation of Image
|
||||
NSImage *image=[[NSImage alloc] initWithSize:NSMakeSize(w,h)];
|
||||
[image addRepresentation:bitmapRep];
|
||||
[[image TIFFRepresentation] writeToFile:pathToPic atomically:YES];
|
||||
[image release];
|
||||
#else
|
||||
[[bitmapRep representationUsingType:NSPNGFileType properties:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSImageInterlaced, NULL]]
|
||||
writeToFile:pathToPng atomically:YES]; // save PNG representation of Image
|
||||
|
Loading…
x
Reference in New Issue
Block a user