In this sample you have a class-level GdPictureImaging object and a form on which you have a GdViewer control. When the GdPictureImaging object acquires an image, it is thereafter referenced by its imageID, which is understood by the GdPictureImaging object, which, presumably, maintains an internal list of images (hash table?) referenced by their IDs. I don't see how this imageID could also be meaningful to the viewer control, which appears to know nothing about the GdPictureImaging object, the presumed sole repository of the images and image pointer list.
I'm sure it works (my TWAIN devices are on order so I have not tried it yet), but for the life of me I don't understand why. The answer is probably obvious, but I'm not seeing it.
Am I correct about some sort of image list inside GdPictureImaging, and, if I am, do these accumulate on a multi-page scan, thus building up in memory? Or are they disposed as they are processed? If only one is ever alive at one time, one wonders why an ImageID would be needed as a reference.
Here an overview of how image are handled in GdPicture.NET:
GdPicture.NET handles a kind of stack which handle 0 to N images. This stack is private in GdPicture.NET, this means that final user can't access it. Each image in the stack is identified bu an ID called (ImageID).
All GdViewer & GdPictureImaging objects created have access to this stack. This mean you will be able to access synchronously the same image by X objects (can be GdPictureImaging and/or GdViewer).
By the way, each GdPictureImaging will be able to handle X different images. To release a particulat image to the stack, just use the ReleaseGdPictureImage method.
Hope this bring you some lights...
With best regards,
It is clear that this must be the case. But how? I don't see where GdViewer is given a reference to GdPictureImaging.
>To release a particulat image to the stack, just use the ReleaseGdPictureImage method.
Would you ever recommend not doing this one-at-a-time as images are acquired? In other words, would there ever be a reason to acquire all images in a multi-page scan, and then process and release them at the end, after all are scanned and acquired?
Thanks for your help.
Each imageId generated will be unique for each image - if you import the same image twice you get two different imageIds.
These imageIds can be referenced by any GdPictureImaging or GdViewer object. If I load the image with one GdPictureImaging, I can process it with another. I'm presuming the 'stack' is just a static reference from within the appropriate dlls, and is created when its first accessed.
The imageIds doesn't change on editing (I think - feel free to correct me if I'm wrong!), so you can draw on the image, rotate or resize it and the id stays the same.
Releasing the imageId releases it from the stack - the GdViewer /GdPictureImaging components won't be able to access it.
I've had no problems storing multiple imageIds. In fact my entire system is based off scanning the images using one GdPictureImaging object , processing them with another, storing them in an array for user validation using the Viewer, then finally saving and releasing them in one go.
Mark you are absolutely right.
Just note that an image ID can be "recycled".
IE, if you create 4 consecutive GdPicture Image ID should be 1, 2, 3, 4. If you remove latest created image then you create a new one, its ID will be 4 !
We have implemented a kind of GdPicture image garbage collector
Who is online
Users browsing this forum: No registered users and 1 guest