[futurebasic] Re: [FB] Tiff file advice needed

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2007 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Sun, 9 Dec 2007 17:54:05 +1300
Joe Lertola wrote:

>> You would use GraphicsExportSetInputCGBitmapContext instead of  
>> GraphicsExportSetInputGWorld. The C declaration is:
>>
>> extern ComponentResult
>> GraphicsExportSetInputCGBitmapContext(
>> GraphicsExportComponent   ci,
>> CGContextRef              bitmapContextRef);
>>
>> Implementing it will need the function-pointer-and-glue palaver  
>> that you already use for GraphicsImportCreateCGImage.

> Thanks thats great. I put together a demo below that is based on  
> your function. It creates a CGBitmapContext and saves it as a Tiff  
> file. I would like to have more control over how the file is saved  
> though. Specifically I would like to be able to specify the  
> compression method and I would also like to specify the byte order.  
> Do you think Quicktime, Core Graphics, Quartz or Core Image provide  
> any functions to do that? I have spent a lot of time looking through  
> the developer documentation the last two days and I feel lost.

GraphicsExportRequestSettings()


#if def _FBtoC
toolbox fn GraphicsExportRequestSettings( GraphicsExportComponent ci,  
ModalFilterYDUPP filterProc, ptr yourDataProc) = ComponentResult
#else
...dog-and-pony glue in FB
#endif

local mode
local fn WriteBitmapToFile( fileSpec as ^FSSpec, format as OSType, ctx  
as CGContextRef )
'~'1
dim as GraphicsExportComponent @ ge
dim as ComponentResult err, ignore

err = fn OpenADefaultComponent( _"grex", format, @ge )
long if ( err == _noErr )
err = fn GraphicsExportRequestSettings( ge, 0, 0 )
if ( err == _noErr ) then err = fn  
GraphicsExportSetInputCGBitmapContext( ge, ctx )
if ( err == _noErr ) then err = fn GraphicsExportSetOutputFile( ge,  
#fileSpec )
if ( err == _noErr ) then err = fn GraphicsExportDoExport( ge, #0 )
ignore = fn CloseComponent( ge )
end if
end fn = err


Robert P.