CVB.Net 14.1
RingBufferImage Class Reference

Stream image that is returned, when the IRingBuffer interface is available on a device. More...

Inherits StreamImage.

Public Member Functions

void Unlock ()
 Unlocks this buffer. More...
 
- Public Member Functions inherited from Image
 Image (int width, int height)
 Creates an uninitialized image with the given width and height . More...
 
 Image (Size2D size)
 Creates an uninitialized image with the given size . More...
 
 Image (int width, int height, int numPlanes)
 Creates an uninitialized image with the given width and height , numPlanes infos. More...
 
 Image (Size2D size, int numPlanes)
 Creates an uninitialized image with the given size and numPlanes . More...
 
 Image (int width, int height, int numPlanes, PixelDataType dataType, int bitDepth)
 Creates an uninitialized image with the given width and height , numPlanes infos. More...
 
 Image (Size2D size, int numPlanes, PixelDataType dataType, int bitDepth)
 Creates an uninitialized image with the given size and numPlanes . More...
 
 Image (int width, int height, int numPlanes, DataType dataType)
 Creates an uninitialized image with the given width and height , numPlanes infos. More...
 
 Image (Size2D size, int numPlanes, DataType dataType)
 Creates an uninitialized image with the given size and numPlanes . More...
 
unsafe byte[] ToObjectBuffer ()
 Create a byte buffer with the serialized image object data. More...
 
override bool Equals (object obj)
 Equality check. More...
 
override int GetHashCode ()
 Build a suitable hash code. More...
 
double[] GetPixel (Point2D position)
 Gets the pixel values for all planes at the given position . More...
 
double[] GetPixel (int x, int y)
 Gets the pixel values for all planes at the given position. More...
 
bool Contains (Point2D pt)
 Tests if a pixel location is inside the image. More...
 
void Initialize (Area2D area, double value)
 Initialize the given area in all planes of this image to the specified value. More...
 
void Initialize (Rect area, double value)
 Initialize the given area in all planes of this image to the specified value. More...
 
void Initialize (Rect area, params double[] values)
 Initialize the given area in all planes of this image to the specified values. More...
 
void Initialize (Area2D area, params double[] values)
 Initialize the given area in all planes of this image to the specified values. More...
 
void Initialize (double value)
 Initialize all planes of this image to the specified value. More...
 
void Initialize (params double[] values)
 Initialize all planes of this image to the specified values. More...
 
virtual Image Clone ()
 Creates a new Image object that is a copy of the current instance. More...
 
virtual Image Copy ()
 Creates a new Image object that is a copy of the current instance. More...
 
void CopyTo (Image targetImage, Rect sourceRect, Point2D targetPosition)
 Copies the image data from the sourceRect of this image to the targetImage targetPosition . More...
 
void CopyTo (Image targetImage)
 Copies the image data from this image to the targetImage . More...
 
MappedImage Map (Rect rect)
 Creates a mapped image of the rect region of this image. More...
 
MappedImage Map (Rect sourceRect, Size2D targetSize)
 Creates a mapped image of the sourceRect region of this image scaled to the targetSize . More...
 
MappedImage Map (Size2D targetSize)
 Creates a mapped image of this whole image scaled to the targetSize . More...
 
MappedImage Map (RotationMap rotation)
 Creates a mapped image of this whole image rotated by the given rotation . More...
 
Image SubImage (Rect sourceRect)
 Creates a new Image that is a copy from the given sourceRect of the image data of the current instance. More...
 
Image SubImage (Area2D sourceArea)
 Creates a new Image that is a copy from the given sourceArea of the image data of the current instance. More...
 
void Save (string fileName)
 Write the current content of the image into a file. The file format to be used is determined by the extension of the fileName . If a lossy format is selected, a default quality setting will be used (if you want to specify your own quality setting, please use the overload that allows specification of a quality value). More...
 
void Save (string fileName, double quality)
 Write the current content of the image into a file. The file format to be used is determined based on the fileName 's extension. The quality (and thereby size) of the resulting file can be adjusted using the quality parameter. When saving to a lossless file format, the quality parameter will be silently ignored. More...
 
void RaisePixelContentChanged ()
 Inform clients listening to the PixelContentChanged event that this image data has been completely updated (full area).
 
void RaisePixelContentChanged (Rect rect)
 Inform clients listening to the PixelContentChanged event that this image data has been updated in the given rect . More...
 
void BeginPixelContentChange ()
 Starts an image update block. More...
 
void EndPixelContentChange ()
 Ends an image update block. More...
 
IDisposable StartPixelContentChangeBlock ()
 Starts an image update block to be used in a using statement. More...
 
Point2Dd ImageToPixelCoordinates (Point2Dd p)
 Convert a pixel from image to pixel coordinates. More...
 
Area2D ImageToPixelCoordinates (Area2D area)
 Convert an Area2D from image to pixel coordinates. More...
 
Point2Dd PixelToImageCoordinates (Point2Dd p)
 Convert a pixel from pixel to image coordinates. More...
 
Area2D PixelToImageCoordinates (Area2D area)
 Convert an Area2D from pixel to image coordinates. More...
 
void Dispose ()
 IDisposable implementation. More...
 
void Close ()
 Alias of the Dispose() method. More...
 

Protected Member Functions

 RingBufferImage (IRingBuffer ringBuffer, int bufferIndex)
 Creates a new IRingBuffer image. More...
 
 RingBufferImage (IRingBuffer ringBuffer, int bufferIndex, Size2D size, int numPlanes, DataType dataType, double rawTimestamp)
 Constructor used for tests. More...
 
override void Dispose (bool disposing)
 Overwritten to unlock this image on Image.Dispose() if RingBufferLockMode.On. More...
 
- Protected Member Functions inherited from StreamImage
 StreamImage (IntPtr handle)
 Creates the stream image and adopts its life-time. More...
 
- Protected Member Functions inherited from Image
 Image (IntPtr handle)
 Creates a Image object around a native handle. More...
 
 Image (IntPtr handle, ShareObject doShare, UseMemoryPressure useMemoryPressure)
 Creates a Image object around a native handle and guesses the memory pressure if useMemoryPressure indicates that. More...
 
 Image (IntPtr handle, ShareObject doShare, long memoryPressure)
 Creates a Image object around a native handle with the given memoryPressure . More...
 
void OnPixelContentChanged ()
 Inform clients listening to the PixelContentChanged event that this image data has been completely updated (full area).
 
virtual void OnPixelContentChanged (Rect rect)
 Inform clients listening to the PixelContentChanged event that this image data has been updated in the given rect . More...
 
virtual void Dispose (bool disposing)
 IDispose helper function. More...
 
void Detach ()
 Detaches this Image object from the native IMG. More...
 

Properties

int BufferIndex [get]
 Gets the index of this buffer in the ParentDevice device's ring buffer.
 
bool IsLocked [get]
 Gets whether this ring buffer image is in a locked state. More...
 
Device ParentDevice [get]
 Gets the parent object this one references (device).
 
IRingBuffer Parent [get]
 Gets the parent ring buffer object.
 
double Tag [get]
 Gets the optional tag of this buffer image. More...
 
- Properties inherited from StreamImage
double RawTimestamp [get, protected set]
 Gets the raw timestamp as reported by the driver. More...
 
- Properties inherited from Image
bool IsDisposed [get]
 Tests if the native handle has already been disposed.
 
ImagePlaneCollection Planes [get]
 Access to the infos of the image. More...
 
Size2D Size [get]
 Size of the image. More...
 
int Width [get]
 Width of the image in pixels. More...
 
int Height [get]
 Height of the image in pixels. More...
 
bool HasOverlayMask [get]
 True if at least one of the image infos has the overlay mask bit set. More...
 
IntPtr Handle [get]
 Native CVB image handle. More...
 
ColorModel ColorModel [get]
 Color model that is realized by this image. More...
 
Rect Bounds [get]
 Retrieve the bounding rect of the Image. More...
 
AffineMatrix2D CoordinateSystem [get, set]
 Coordinate system of the image. More...
 
- Properties inherited from INativeHandle
IntPtr Handle [get]
 The native handle of the object.
 
bool IsDisposed [get]
 Possibility to check whether the object has already been disposed of.
 

Additional Inherited Members

- Static Public Member Functions inherited from Image
static Image FromHandle (IntPtr nativeHandle)
 Create a Image from a native handle. More...
 
static Image FromHandle (IntPtr nativeHandle, ShareObject doShare)
 Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle. More...
 
static Image FromHandle (IntPtr nativeHandle, ShareObject doShare, UseMemoryPressure useMemoryPressure)
 Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle. More...
 
static Image FromHandle (IntPtr nativeHandle, ShareObject doShare, long memoryPressure)
 Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle. More...
 
static unsafe Image FromObjectBuffer (byte[] arr)
 Deserialize an image object from an object buffer generated by the extension method ToObjectBuffer. More...
 
static FileImage FromFile (string fileName)
 Loads an image with the given fileName . More...
 
static Image FromPlanes (MappingOption mapping, params ImagePlane[] planes)
 Create an image that is the result of concatenating a series of input planes . More...
 
static Image FromImages (MappingOption mapping, params Image[] images)
 Create an image that is the result of concatenating a series of input images. More...
 
static Image FromPixelFormat (Size2D size, PfncFormat pixelFormat)
 Create a Image from a pixel format. More...
 
static Image FromPixelFormat (int width, int height, PfncFormat pixelFormat)
 Create a Image from a pixel format. More...
 
- Events inherited from Image
EventHandler< RectEventArgsPixelContentChanged
 Fired when the image data of this image was consciously updated. More...
 
EventHandler HandleChanged
 Event that is fired when the handle of this image changed.
 
NativeHandleEventDelegate ObjectDisposing
 Raised when this object is about to be disposed via the IDisposable.Dispose method. More...
 
- Events inherited from INativeHandle
NativeHandleEventDelegate ObjectDisposing
 Raised when this object is about to be disposed via the IDisposable.Dispose method.
More...
 

Detailed Description

Stream image that is returned, when the IRingBuffer interface is available on a device.

Constructor & Destructor Documentation

◆ RingBufferImage() [1/2]

RingBufferImage ( IRingBuffer  ringBuffer,
int  bufferIndex 
)
protected

Creates a new IRingBuffer image.

Parameters
ringBufferRingbuffer object to create image from.
bufferIndexBuffer index to retrieve image for.

◆ RingBufferImage() [2/2]

RingBufferImage ( IRingBuffer  ringBuffer,
int  bufferIndex,
Size2D  size,
int  numPlanes,
DataType  dataType,
double  rawTimestamp 
)
protected

Constructor used for tests.

Parameters
ringBufferRingbuffer object to use as parent.
bufferIndexIndex in the ringBuffer of this image.
sizeWidth and height in pixels to create.
numPlanesNumber of planes to create.
dataTypeData type of the image to create.
rawTimestampThe raw timestamp value to use.

Member Function Documentation

◆ Dispose()

override void Dispose ( bool  disposing)
protectedvirtual

Overwritten to unlock this image on Image.Dispose() if RingBufferLockMode.On.

Parameters
disposingtrue when called from IDisposable.Dispose().

Reimplemented from Image.

◆ Unlock()

void Unlock ( )

Unlocks this buffer.

This is an alias for IDisposable.Dispose().

Property Documentation

◆ IsLocked

bool IsLocked
get

Gets whether this ring buffer image is in a locked state.

Locked state indicates that the acquisition engine is not allowed to fill this buffer.

◆ Tag

double Tag
get

Gets the optional tag of this buffer image.

The driver dependent tag or double.NaN if none is present.