Memory Allocation
An image can be constructed with an internal or external memory allocation.
Internal Memory Allocation
The image object dynamically allocates and unallocates a buffer. Memory management is transparent.
When the image size changes, re-allocation occurs.
When an image object is destroyed, the buffer is unallocated.
To declare an image with internal memory allocation:
- Construct an image object, for instance EImageBW8, either with width and height arguments, OR using the SetSize function.
- Access a given pixel. There are several functions that do this. GetImagePtr returns a pointer to the first byte of the pixel at given coordinates.
External Memory Allocation
The user controls buffer allocation, or links a third-party image in the memory buffer to an Open eVision image.
Image size and buffer address must be specified.
When an image object is destroyed, the buffer is unaffected.
To declare an image with external memory allocation:
- Declare an image object, for instance EImageBW8.
- Create a suitably sized and aligned buffer (see Image Buffer).
- Set the image size with the SetSize function.
- Access the buffer with GetImagePtr. See also Retrieving Pixel Values.