• 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
saing files in carbon(QT) from cocoa. help!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

saing files in carbon(QT) from cocoa. help!


  • Subject: saing files in carbon(QT) from cocoa. help!
  • From: eblueBeta <email@hidden>
  • Date: Mon, 13 Aug 2001 17:15:08 -0400

problems abound when I try to save a file from cocoa, through carbon.

I want to use the cocoa NSSavePanel class, and its resulting filename (in an NSString) to determine the filename.
problems are:
1. no documenttation on how to turn a NSString* into an FSSpec
2. a Technote (TN2022) specifically states that FSSpec is dead for file creation, use the completely undocumented: FileUrl instead.
3. number 2 does not jive with the QuickTime specification at all, it seems that it Only accepts FSSpec for saving to files

I have made several passes at this, the carbon specification is quite profuse and disorganized, and the cocoa api's are very little help, in this area.

the ironic thing is, if my needs were slightly more generic i could use the universal Quicktime save dialog, which does a ton of work, for me, but alas it is inadequate for my needs.

here's an example of the structure i need to implement:

- (IBAction)saveButton:(id)sender
{
// variables
NSData* theRep;
Handle h;
NSSavePanel *savePanel;
int result;
GraphicsImportComponent gi = 0;
GraphicsExportComponent ci = 0;

// not variables
savePanel = [NSSavePanel savePanel];
[savePanel setRequiredFileType:@"pct"];
// result = invoke a save dialog
result = [savePanel runModalForDirectory:NSHomeDirectory() file:[imageName stringValue]];
if (result == NSOKButton)
{
// in here we do our thing
//[savePanel fileName] is the string we want to use
theRep = [[imageView image] TIFFRepresentation]; // use the tiff ref to make qt import it use tiff bc its supported better in cocoa
PtrToHand([theRep bytes],&h,[theRep length]);
OpenADefaultComponent(GraphicsImporterComponentType, kQTFileTypeTIFF,&gi);
GraphicsImportSetDataHandle( gi, h);
// at this point i have a handle to the tiff, but no data for the exporter...
if(GraphicsExporterSetInputGraphicsImporter(ci,gi)) // if i can get an exporter...
{

// this is where documentation and samples fail to illuminate me
//
//
// i need to make a FSSpec from [savePanel fileName];
// heres an example of what i want to do
GraphicsExportSetOutputFile(ci, FSSpec* theFile);
GraphicsExportWriteOutputData(ci, void *dataPtr, unsigned Long dataSize);

CloseComponent(ci); // dispose of the handle
}
CloseComponent(gi);
if(h) DisposeHandle(h);
}

}


obi wan you are my only hope...


  • Prev by Date: Re: custom view in NSTableView
  • Next by Date: Re: ObjectAlloc -- not able to use with debugger launched app?
  • Previous by thread: Re: ObjectAlloc -- not able to use with debugger launched app?
  • Next by thread: Re: NSStepper
  • Index(es):
    • Date
    • Thread