• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSImage to PICT (corrected)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage to PICT (corrected)


  • Subject: Re: NSImage to PICT (corrected)
  • From: olivier <email@hidden>
  • Date: Wed, 23 Jul 2003 12:37:37 -0500

i was too quick to post, here is the same code without the typo:


#import <QuickTime/QuickTime.h>


@implementation NSImage (pictExport)
- (NSData*) pictRepresentation
{
MovieImportComponent importer;

if (OpenADefaultComponent(GraphicsImporterComponentType,
kQTFileTypeTIFF, &importer) != noErr)
{
CloseComponent(importer);
return nil;
}

Handle imageHandle;
NSData *imageData = [self TIFFRepresentation];
long int dataSize = [imageData length];
(void)PtrToHand([imageData bytes], &imageHandle, dataSize);

OSErr err = GraphicsImportSetDataHandle(importer, imageHandle);
if (err != noErr)
{
return nil;
}

PicHandle resultPicHandle = (PicHandle)NewHandleClear(20);
err = GraphicsImportGetAsPicture(importer, &resultPicHandle) ;

NSData *returnValue = [NSData dataWithBytes:*resultPicHandle
length:(int)GetHandleSize((Handle)resultPicHandle)];
DisposeHandle((Handle)resultPicHandle);

return returnValue;
}
@end
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSImage to PICT (From: olivier <email@hidden>)

  • Prev by Date: Re: Why are my toolbar items disabled?
  • Next by Date: Re: Bug reports and documentation updates
  • Previous by thread: NSImage to PICT
  • Next by thread: Re: Why are my toolbar items disabled?
  • Index(es):
    • Date
    • Thread