From: Charles S. <bas...@ch...> - 2012-06-18 20:51:57
|
On Jun 18, 2012, at 2:05 PM, Robert Munafo wrote: > On 6/18/12, Charles Srstka <bas...@ch...> wrote: >> Are there any OS X / Windows apps that currently accept pasteboard data in >> PICT format though? > > No, that's why SheepShaver converts it. Here are the steps, to make it clear: > > 1. I start SheepShaver, and start my old app within SheepShaver. > 2. Copy to clipboard. > 3. Switch to Snow Leopard's TextEdit, hit Paste. > 4. I get my image, with the original bitmap image and the label text > nicely rendered below it. > > Somewhere in the process (SheepShaver and/or TextEdit) it has turned > the PICT, including the label text, into a TIFF image. > > The text is there because something in the Carbon libraries is making > it happen. But it we use that stand-alone PICT conversion library > instead of Carbon, the text label would be missing. Out of curiosity, would you mind trying -[NSImage imageWithData:] on one of your PICT files with the text label? I am curious whether NSImage preserves the label text or not. Here’s the code for a minimal PICT viewer app: @interface Document () @property (copy) NSImage *image; @end @implementation Document @synthesize image = _image; - (NSString *)windowNibName { return @"Document"; } + (BOOL)autosavesInPlace { return NO; } - (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError { NSException *exception = [NSException exceptionWithName:@"UnimplementedMethod" reason:[NSString stringWithFormat:@"%@ is unimplemented", NSStringFromSelector(_cmd)] userInfo:nil]; @throw exception; return nil; } - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError { self.image = [[NSImage alloc] initWithData:data]; if(self.image == nil) { if(outError) *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:nil]; return NO; } return YES; } - (IBAction)convertToTIFF:(id)sender { NSSavePanel *sp = [NSSavePanel savePanel]; sp.allowedFileTypes = [NSArray arrayWithObject:(__bridge NSString *)kUTTypeTIFF]; [sp beginSheetModalForWindow:self.windowForSheet completionHandler:^(NSInteger result) { if(result != NSFileHandlingPanelOKButton) { return; } NSError *error = nil; if(![self.image.TIFFRepresentation writeToURL:sp.URL options:NSDataWritingAtomic error:&error]) { [self presentError:error]; } }]; } @end If you don’t have the dev tools installed or would just prefer for me to send me a binary, let me know. Thanks, Charles |