svlFilterImageWindow class
The cisstStereoVision library has a built in filter called svlFilterImageWindow to display image data at any given stage of the stream. By default the filter displays one separate window for each input video channel and renders the images into the windows’ client area. Optionally, the filter can be configured to hide the window borders. The underlying platform-dependent API that is used to manage windows automatically choses the best possible image display option from the list of supported methods.
Platform |
GUI Library |
API |
Notes |
|---|---|---|---|
MS Windows |
Win32 |
|
|
Linux |
X11 or Xv |
|
Xv is a hardware-accelerated imaging library. When ‘’Xv’’ is available, image refresh is synchronized to VSYNC |
Mac OS X |
X11 |
|
Xv is not available on Mac OS X; Carbon is not used due to the lack of 64 bit support |
Please note: If you are using a different GUI library in your application then you might need to implement your own image display filter that fits your needs.
svlFilterImageWindow:: public methods
Name |
Description |
|---|---|
|
Moves the window to the specified position on the screen. |
|
Retrieves the screen coordinates of the upper left corner of the window. |
|
Registers a user-specified window event handler object that will receive user (keyboard and mouse) events. |
|
Call this method to enable/disable borderless window mode. |
|
Retrieves the status of the borderless window mode. |
|
Sets the title of the image window. |
|
Retrieves the title of the image window. |
Handling keyboard and mouse inputs
In order to handle keyboard and mouse inputs inside the image window, the user may register a event handler object to the filter that will receive callbacks upon user events. The custom event handler class needs to be derived from the base class svlWindowEventHandlerBase declared in <cisstStereoVision/svlFilterImageWindow.h>. User input events are dispatched to the callback method OnUserEvent that needs to be overloaded by the user in order to perform custom event-handling. Additionally, another callback method called OnNewFrame may be overloaded by the user. OnNewFrame is called by the filter once for every video frame before rendering.
The method GetMousePos may be used to get the position of the mouse cursor. The retrieved cursor position is valid only when the mouse cursor is hovering on top of the window’s client area or the mouse focus is currently captured. The ‘’’mouse focus’’’ becomes captured when the user clicks on the image window and keeps the button depressed. As long as the mouse button remains depressed all the mouse input will be dispatched to the event handler, even if the mouse cursor moves off the window area. The mouse cursor loses the focus when the user releases the button.
svlWindowEventHandlerBase:: callback methods
Name |
Description |
|---|---|
|
Called by the image window filter upon every user input event. |
|
Called every time a new input image arrives to the filter. |
svlWindowEventHandlerBase:: public methods
Name |
Description |
|---|---|
|
Use this method to retrieve the current position of the mouse cursor on the screen. |
User event codes
Event code |
Description |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Left arrow key pressed |
|
Right arrow key pressed |
|
Up arrow key pressed |
|
Down arrow key pressed |
|
Mouse moved over of the window’s client area |
|
Left mouse button pressed |
|
Left mouse button released |
|
Right mouse button pressed |
|
Right mouse button released |