CVB.Net 14.0
ImageExtensions Class Reference

Collection of extension methods that involve the type Image. More...

Static Public Member Functions

static BitmapSource ToBitmapSource (this Bitmap bmp)
 Extension method to create a BitmapSource from a Bitmap object. More...
 
static BitmapSource ToBitmapSource (this Image img, int width, int height, Rect sourceRect, PlaneConfiguration planes, double gain, int offset, HighBitScaleMode mode)
 Create a System.Windows.Media.Imaging.BitmapSource from this CVB image. More...
 
static BitmapSource ToBitmapSource (this Image img, HighBitScaleMode mode)
 Convert this Cvb image into a bmData source of identical size. More...
 
static BitmapSource ToBitmapSource (this Image img)
 Convert this Cvb image into a bmData source of identical size, using default conversion for high bit images. More...
 
static BitmapSource ToBitmapSource (this Image img, int width, int height, HighBitScaleMode mode)
 Convert this Cvb image into a bmData of selectable size. More...
 
static void WriteImage (this WriteableBitmap bm, Image img, Rect sourceRect, Rect targetRect, HighBitScaleMode mode)
 Copies the pixel data from the given sourceRect of the Image img . More...
 
static bool IsSpecial (this Image img)
 Gets whether this image should be displayed via ToBitmap. More...
 
static void WriteImage (this WriteableBitmap bm, Image img, Int32Rect sourceRect, Int32Rect targetRect, HighBitScaleMode mode)
 Copies the pixel data from the given sourceRect of the Image img . More...
 
static void WriteImage (this WriteableBitmap bm, Image img, Rect sourceRect, HighBitScaleMode mode)
 Copies the pixel data from the given sourceRect of the Image img . More...
 
static void WriteImage (this WriteableBitmap bm, Image img, Int32Rect sourceRect, HighBitScaleMode mode)
 Copies the pixel data from the given sourceRect of the Image img . More...
 
static void WriteImage (this WriteableBitmap bm, Image img, HighBitScaleMode mode)
 Copies the Image pixel data. More...
 

Detailed Description

Collection of extension methods that involve the type Image.

Member Function Documentation

◆ IsSpecial()

static bool IsSpecial ( this Image  img)
static

Gets whether this image should be displayed via ToBitmap.

Parameters
imgImage to be tested.
Returns
true if display conversion is needed.

◆ ToBitmapSource() [1/5]

static BitmapSource ToBitmapSource ( this Bitmap  bmp)
static

Extension method to create a BitmapSource from a Bitmap object.

Parameters
bmpBitmap object to work on.
Returns
Resulting BitmapSource.

◆ ToBitmapSource() [2/5]

static BitmapSource ToBitmapSource ( this Image  img)
static

Convert this Cvb image into a bmData source of identical size, using default conversion for high bit images.

Parameters
imgimage to be converted
Returns
bitmap source result

◆ ToBitmapSource() [3/5]

static BitmapSource ToBitmapSource ( this Image  img,
HighBitScaleMode  mode 
)
static

Convert this Cvb image into a bmData source of identical size.

Parameters
imgthe Image to work on
modetreatment for images with more than 8 bits per pixel
Returns
newly created bmData source

◆ ToBitmapSource() [4/5]

static BitmapSource ToBitmapSource ( this Image  img,
int  width,
int  height,
HighBitScaleMode  mode 
)
static

Convert this Cvb image into a bmData 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 ration 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 ration of this image (if width != 0) or will be set to the height of this image (if width and height are 0)
imgthe Image to work on
modetreatment for images with more than 8 bits per pixel
Returns
newly created bmData source

◆ ToBitmapSource() [5/5]

static BitmapSource ToBitmapSource ( this Image  img,
int  width,
int  height,
Rect  sourceRect,
PlaneConfiguration  planes,
double  gain,
int  offset,
HighBitScaleMode  mode 
)
static

Create a System.Windows.Media.Imaging.BitmapSource 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 ration of sourceRect (if height != 0) or will be set to the width of sourceRect (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 ration of sourceRect (if width != 0) or will be set to the height of sourceRect (if width and height are 0)
sourceRectsubregion of the image to paint into the bmData
planesplane configuration to use for painting
gaingain to apply during painting
offsetoffset to apply during painting
imgthe Image to work on
modetreatment for images with more than 8 bits per pixel
Returns
newly created bmData source
Exceptions
ObjectDisposedExceptionIf this image has already been disposed

◆ WriteImage() [1/5]

static void WriteImage ( this WriteableBitmap  bm,
Image  img,
HighBitScaleMode  mode 
)
static

Copies the Image pixel data.

Parameters
bmThe writeable bmData to copy to.
imgThe CVB image to copy from.
modetreatment for images with more than 8 bits per pixel

◆ WriteImage() [2/5]

static void WriteImage ( this WriteableBitmap  bm,
Image  img,
Int32Rect  sourceRect,
HighBitScaleMode  mode 
)
static

Copies the pixel data from the given sourceRect of the Image img .

Parameters
bmThe writeable bmData to copy to.
imgThe CVB image to copy from.
sourceRectRegion to copy in pixels.
modetreatment for images with more than 8 bits per pixel

◆ WriteImage() [3/5]

static void WriteImage ( this WriteableBitmap  bm,
Image  img,
Int32Rect  sourceRect,
Int32Rect  targetRect,
HighBitScaleMode  mode 
)
static

Copies the pixel data from the given sourceRect of the Image img .

Parameters
bmThe writeable bmData to copy to.
imgThe CVB image to copy from.
sourceRectRegion to copy from in pixels.
targetRectRegion to copy to in pixels.
modetreatment for images with more than 8 bits per pixel

◆ WriteImage() [4/5]

static void WriteImage ( this WriteableBitmap  bm,
Image  img,
Rect  sourceRect,
HighBitScaleMode  mode 
)
static

Copies the pixel data from the given sourceRect of the Image img .

Parameters
bmThe writeable bmData to copy to.
imgThe CVB image to copy from.
sourceRectRegion to copy in pixels.
modetreatment for images with more than 8 bits per pixel

◆ WriteImage() [5/5]

static void WriteImage ( this WriteableBitmap  bm,
Image  img,
Rect  sourceRect,
Rect  targetRect,
HighBitScaleMode  mode 
)
static

Copies the pixel data from the given sourceRect of the Image img .

Parameters
bmThe writeable bmData to copy to.
imgThe CVB image to copy from.
sourceRectRegion to copy from in pixels.
targetRectRegion to copy to in pixels.
modetreatment for images with more than 8 bits per pixel