CVB.Net 14.0
ImageExtensions Class Reference

Extension methods on the Image object. More...

Static Public Member Functions

static double[] GetPixel (this Image img, Point location)
 Gets the pixel values of all planes at the given position. More...
 
static Bitmap ToBitmap (this Image img, int width, int height, PixelFormat pfm, Rect sourceRect, PlaneConfiguration planes, double gain, int offset, HighBitScaleMode mode)
 Create a System.Drawing.Bitmap from this CVB image. More...
 
static Bitmap ToBitmap (this Image img, int width, int height, HighBitScaleMode mode)
 Convert this Stemmer.Cvb.Image into a Bitmap of selectable size. More...
 
static Bitmap ToBitmap (this Image img, HighBitScaleMode mode)
 Convert this Stemmer.Cvb.Image into a Bitmap of identical size. More...
 
static Bitmap ToBitmap (this Image img)
 Convert this Stemmer.Cvb.Image into a Bitmap of identical size and convert data with bit depth higher than 8 via HighBitScaleMode.Global scaling. More...
 
static PointF ToPointF (this Point2Dd pt)
 implicit conversion operator to System.Drawing.PointF More...
 
static Point ToPoint (this Point2Dd pt)
 implicit conversion operator to System.Drawing.Point More...
 
static Point[] ToPoints (this Point2Dd[] arr)
 Convert a Point2Dd array into a Point array. More...
 
static PointF ToPointF (this Point2D pt)
 Conversion to System.Drawing.PointF. More...
 
static Point ToPoint (this Point2D pt)
 Conversion to System.Drawing.Point. More...
 
static Rectangle ToRectangle (this Rect rect)
 Convert a Rect to a System.Drawing.Rectangle. More...
 
static Size ToSize (this Size2D size)
 Convert a CvbSize to a System.Drawing.Size. More...
 
static Point2Dd Add (Point2Dd lhs, Point rhs)
 Add a CvbPointD and a Point. More...
 
static unsafe TPixel[] ToPixelBuffer< TPixel > (this Image image, RawPixelBufferLayout layout)
 Create a byte buffer with the serialized image pixel data. More...
 

Detailed Description

Extension methods on the Image object.

Member Function Documentation

◆ Add()

static Point2Dd Add ( Point2Dd  lhs,
Point  rhs 
)
static

Add a CvbPointD and a Point.

Parameters
lhsoperand 1
rhsoperand 2
Returns
sum of operand 1 and operand 2

◆ GetPixel()

static double[] GetPixel ( this Image  img,
Point  location 
)
static

Gets the pixel values of all planes at the given position.

Parameters
locationPosition in pixel coordinates.
imgObject to work on.
Returns
The pixel values; double.NaN if the value could not be dereferenced.

◆ ToBitmap() [1/4]

static Bitmap ToBitmap ( this Image  img)
static

Convert this Stemmer.Cvb.Image into a Bitmap of identical size and convert data with bit depth higher than 8 via HighBitScaleMode.Global scaling.

Parameters
imgStemmer.Cvb.Image object to work on.
Returns
Newly created bitmap.

◆ ToBitmap() [2/4]

static Bitmap ToBitmap ( this Image  img,
HighBitScaleMode  mode 
)
static

Convert this Stemmer.Cvb.Image into a Bitmap of identical size.

Parameters
imgStemmer.Cvb.Image object to work on.
modetreatment for images with more than 8 bits per pixel
Returns
Newly created bmData

◆ ToBitmap() [3/4]

static Bitmap ToBitmap ( this Image  img,
int  width,
int  height,
HighBitScaleMode  mode 
)
static

Convert this Stemmer.Cvb.Image into a Bitmap of selectable size.

Parameters
widthWidth of the Bitmap to be returned; may be 0, in which case the width is calculated taking into account the aspect ratio of this image (if height != 0) or will be set to the width of this image(if width and height are 0)
heightHeight of the Bitmap to be returned; may be 0, in which case the height is calculated taking into account the aspect ratio of this image (if width != 0) or will be set to the height of this image (if width and height are 0)
imgImage object to work on.
modeTreatment for images with more than 8 bits per pixel
Returns
Newly created bitmap

◆ ToBitmap() [4/4]

static Bitmap ToBitmap ( this Image  img,
int  width,
int  height,
PixelFormat  pfm,
Rect  sourceRect,
PlaneConfiguration  planes,
double  gain,
int  offset,
HighBitScaleMode  mode 
)
static

Create a System.Drawing.Bitmap from this CVB image.

Parameters
widthWidth of the Bitmap to be returned; may be 0, in which case the width is calculated taking into account the aspect ratio of this image (if height != 0) or will be set to the width of this image(if width and height are 0)
heightHeight of the Bitmap to be returned; may be 0, in which case the height is calculated taking into account the aspect ratio of this image (if width != 0) or will be set to the height of this image (if width and height are 0)
sourceRectSubregion of the image to paint into the bmData
planesPlane configuration to use for painting
gainGain to multiply during painting
offsetOffset to add during painting
pfmPixel format to use
modeTreatment for images with more than 8 bits per pixel
imgImage object to work on.
Returns
Newly created bitmap
Exceptions
ObjectDisposedExceptionIf this image has already been disposed

◆ ToPixelBuffer< TPixel >()

static unsafe TPixel[] ToPixelBuffer< TPixel > ( this Image  image,
RawPixelBufferLayout  layout 
)
static

Create a byte buffer with the serialized image pixel data.

Template Parameters
TPixelType of the pixel array to produce. Must match the type of the pixels as described by the image's data type descriptor.
Parameters
imageImage object for which the pixels are to be serialized. Note that the input image must have the same data type on all input planes and that the data type must be mappable to one of the native CLR types.
layoutPlane layout to use when serializing the image's pixel data (actual setting will not have an effect on images with only one plane).
Returns
Array with the serialized pixel data
Exceptions
ArgumentNullExceptionif the image parameter is null
InvalidOperationExceptionif the image is multi-planar and the different planes have different data type(s) or if the data type of the plane(s) of the image is/are not compatible with the TPixel generic parameter
Exceptionif serialization failed
Type Constraints
TPixel :struct 

◆ ToPoint() [1/2]

static Point ToPoint ( this Point2D  pt)
static

Conversion to System.Drawing.Point.

Parameters
ptoperand to be converted
Returns
converted point

◆ ToPoint() [2/2]

static Point ToPoint ( this Point2Dd  pt)
static

implicit conversion operator to System.Drawing.Point

Parameters
ptoperand to be converted
Returns
converted point

◆ ToPointF() [1/2]

static PointF ToPointF ( this Point2D  pt)
static

Conversion to System.Drawing.PointF.

Parameters
ptoperand to be converted
Returns
converted point

◆ ToPointF() [2/2]

static PointF ToPointF ( this Point2Dd  pt)
static

implicit conversion operator to System.Drawing.PointF

Parameters
ptoperand to be converted
Returns
converted rhs

◆ ToPoints()

static Point[] ToPoints ( this Point2Dd[]  arr)
static

Convert a Point2Dd array into a Point array.

Parameters
arrArray to be converted.
Returns
Converted array.

◆ ToRectangle()

static Rectangle ToRectangle ( this Rect  rect)
static

Convert a Rect to a System.Drawing.Rectangle.

Parameters
rectRect to be converted.
Returns
New System.Drawing.Rectangle.

◆ ToSize()

static Size ToSize ( this Size2D  size)
static

Convert a CvbSize to a System.Drawing.Size.

Parameters
sizeSize object to be converted.
Returns
Conversion result.