RE: NSImageView PICTRepresentation?
RE: NSImageView PICTRepresentation?
- Subject: RE: NSImageView PICTRepresentation?
- From: email@hidden (Heinrich Giesen)
- Date: Sat, 9 Oct 2004 11:09:12 +0200
Baring that, the only way (at least that I know) to get PICT data
would be
to get the bitmap pixels directly and then use Quickdraw to make a
PICT with that
data. Of how to do that, I remain cheerfully innocent.
Bascially, what you would end up doing is putting the pixels into a
GWorld, Asking the GWorld to record a picture, and then using CopyBits
to copy the pixels back on top of themselves.
Another way to do it would be to get the pixels and ask QuickTime to
export a PICT image of those pixels for you.
Scott
There is a much simpler way to create a NSPICTImageRep:
first you prepare a pasteBoard:
NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:self];
and now look, what types will be available:
NSArray *types = [pb types];
int i;
for( i=0; i<[types count]; i++ ){
NSLog( @"type %d : %@\n", i, [types objectAtIndex:i] );
}
and find (text abbreviated):
** [1158] type 0 : NeXT TIFF v4.0 pasteboard type
** [1158] type 1 : Apple PICT pasteboard type
Later you will be asked to feed the pasteBoard with tiff-data
(and only tiff-data):
- (void) pasteboard:(NSPasteboard *)sender provideDataForType:(NSString *)type
{
NSBitmapImageRep *theRep;
NSLog( @"provideDataForType %@\n", type );
theRep = [NSImageRep imageRepWithContentsOfFile: pathToAjpegFile ];
[sender setData:[theRep TIFFRepresentation] forType:type];
}
There you are. You can now read data of type NSPICTPboardType from the pastBoard.
The pasteBoard did the conversion from TIFF to PICT for you.
Heinrich Giesen
--
Heinrich Giesen
Ostring 60
56281 Emmelshausen
Fon/Fax : +49 6747 8392
email : email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden