A wrapped image wraps another pixel buffer without owning it. More...
Inherits Image.
Classes | |
struct | PixelFormatInfo |
Information extracted from Bitmap pixel format. More... | |
Public Member Functions | |
WrappedImage (IntPtr buffer, long bufferSize, int width, int height, PixelDataType dataType, int bitDepth, int pixelStride, int lineStride, int planeStride, params int[] planeOrder) | |
Wraps, without copying, the given pixel buffer in a Image. More... | |
WrappedImage (IntPtr buffer, long bufferSize, int width, int height, PixelDataType dataType, int bitDepth, int pixelStride, int lineStride, int planeStride, PlaneConfiguration planeOrder) | |
Wraps, without copying, the given 3-plane pixel buffer in a Image. More... | |
override Image | Clone () |
Creates a new wrapped image mapping the same source image. 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... | |
Static Public Member Functions | |
static WrappedImage | FromGreyPixels (IntPtr buffer, long bufferSize, int width, int height, PixelDataType dataType, int bitDepth, int pixelStride, int lineStride) |
Wraps, without copying, the given monochrome pixel buffer in a Image. More... | |
static WrappedImage | FromGrey8Pixels (IntPtr buffer, long bufferSize, int width, int height) |
Wraps, without copying, the given Mono8 pixel buffer in a Image. More... | |
static WrappedImage | FromRgbPixels (IntPtr buffer, long bufferSize, int width, int height, PixelDataType dataType, int bitDepth, int pixelStride, int lineStride, int planeStride) |
Wraps, without copying, the given RGB pixel buffer in a Image. More... | |
static WrappedImage | FromBgrPixels (IntPtr buffer, long bufferSize, int width, int height, PixelDataType dataType, int bitDepth, int pixelStride, int lineStride, int planeStride) |
Wraps, without copying, the given BGR pixel buffer in a Image. More... | |
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... | |
Additional Inherited Members | |
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 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. | |
Events inherited from Image | |
EventHandler< RectEventArgs > | PixelContentChanged |
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... | |
A wrapped image wraps another pixel buffer without owning it.
Note that this class is not intended for general use. Providing invalid values or not ensuring the validity of the associated buffer at all times will most likely lead to severe problems in your application.
WrappedImage | ( | IntPtr | buffer, |
long | bufferSize, | ||
int | width, | ||
int | height, | ||
PixelDataType | dataType, | ||
int | bitDepth, | ||
int | pixelStride, | ||
int | lineStride, | ||
int | planeStride, | ||
params int[] | planeOrder | ||
) |
Wraps, without copying, the given pixel buffer in a Image.
A newly created image handle is given by this constructor.
The number of planes is deduced from the length of the planeOrder array.
This method does not add memory pressure as the memory is managed elsewhere.
buffer | Pointer to the start of the pixel buffer. |
bufferSize | Size of the buffer in bytes. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
dataType | Pixel data type. |
bitDepth | Bits per pixel per plane. |
pixelStride | Distance in bytes between two neighbouring pixels of the same plane, i.e. 1 for normal Mono8 images. |
lineStride | Distance in bytes between two neighbouring lines of the same plane, i.e. width + optional padding for Mono8 images. |
planeStride | Distance in bytes between two neighbouring infos, i.e. 1 for an interleaved RGB8 image. |
planeOrder | Defines the mapping between the buffer plane layout and the logical CVB infos (R/G/B by default), i.e. (0,1,2) for an RGB8 image and (2,1,0) for a BGR8 image. |
ArgumentOutOfRangeException | When the dataType , bitDepth combination is invalid. |
WrappedImage | ( | IntPtr | buffer, |
long | bufferSize, | ||
int | width, | ||
int | height, | ||
PixelDataType | dataType, | ||
int | bitDepth, | ||
int | pixelStride, | ||
int | lineStride, | ||
int | planeStride, | ||
PlaneConfiguration | planeOrder | ||
) |
Wraps, without copying, the given 3-plane pixel buffer in a Image.
This method does not add memory pressure as the memory is managed elsewhere.
buffer | Pointer to the start of the pixel buffer. |
bufferSize | Size of the buffer in bytes. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
dataType | Pixel data type. |
bitDepth | Bits per pixel per plane. |
pixelStride | Distance in bytes between two neighbouring pixels of the same plane, i.e. 1 for normal Mono8 images. |
lineStride | Distance in bytes between two neighbouring lines of the same plane, i.e. width + optional padding for Mono8 images. |
planeStride | Distance in bytes between two neighbouring infos, i.e. 1 for an interleaved RGB8 image. |
planeOrder | Defines the mapping between the buffer plane layout and the logical CVB infos. |
ArgumentOutOfRangeException | When the dataType , bitDepth combination is invalid. |
The image handle is the one newly created by this constructor.
|
virtual |
Creates a new wrapped image mapping the same source image.
If you need an actual copied image use the Image.Copy method.
The image handle is the one newly created by this constructor.
Reimplemented from Image.
|
static |
Wraps, without copying, the given BGR pixel buffer in a Image.
This method does not add memory pressure as the memory is managed elsewhere.
buffer | Pointer to the start of the pixel buffer. |
bufferSize | Size of the buffer in bytes. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
dataType | Pixel data type. |
bitDepth | Bits per pixel per plane. |
pixelStride | Distance in bytes between two neighbouring pixels of the same plane, i.e. 1 for normal Mono8 images. |
lineStride | Distance in bytes between two neighbouring lines of the same plane, i.e. width + optional padding for Mono8 images. |
planeStride | Distance in bytes between two neighbouring infos, i.e. 1 for an interleaved RGB8 image. |
ArgumentOutOfRangeException | When the dataType , bitDepth combination is invalid. |
The image handle is the one newly created by this constructor.
|
static |
Wraps, without copying, the given Mono8 pixel buffer in a Image.
This method does not add memory pressure as the memory is managed elsewhere.
buffer | Pointer to the start of the pixel buffer. |
bufferSize | Size of the buffer in bytes. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
The image handle is the one newly created by this constructor.
|
static |
Wraps, without copying, the given monochrome pixel buffer in a Image.
A newly created image handle is given by this constructor.
This method does not add memory pressure as the memory is managed elsewhere.
buffer | Pointer to the start of the pixel buffer. |
bufferSize | Size of the buffer in bytes. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
dataType | Pixel data type. |
bitDepth | Bits per pixel per plane. |
pixelStride | Distance in bytes between two neighbouring pixels of the same plane, i.e. 1 for normal Mono8 images. |
lineStride | Distance in bytes between two neighbouring lines of the same plane, i.e. width + optional padding for Mono8 images. |
ArgumentOutOfRangeException | When the dataType , bitDepth combination is invalid. |
|
static |
Wraps, without copying, the given RGB pixel buffer in a Image.
This method does not add memory pressure as the memory is managed elsewhere.
buffer | Pointer to the start of the pixel buffer. |
bufferSize | Size of the buffer in bytes. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
dataType | Pixel data type. |
bitDepth | Bits per pixel per plane. |
pixelStride | Distance in bytes between two neighbouring pixels of the same plane, i.e. 1 for normal Mono8 images. |
lineStride | Distance in bytes between two neighbouring lines of the same plane, i.e. width + optional padding for Mono8 images. |
planeStride | Distance in bytes between two neighbouring infos, i.e. 1 for an interleaved RGB8 image. |
ArgumentOutOfRangeException | When the dataType , bitDepth combination is invalid. |
The image handle is the one newly created by this constructor.