Hi guys, I'm new to plug-in development and having a bit of trouble with storing information to the photoshop registry. My plug-in has two buttons, "capture" and "apply". When the capture button is pressed, the filter needs to grab whatever image data has focus. Then the user would give a different image focus, run the filter again and press "apply", transfering information from the captured image to the new image. The problem is that filter memory is wiped between executions so I need to save the captured image to the registry (I think anyway, please let me know if there's anything easier I could be doing).
Anyway, I'm modifying the dissolve example from the SDK, I'm in DissolveRegistry.cpp
In dissolve.h I define an image buffer and it's length
Ptr transferBuffer;
|
Then in DissolveRegistry.cpp I try to write and read this information as follows
//WRITE BUFFER
| err = descriptorProcs->PutInteger(descriptor, keyTransferLength, gData->transferBufferLength); if (err) goto returnError; err = descriptorProcs->PutData(descriptor, KeyTransfer, gData->transferBufferLength, gData->transferBuffer); if (err) goto returnError;
//READ BUFFER |
err = descriptorProcs->GetInteger(descriptor, keyTransferLength, &gData->transferBufferLength); | |
if (err) goto returnError; | |
err = descriptorProcs->GetData(descriptor, KeyTransfer, gData->transferBuffer); | |
if (err) goto returnError; |
It seems to write okay (by okay I mean it doesn't actually throw an error), and the buffer length seems to be working okay (unless I'm missunderstanding my debugger). When I try to read the buffer though, I get a "bad pointer" error. I guess I don't understand how the PutData function works, does it not set the pointer to the buffer I saved? Does anyone have any example code for how to do this correctly?
Sorry if this code is terrible. I have almost no experience with this sort of thing and I can't find any documentation. Any help would be much appreciated!
Kindest Regards,
Eric