CVB.Net 14.1
BufferImage Class Reference

Stream image that is returned when no IRingBuffer interface is available. More...

Inherits StreamImage.

Inherited by VideoBufferImage.

Classes

class  ImageLayout
 Contains the buffer layout of a Image for fast BufferImage creation. More...
 

Public Member Functions

 BufferImage (Device device)
 Creates a new BufferImage from the given device . More...
 
 BufferImage (Device device, ImageLayout layout)
 Creates a new BufferImage from the given device and layout information. 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

override void Dispose (bool disposing)
 Unregisters the disposing event if this object is disposed before its parent. 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

INativeHandle Parent [get]
 Gets the parent object this one references.
 
- 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 no IRingBuffer interface is available.

This behaves almost as a MappedImage. The difference is that if the pixel buffer switches underneath, this image still points to the pixel buffer it was created on. The CvbMappedImage will point to the new location.

Switching pixel buffers commonly occurs on driver related DeviceImages like the VinImage from the VinDevice. If available on a Device, prefer the RingBufferImage.

Constructor & Destructor Documentation

◆ BufferImage() [1/2]

BufferImage ( Device  device)

Creates a new BufferImage from the given device .

Parameters
deviceDevice that has IImageVPA interface.

◆ BufferImage() [2/2]

BufferImage ( Device  device,
ImageLayout  layout 
)

Creates a new BufferImage from the given device and layout information.

Attention: no security checks are performed: incompatible device Images will lead to access violation on image data access..

This version is faster as no analysis of the given device image needs to be done.

Parameters
deviceDevice that has IImageVPA interface.
layoutLayout information of the device image.

Member Function Documentation

◆ Dispose()

override void Dispose ( bool  disposing)
protectedvirtual

Unregisters the disposing event if this object is disposed before its parent.

Parameters
disposingtrue if called from IDisposable interface; false if called from finalizer.

Reimplemented from Image.