Skip to content

ImageWindow Class#

Displays an IImage or IGrabResult on screen.

Inheritance Hierarchy#

System.Object
  Basler.Pylon.ImageWindow

Syntax#

C#

public class ImageWindow

VB

Public Class ImageWindow

The ImageWindow type exposes the following members.

Constructors#

NameDescription
Public methodImageWindow Initializes a new instance of the ImageWindow class
 

Methods#

NameDescription
Public methodStatic memberClose Closes and destroys a window opened by using DisplayImage.
Public methodStatic memberDisplayImage(Int32, IImage) Displays an image on screen.
Public methodStatic memberDisplayImage(Int32, IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation) Displays the contents of a raw image buffer on screen.
Public methodStatic memberDisplayImage(T)(Int32, T[], PixelType, Int32, Int32, Int32, ImageOrientation) Displays the contents of an image buffer on screen.
Public methodStatic memberHandle Returns the window handle of the image window.
Public methodStatic memberHide Hides the image window.
Public methodStatic memberShow(Int32) Shows the image window.
Public methodStatic memberShow(Int32, ShowMode) Shows or hides the image window.
 

ImageWindow.Close Method#

Closes and destroys a window opened by using DisplayImage.

Syntax#

C#

public static void Close(
    int windowIndex
)

VB

Public Shared Sub Close ( 
    windowIndex As Integer
)

Parameters#

 

windowIndex
Type: System.Int32
The index of the window to be closed. Valid window indexes range from 0 to 31.

Remarks#

Thread Safety:This method is thread-safe.

Error Safety: Does not throw exceptions.

ImageWindow.DisplayImage Method (Int32, IImage)#

Displays an image on screen.

Syntax#

C#

public static void DisplayImage(
    int windowIndex,
    IImage image
)

VB

Public Shared Sub DisplayImage ( 
    windowIndex As Integer,
    image As IImage
)

Parameters#

 

windowIndex
Type: System.Int32
The index of the image window. Valid window indexes range from 0 to 31.
image
Type: Basler.Pylon.IImage
The image to display in the window.

Remarks#

This method displays the image or the grab result in a window. Using this method is the easiest way to display an image on screen.

You can pass any IImage-based object. If the window hasn't been created before, it will be created with default positions and the image will be shown. When the method returns, you may dispose the image.

If you pass an empty or invalid image (e.g., IImage.IsValid() returns false), the window will be cleared. To close the window call Close()  

  • The window specified by windowIndex will be created and shown on screen.
  • If the image passed is valid, it is shown in the window specified by windowIndex.
  • If the image passed is invalid, the window specified by windowIndex will be cleared.
  Thread Safety:This method is thread-safe.

Error Safety: Can throw an exception if the windowIndex passed is invalid or if the window could not be created.

ImageWindow.DisplayImage Method (Int32, IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation)#

Displays the contents of a raw image buffer on screen.

Syntax#

C#

public static void DisplayImage(
    int windowIndex,
    IntPtr pBuffer,
    long bufferSize,
    PixelType pixelType,
    int width,
    int height,
    int paddingX,
    ImageOrientation orientation
)

VB

Public Shared Sub DisplayImage ( 
    windowIndex As Integer,
    pBuffer As IntPtr,
    bufferSize As Long,
    pixelType As PixelType,
    width As Integer,
    height As Integer,
    paddingX As Integer,
    orientation As ImageOrientation
)

Parameters#

 

windowIndex
Type: System.Int32
The index of the image window. Valid window indexes range from 0 to 31.
pBuffer
Type: System.IntPtr
Pointer to the buffer containing the image data.
bufferSize
Type: System.Int64
Size of the buffer in bytes.
pixelType
Type: Basler.Pylon.PixelType
The pixel type of the image data in the buffer.
width
Type: System.Int32
The number of pixels in a row of the image data in the buffer.
height
Type: System.Int32
The number of rows in the image data in the buffer.
paddingX
Type: System.Int32
The number of extra data bytes at the end of each row.
orientation
Type: Basler.Pylon.ImageOrientation
The vertical orientation of the image in the image buffer.

Remarks#

This method displays the contents of a raw buffer in a window.

If the window hasn't been created before, it will be created with default positions. When the method returns, you may free the image buffer.

If you pass an empty or invalid buffer (e.g., pBuffer or bufferSize are invalid), the window will be cleared. To close the window call Close(Int32).  

  • The window specified by windowIndex will be created and shown on screen.
  • If the image passed is valid, it is shown in the window specified by windowIndex.
  • If the image passed is invalid, the window specified by windowIndex will be cleared.
  Thread Safety:This method is thread-safe.

Error Safety: Can throw an exception if the windowIndex, width, height, or paddingX passed are invalid or if the window could not be created.

ImageWindow.DisplayImage(T) Method (Int32, T[], PixelType, Int32, Int32, Int32, ImageOrientation)#

Displays the contents of an image buffer on screen.

Syntax#

C#

public static void DisplayImage<T>(
    int windowIndex,
    T[] buffer,
    PixelType pixelType,
    int width,
    int height,
    int paddingX,
    ImageOrientation orientation
)

VB

Public Shared Sub DisplayImage(Of T) ( 
    windowIndex As Integer,
    buffer As T(),
    pixelType As PixelType,
    width As Integer,
    height As Integer,
    paddingX As Integer,
    orientation As ImageOrientation
)

Parameters#

 

windowIndex
Type: System.Int32
The index of the image window. Valid window indexes range from 0 to 31.
buffer
Type: T[]
The typed array containing the image data.
pixelType
Type: Basler.Pylon.PixelType
The pixel type of the image data in the buffer.
width
Type: System.Int32
The number of pixels in a row of the image data in the buffer.
height
Type: System.Int32
The number of rows in the image data in the buffer.
paddingX
Type: System.Int32
The number of extra data bytes at the end of each row.
orientation
Type: Basler.Pylon.ImageOrientation
The vertical orientation of the image in the image buffer.

Type Parameters#

 

T
The value type of the buffer array containing the image data.

Remarks#

This method displays the contents of a buffer in a window.

If the window hasn't been created before, it will be created with default positions. When the method returns, you may free the image buffer.

If you pass an empty or invalid buffer (e.g., buffer is empty or invalid), the window will be cleared. To close the window call Close(Int32).  

  • The window specified by windowIndex will be created and shown on screen.
  • If the image passed is valid, it is shown in the window specified by windowIndex.
  • If the image passed is invalid, the window specified by windowIndex will be cleared.
  Thread Safety:This method is thread-safe.

Error Safety: Can throw an exception if the windowIndex, width, height, or paddingX passed are invalid or if the window could not be created.

ImageWindow.Handle Method#

Returns the window handle of the image window.

Syntax#

C#

public static IntPtr Handle(
    int windowIndex
)

VB

Public Shared Function Handle ( 
    windowIndex As Integer
) As IntPtr

Parameters#

 

windowIndex
Type: System.Int32
The index of the image window. Valid window indexes range from 0 to 31.

Return Value#

Type: IntPtr
Returns the native window handle (HWND) of the image window.

ImageWindow.Hide Method#

Hides the image window.

Syntax#

C#

public static void Hide(
    int windowIndex
)

VB

Public Shared Sub Hide ( 
    windowIndex As Integer
)

Parameters#

 

windowIndex
Type: System.Int32
The index of the image window. Valid window indexes range from 0 to 31.

ImageWindow.Show Method (Int32)#

Shows the image window.

Syntax#

C#

public static void Show(
    int windowIndex
)

VB

Public Shared Sub Show ( 
    windowIndex As Integer
)

Parameters#

 

windowIndex
Type: System.Int32
The index of the image window. Valid window indexes range from 0 to 31.

ImageWindow.Show Method (Int32, ShowMode)#

Shows or hides the image window.

Syntax#

C#

public static void Show(
    int windowIndex,
    ShowMode showMode
)

VB

Public Shared Sub Show ( 
    windowIndex As Integer,
    showMode As ShowMode
)

Parameters#

 

windowIndex
Type: System.Int32
The index of the image window. Valid window indexes range from 0 to 31.
showMode
Type: Basler.Pylon.ShowMode
The mode. See the ShowMode enum class for details.

Remarks#

After you create a window using Create(), it will be invisible. You must call Show() to make the window visible.

ImageWindow Constructor#

Initializes a new instance of the ImageWindow class

Syntax#

C#

public ImageWindow()

VB

Public Sub New

ImageWindow.DisplayImage Method#

Overload List#

NameDescription
Public methodStatic memberDisplayImage(Int32, IImage) Displays an image on screen.
Public methodStatic memberDisplayImage(T)(Int32, T[], PixelType, Int32, Int32, Int32, ImageOrientation) Displays the contents of an image buffer on screen.
Public methodStatic memberDisplayImage(Int32, IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation) Displays the contents of a raw image buffer on screen.
 

ImageWindow.Show Method#

Overload List#

NameDescription
Public methodStatic memberShow(Int32) Shows the image window.
Public methodStatic memberShow(Int32, ShowMode) Shows or hides the image window.