On Apr 28, 2007, at 5:47 PM, Thomas Cunningham wrote:

> Looking for some more help with callbacks. A few questions if I  
> might. This
> is from Apple Docs.
>
>   Defines a CGFunction evaluator callback type.
>
>   typedef void (*CGFunctionEvaluateCallback) (
>   void *info,
>   const float *inData,
>   float *outData
>   );
>
>   If you name your function MyCGFunctionEvaluate, you would declare  
> it like
> this:
>
>   void MyCGFunctionEvaluate (
>   void *info,
>   const float *inData,
>   float *outData
>   );
>
> 1) I want to confirm that my Rb Routine parameters are correct? I  
> have this,
>
> RedBlackRedRampEvaluate(ByRef info As MemoryBlock, inValue As  
> MemoryBlock,
> ByRef outValue As MemoryBlock)
>
> I've also tried defining these parameters as Ptr with ByRef and  
> without.
> However, when I pass the AddressOf RedBlackRedRampEvaluate to a  
> declare I am
> using, the items in this routine are not doing anything to, in this  
> case,
> change colors properly. At least  I think this is where it is failing.
>
> 2) What is the sequence of calls and events when you pass an  
> AddressOf call?
> It looks like the routine and its associated code is executed, right?
>
> 3) Since we don't pass the parameters required for this evaluator  
> function
> via our call to AddressOf, how does it find these properties? i.e.  
> info,
> inData, outData.
>
> 4) Unrelated to callbacks, but ... In this line of code,
>
> const float *inData
>
> The constant keyword indicates that once it is set it can not be  
> changed.
> The * indicates Dereference(indirect value). How can I duplicate these
> "rules" or do I need to care?

In this case, you need to examine the documentation for  
CGFunctionEvaluateCallback.  The second and third parameters are  
arrays of type float whose sizes you supplied to CGFunctionCreate.   
Probably you should declare all three parameters to be of type  
MemoryBlock.

Sub RedBlackRedRampEvaluate(info as MemoryBlock, inValue as  
MemoryBlock, outValue as MemoryBlock)

You might want to post your code for CGFunctionCreate; that has to be  
done correctly for the callbacks to work.


Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to