C# Class ROS_ImageWPF.GenericImageIMPL

Mostrar archivo Open project: uml-robotics/ROS.NET Class Usage Examples

Public Methods

Method Description
BytesToImage ( byte data, BitmapImage &img ) : bool

Attempts to convert the byte array, data, into a valid Image, img

GenericImageIMPL ( System.Windows.Media.ImageBrush ib ) : System

Create a GenericImageIMPL to render images on specified ImageBrush UIElement

UpdateImage ( Bitmap bmp ) : void

Looks up the bitmaps dress, then starts passing the image around as a Byte[] and a System.Media.Size to the overloaded UpdateImages that make this work

UpdateImage ( ImageSource imgsrc ) : void

Directly sets this GenericImage's image based on an already created WPF ImageSource

UpdateImage ( byte data ) : void

Uses a memory stream to turn a byte array into a BitmapImage via helper method, BytesToImage, then passes the image to UpdateImage(BitmapImage)

UpdateImage ( byte data, Size size, bool hasHeader, string encoding = null ) : void

if hasHeader is true, then UpdateImage(byte[]) is called otherwise, the size is compared to lastSize, if they differ or header is null, a header is created, and concatinated with data, then UpdateImage(byte[]) is called

Protected Methods

Method Description
SizeConverter ( System s ) : Size

turns a System.Drawing.Size into the WPF double,double version

Private Methods

Method Description
MakeHeader ( byte rawdata, Size size ) : void

makes a file header with appropriate width, height, length, and such for the bytearray + drawing.size sent as members of the lazycopypastefixerupper

concat ( byte a, byte b ) : byte[]

takes 1 byte array, and 1 byte array, and then returns 1 byte array

Method Details

BytesToImage() public static method

Attempts to convert the byte array, data, into a valid Image, img
public static BytesToImage ( byte data, BitmapImage &img ) : bool
data byte image data (ideally)
img System.Windows.Media.Imaging.BitmapImage target image
return bool

GenericImageIMPL() public method

Create a GenericImageIMPL to render images on specified ImageBrush UIElement
public GenericImageIMPL ( System.Windows.Media.ImageBrush ib ) : System
ib System.Windows.Media.ImageBrush Target ImageBrush
return System

SizeConverter() protected static method

turns a System.Drawing.Size into the WPF double,double version
protected static SizeConverter ( System s ) : Size
s System ///
return System.Windows.Size

UpdateImage() public method

Looks up the bitmaps dress, then starts passing the image around as a Byte[] and a System.Media.Size to the overloaded UpdateImages that make this work
public UpdateImage ( Bitmap bmp ) : void
bmp System.Drawing.Bitmap ///
return void

UpdateImage() public method

Directly sets this GenericImage's image based on an already created WPF ImageSource
public UpdateImage ( ImageSource imgsrc ) : void
imgsrc ImageSource The image to show on this GenericImage
return void

UpdateImage() public method

Uses a memory stream to turn a byte array into a BitmapImage via helper method, BytesToImage, then passes the image to UpdateImage(BitmapImage)
public UpdateImage ( byte data ) : void
data byte ///
return void

UpdateImage() public method

if hasHeader is true, then UpdateImage(byte[]) is called otherwise, the size is compared to lastSize, if they differ or header is null, a header is created, and concatinated with data, then UpdateImage(byte[]) is called
public UpdateImage ( byte data, Size size, bool hasHeader, string encoding = null ) : void
data byte /// image data ///
size System.Windows.Size /// image size ///
hasHeader bool /// whether or not a header needs to be concatinated ///
encoding string
return void