Imaging Control 4 C++ Library 1.2.0
|
Interface for custom image buffer allocators More...
Public Member Functions | |
virtual bool | allocate_buffer (size_t buffer_size, size_t alignment, void *&buffer_ptr, void *&user_data)=0 |
Requests the allocator to allocate a memory buffer. | |
virtual void | free_buffer (void *buffer_ptr, void *user_data)=0 |
Requests the allocator to free a previously-allocated memory buffer. | |
Interface for custom image buffer allocators
Custom image buffer allocators can be used to use specific application-defined memory regions as image buffers. For example, it could be used to let the library write image data directly into a texture.
BufferAllocator instances can be passed to QueueSink::create(), SnapSink::create() or BufferPool::create() to override the default buffer allocation mechanisms of the sinks or buffer pool.
|
pure virtual |
Requests the allocator to allocate a memory buffer.
[in] | buffer_size | The size of the requested memory buffer |
[in] | alignment | Requests memory to be allocated on a specific alignment boundary. This value is always a power of 2. |
[out] | buffer_ptr | A reference to a pointer that receives the address of the newly-allocated buffer |
[out] | user_data | User data to attach to the buffer. The user data is passed to free_buffer when the allocated memory is freed again. |
true
on success. If the allocation could not be performed, return false
.
|
pure virtual |
Requests the allocator to free a previously-allocated memory buffer.
[in] | buffer_ptr | Pointer to the memory buffer to be freed |
[in] | user_data | The user data that was returned from allocate_buffer when the memory buffer was allocated |