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];
|
NSString *filepath = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
|
||||||
int imageNo = 1;
|
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]];
|
NSString *pathToPic = [filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"oolite-%03d.png",imageNo]];
|
||||||
|
|
||||||
while ([[NSFileManager defaultManager] fileExistsAtPath:pathToPic])
|
while ([[NSFileManager defaultManager] fileExistsAtPath:pathToPic])
|
||||||
@ -274,10 +288,9 @@ Your fair use and other rights are in no way affected by the above.
|
|||||||
imageNo++;
|
imageNo++;
|
||||||
pathToPic = [filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"oolite-%03d.png",imageNo]];
|
pathToPic = [filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"oolite-%03d.png",imageNo]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// NSString *pathToTiff = [[pathToPic stringByDeletingPathExtension] stringByAppendingPathExtension:@"tiff"];
|
NSString *pathToPng = [[pathToPic stringByDeletingPathExtension] stringByAppendingPathExtension:@"png"];
|
||||||
// NSString *pathToJpeg = [[pathToPic stringByDeletingPathExtension] stringByAppendingPathExtension:@"jpg"];
|
#endif
|
||||||
NSString *pathToPng = [[pathToPic stringByDeletingPathExtension] stringByAppendingPathExtension:@"png"];
|
|
||||||
|
|
||||||
NSLog(@">>>>> Snapshot %d x %d file path chosen = %@", w, h, pathToPic);
|
NSLog(@">>>>> Snapshot %d x %d file path chosen = %@", w, h, pathToPic);
|
||||||
|
|
||||||
@ -318,9 +331,11 @@ 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]]
|
// [[bitmapRep representationUsingType:NSJPEGFileType properties:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:0.75], NSImageCompressionFactor, NULL]]
|
||||||
// writeToFile:pathToJpeg atomically:YES]; // save JPEG representation of Image
|
// writeToFile:pathToJpeg atomically:YES]; // save JPEG representation of Image
|
||||||
#ifdef GNUSTEP
|
#ifdef GNUSTEP
|
||||||
[[bitmapRep representationUsingType:NSPNGFileType properties:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], nil, NULL]]
|
NSImage *image=[[NSImage alloc] initWithSize:NSMakeSize(w,h)];
|
||||||
writeToFile:pathToPng atomically:YES]; // save PNG representation of Image
|
[image addRepresentation:bitmapRep];
|
||||||
|
[[image TIFFRepresentation] writeToFile:pathToPic atomically:YES];
|
||||||
|
[image release];
|
||||||
#else
|
#else
|
||||||
[[bitmapRep representationUsingType:NSPNGFileType properties:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSImageInterlaced, NULL]]
|
[[bitmapRep representationUsingType:NSPNGFileType properties:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSImageInterlaced, NULL]]
|
||||||
writeToFile:pathToPng atomically:YES]; // save PNG representation of Image
|
writeToFile:pathToPng atomically:YES]; // save PNG representation of Image
|
||||||
|
Loading…
x
Reference in New Issue
Block a user