• Introduction
  • Programmer's Guide
  • Technical Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • ic4
      • BufferPool
      • DeviceEnum
      • DeviceInfo
      • Display
      • DisplayNotation
      • DisplayRenderPosition
      • DisplayStatistics
      • DisplayType
      • EmbeddedDisplay
      • ErrorCode
      • ExternalOpenGLDisplay
      • FloatRepresentation
      • FloatingDisplay
      • FrameMetaData
      • Grabber
      • HandleObject
      • IBufferAllocator
      • IC4Exception
      • IDisplay
      • ImageBuffer
      • ImageBuffer.CopyOptions
      • ImageBufferExtensions
      • ImageBufferExtensionsOpenCvSharp
      • ImageType
      • IntRepresentation
      • Interface
      • Library
      • LogLevel
      • LogTarget
      • PixelFormat
      • PixelFormatExtensions
      • PngCompressionLevel
      • PropBoolean
      • PropCategory
      • PropCommand
      • PropEnumEntry
      • PropEnumeration
      • PropFloat
      • PropId
      • PropIdBoolean
      • PropIdCommand
      • PropIdEnumeration
      • PropIdFloat
      • PropIdInteger
      • PropIdRegister
      • PropIdString
      • PropInteger
      • PropRegister
      • PropString
      • Property
      • PropertyIncrementMode
      • PropertyMap
      • PropertyType
      • PropertyVisibility
      • QueueSink
      • QueueSinkConnectedEventArgs
      • QueueSinkEventArgs
      • QueueSinkQueueSizes
      • Sink
      • SinkMode
      • SinkType
      • SnapSink
      • SnapSinkAllocationStrategy
      • StreamSetupOption
      • StreamStatistics
      • TransportLayerType
      • VersionInfoFlags
      • VideoWriter
      • VideoWriterType

    Interface IBufferAllocator

    Interface of a buffer allocator, customizing the allocation of the memory used by ImageBuffer objects.

    Namespace: ic4
    Assembly: ic4dotnet.dll
    Syntax
    public interface IBufferAllocator
    Remarks

    Objects of classes implementing this interface can be passed into multiple library functions:

    • When creating a BufferPool:
      • BufferPool(ulong, ulong?, IBufferAllocator)
    • When creating a SnapSink
      • SnapSink(IEnumerable<PixelFormat>, SnapSinkAllocationStrategy, IBufferAllocator)
    • When creating a QueueSink
      • QueueSink(IEnumerable<PixelFormat>, IBufferAllocator, int)

    Methods

    Allocate(ulong, ulong, out IntPtr, out object)

    Allocates the requested number of bytes of memory for an image buffer.

    Declaration
    bool Allocate(ulong bufferSize, ulong alignment, out IntPtr buffer, out object tag)
    Parameters
    Type Name Description
    ulong bufferSize

    The size of the memory buffer

    ulong alignment

    Requested alignment for the allocation.

    IntPtr buffer

    Output parameter receiving the memory address, filled by the function.

    The memory address must be evenly divisible by alignment.

    object tag

    Output parameter receiving the reference to an object that is stored as part of the image buffer and passed to Free(IntPtr, object) when the memory is to be released.

    Returns
    Type Description
    bool

    true, if the allocation was performed successfully, otherwise false.

    Free(IntPtr, object)

    Frees a memory block that was previously allocated by a successful call of Allocate(ulong, ulong, out IntPtr, out object).

    Declaration
    void Free(IntPtr buffer, object tag)
    Parameters
    Type Name Description
    IntPtr buffer

    The memory address of the allocated buffer

    object tag

    The object that was returned through the tag parameter in the call of the allocation call.

    In this article
    Copyright ©️ 2024 The Imaging Source Europe GmbH www.theimagingsource.com