Sunday, April 4, 2010

How to get image data from hidden...

For example, we want to preview an image in automation plug-in. The code is like this:

In Hidden filter project:



HERROR(sPSActionDescriptor-%26gt;PutData(descriptor,

keyDatum,

gFilterRecord-%26gt;planes * nWidth * nHeight,

gFilterRecord-%26gt;inData));



...



In Automation project:



unsigned char *lpBits;



//lpBits = (unsigned char*)malloc(m_nWidth * m_nHeight);



hasKey = false;

(void)sPSActionDescriptor-%26gt;HasKey(result.get(), keyDatum, %26amp;hasKey);



if (hasKey)

{

AFERROR(sPSActionDescriptor-%26gt;GetData(result.get(), keyDatum, lpBits));

}

...



Alert program error!



Please tell me what to do. Thanks a lot.
How to get image data from hidden...
You need malloc the memory in your automation plug-in, give that pointer to your filter plug-in, get the data in your filter and COPY it over to the pointer. Then your code will work. In your current version the memory is no longer there once your filter is unloaded from memory.



I had this example in earlier versions of the SDK but this way is not ideal. Ideally you want to do all filtering operations in your filter plug-in because you are going to have to do a lot of copy paste of pixel data which is going to be expensive. Try to re-work your plug-in to keep the pixel get/set inside the plug-in.



See the latest version of the AutomationFilter / Hidden examples in the SDK.
How to get image data from hidden...
Thank you very much.

No comments:

Post a Comment