Impact Acquire SDK C
|
Functions and data structures that can be used to display images. More...
Enumerations | |
enum | TDisplayMode { DM_Default = 0 , DM_Fastest , DM_DDrawOverlay , DM_FullScreen } |
Defines valid display modes. More... | |
enum | TFormatFlags { ffRGB888xPacked , ffRGB888xPlanar , ffMono , ffYUY2 , ffYUV422Planar , ffRGB2BytePacked , ffUYVY , ffMonoPacked_V2 , ffBGR888xPacked , ffUYV444 , ffYUV444 , ffBGR2BytePacked_V2 , ffMonoPacked_V1 , ffYUV411_UYYVYY_Packed , ffRaw } |
Defines valid display pixel formats. More... | |
enum | TImageDisplayError { IDE_NoError = 0 , IDE_OutOfMemory , IDE_UpdateFailed , IDE_InvalidHandle , IDE_InternalError , IDE_DirectDrawAccessFailed } |
Defines valid error values for this module. More... | |
enum | TInterpolationMode { IM_NEAREST_NEIGHBOUR = 0 , IM_LINEAR , IM_CUBIC } |
Defines valid scaler interpolation modes. More... | |
Functions | |
void MV_DISPLAY_API_CALL | mvDispClear (TDisp *pDisp) |
Clears the display. | |
void MV_DISPLAY_API_CALL | mvDispConvertFormat (TImageBufferPixelFormat pixelFormat, TFormatFlags *pFormat, int *pBitsPerPixel) |
Converts a Impact Acquire pixel format into a format that can be digested by this module. | |
int MV_DISPLAY_API_CALL | mvDispConvertFormatFromPFNC32 (const unsigned int pixelFormat, TFormatFlags *pFormat, int *pBitsPerPixel) |
Converts a PFNC pixel format into a format that can be digested by this module. | |
void MV_DISPLAY_API_CALL | mvDispDeinit (TDisp **ppDisp) |
Frees the resources consumed by this display object. | |
int MV_DISPLAY_API_CALL | mvDispGetAppliedShift (TDisp *pDisp) |
Returns the current shift value that has been applied to the last image that has been displayed. | |
TDisplayMode MV_DISPLAY_API_CALL | mvDispGetDisplayMode (TDisp *pDisp) |
Returns the current display mode. | |
int MV_DISPLAY_API_CALL | mvDispGetError (TDisp *pDisp) |
Returns the last error and clears it. | |
void MV_DISPLAY_API_CALL | mvDispGetImage (TDisp *pDisp, const void **ppData, int *pWidth, int *pHeight, int *pBitsPerPixel, int *pPitch) |
Gets the parameters of the current data block associated with the display. | |
TInterpolationMode MV_DISPLAY_API_CALL | mvDispGetInterpolationMode (TDisp *pDisp) |
Gets the current interpolation mode that will be used for scaling if display window rectangle is different to input image rectangle. | |
int MV_DISPLAY_API_CALL | mvDispGetShift (TDisp *pDisp) |
Returns the current shift value as defined by the application. | |
WindowHandle MV_DISPLAY_API_CALL | mvDispGetWindowHandle (TDisp *pDisp) |
Returns the current window handle associated with the display object. | |
TDisp *MV_DISPLAY_API_CALL | mvDispInit (HWND hwnd) |
Initialises a new display object and associates it with the window whose handle is passed to the function. | |
void MV_DISPLAY_API_CALL | mvDispSetBackgroundBrush (TDisp *pDisp, BrushHandle hBrush) |
Associates a brush to be used for painting the background within the client area. | |
void MV_DISPLAY_API_CALL | mvDispSetBitmapRectangle (TDisp *pDisp, int left, int top, int width, int height) |
Sets the position and dimension of bitmap data region. | |
void MV_DISPLAY_API_CALL | mvDispSetDDrawOverlayKeyColor (TDisp *pDisp, ColorValue keyColor) |
Defines the key color for the DirectDraw® overlay. | |
void MV_DISPLAY_API_CALL | mvDispSetDisplayMode (TDisp *pDisp, TDisplayMode mode) |
Switches to a different display mode. | |
void MV_DISPLAY_API_CALL | mvDispSetDisplayRectangle (TDisp *pDisp, int left, int top, int width, int height) |
Defines the rectangle used for drawing within the window associated with the display structure. | |
void MV_DISPLAY_API_CALL | mvDispSetImage (TDisp *pDisp, const void *pData, int width, int height, int bitsPerPixel, int pitch) |
Sets the next image to display. | |
void MV_DISPLAY_API_CALL | mvDispSetImageEx (TDisp *pDisp, const void **ppData, size_t ppDataArraySize, TFormatFlags format, int width, int height, int bitsPerPixel, int pitch) |
Sets the next image to display. | |
void MV_DISPLAY_API_CALL | mvDispSetImageFromImageBuffer (TDisp *pDisp, const ImageBuffer *pBuf) |
Sets the next image to display. | |
void | mvDispSetImageFromRequest (TDisp *pDisp, const mvIMPACT::acquire::Request *pRequest) |
Sets the next image to display. | |
void MV_DISPLAY_API_CALL | mvDispSetInterpolationMode (TDisp *pDisp, TInterpolationMode interpolationMode) |
Sets the new interpolation mode that will be used for scaling if display window rectangle is different to input image rectangle. | |
void MV_DISPLAY_API_CALL | mvDispSetOverlayCallbackFunction (TDisp *pDisp, TImageDisplayOverlayFunction fctOverlay, void *pUserParam) |
Installs an overlay callback function. | |
void MV_DISPLAY_API_CALL | mvDispSetShift (TDisp *pDisp, int shift) |
Sets the shift value that shall be subtracted from the shift value needed to display the 8 msb of a pixel. | |
void MV_DISPLAY_API_CALL | mvDispSetWindowHandle (TDisp *pDisp, WindowHandle hwnd) |
Assigns a new destination window handle to a display object. | |
void MV_DISPLAY_API_CALL | mvDispUpdate (TDisp *pDisp) |
Immediately redraws the current image. | |
HDISP MV_DISPLAY_API_CALL | mvDispWindowCreate (const char *title) |
Creates a new display window object. | |
void MV_DISPLAY_API_CALL | mvDispWindowDestroy (HDISP hDisp) |
Closes a display window and frees allocated memory. | |
TDisp *MV_DISPLAY_API_CALL | mvDispWindowGetDisplayHandle (HDISP hDisp) |
Returns a pointer to the internal object used for displaying the image data. | |
TPreProcessMessage MV_DISPLAY_API_CALL | mvDispWindowGetMessageHandler (HDISP hDisp) |
Returns the current message handler for this window. | |
WindowHandle MV_DISPLAY_API_CALL | mvDispWindowGetWindowHandle (HDISP hDisp) |
Returns the handle of the display window. | |
void MV_DISPLAY_API_CALL | mvDispWindowSetMessageHandler (HDISP hDisp, TPreProcessMessage handler) |
Installs a callback to handle the window messages. | |
int MV_DISPLAY_API_CALL | mvDispWindowSetRefreshTime (HDISP hDisp, int time_ms) |
Defines the refresh time in ms. | |
void MV_DISPLAY_API_CALL | mvDispWindowShow (HDISP hDisp) |
Shows the display window. | |
Functions and data structures that can be used to display images.
enum TDisplayMode |
Defines valid display modes.
enum TFormatFlags |
Defines valid display pixel formats.
enum TImageDisplayError |
Defines valid error values for this module.
enum TInterpolationMode |
void MV_DISPLAY_API_CALL mvDispClear | ( | TDisp * | pDisp | ) |
Clears the display.
Either the windows default background will be displayed afterwards or if a background brush has been defined the background brush will be used to fill the complete client area.
[in] | pDisp | Handle to the display to clear. The handle must be the one obtained from a successful call to mvDispInit(). |
void MV_DISPLAY_API_CALL mvDispConvertFormat | ( | TImageBufferPixelFormat | pixelFormat, |
TFormatFlags * | pFormat, | ||
int * | pBitsPerPixel ) |
Converts a Impact Acquire pixel format into a format that can be digested by this module.
[in] | pixelFormat | The Impact Acquire pixel format to convert. |
[out] | pFormat | A pointer to variable that receives the format flags that can be passed to functions of this library. |
[out] | pBitsPerPixel | A pointer to variable that receives the bits per pixel for the format specified by pixelFormat. |
int MV_DISPLAY_API_CALL mvDispConvertFormatFromPFNC32 | ( | const unsigned int | pixelFormat, |
TFormatFlags * | pFormat, | ||
int * | pBitsPerPixel ) |
Converts a PFNC pixel format into a format that can be digested by this module.
[in] | pixelFormat | The PFNC pixel format to convert as unsigned int. |
[out] | pFormat | A pointer to variable that receives the format flags that can be passed to functions of this library. |
[out] | pBitsPerPixel | A pointer to variable that receives the bits per pixel for the format specified by pixelFormat. |
void MV_DISPLAY_API_CALL mvDispDeinit | ( | TDisp ** | ppDisp | ) |
Frees the resources consumed by this display object.
Frees the resources previously allocated by a call to mvDispInit().
[in,out] | ppDisp | A pointer to the pointer addressing the display object. This pointer will be set to NULL during the execution of this function. |
int MV_DISPLAY_API_CALL mvDispGetAppliedShift | ( | TDisp * | pDisp | ) |
Returns the current shift value that has been applied to the last image that has been displayed.
This function returns the shift value that has been applied to the last image that has been displayed. See mvDispSetShift() for a detailed explanation about the display behaviour when applying custom shift values.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
TDisplayMode MV_DISPLAY_API_CALL mvDispGetDisplayMode | ( | TDisp * | pDisp | ) |
Returns the current display mode.
Valid display modes are defined by TDisplayMode.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
int MV_DISPLAY_API_CALL mvDispGetError | ( | TDisp * | pDisp | ) |
Returns the last error and clears it.
If an error has occurred it will not be overwritten by subsequent errors till the error is queried and cleared. After calling this function a second call would return IDE_NoError until another error occurs.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
void MV_DISPLAY_API_CALL mvDispGetImage | ( | TDisp * | pDisp, |
const void ** | ppData, | ||
int * | pWidth, | ||
int * | pHeight, | ||
int * | pBitsPerPixel, | ||
int * | pPitch ) |
Gets the parameters of the current data block associated with the display.
If a parameter is not needed it might be 0 (NULL).
The data returned will always be in packed format.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[out] | ppData | A pointer to a variable to receive the storage location of the pixel data. This can be 0 if the value is not needed. |
[out] | pWidth | A pointer to a variable to receive the width of the current image. This can be 0 if the value is not needed. |
[out] | pHeight | A pointer to a variable to receive the height of the current image. This can be 0 if the value is not needed. |
[out] | pBitsPerPixel | A pointer to a variable to receive the bits per pixel of the current image. This can be 0 if the value is not needed. |
[out] | pPitch | A pointer to a variable to receive the pitch (bytes per pixel * width in pixel)of the current image. This can be 0 if the value is not needed. |
TInterpolationMode MV_DISPLAY_API_CALL mvDispGetInterpolationMode | ( | TDisp * | pDisp | ) |
Gets the current interpolation mode that will be used for scaling if display window rectangle is different to input image rectangle.
Valid interpolation modes are defined by TInterpolationMode.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
int MV_DISPLAY_API_CALL mvDispGetShift | ( | TDisp * | pDisp | ) |
Returns the current shift value as defined by the application.
This function returns the current shift value as defined by the application by previous calls to mvDispSetShift(). See mvDispSetShift() for a detailed explanation about the display behaviour when applying custom shift values.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
WindowHandle MV_DISPLAY_API_CALL mvDispGetWindowHandle | ( | TDisp * | pDisp | ) |
Returns the current window handle associated with the display object.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
TDisp *MV_DISPLAY_API_CALL mvDispInit | ( | HWND | hwnd | ) |
Initialises a new display object and associates it with the window whose handle is passed to the function.
This group contains functions and data structures that can be used to display images.
The full client area of a window will be consumed by a display object. Where the actual image shall be display relative to the upper left corner of the windows client area can be defined by calling mvDispSetDisplayRectangle(). This function will also limit the area where image data will be displayed. The area outside the display rectangle but within the windows client area can be filled by defining a background brush and then attach this brush to the display by calling mvDispSetBackgroundBrush().
If the actual image size differs from the area defined by mvDispSetDisplayRectangle(), it depends on the display mode if the complete image is scaled, cropped of just drawn in the top left corner of the display rectangle. The display mode can be modified by calling mvDispSetDisplayMode().
In addition to that only a part of the actual image can be selected for drawing by the function mvDispSetBitmapRectangle(). For this region the same scaling and cropping regions will be applied then.
[in] | hwnd | A handle to the window which should be used for the displaying. |
void MV_DISPLAY_API_CALL mvDispSetBackgroundBrush | ( | TDisp * | pDisp, |
BrushHandle | hBrush ) |
Associates a brush to be used for painting the background within the client area.
See mvDispInit() for a detailed description on which regions will be painted using the background brush.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | hBrush | Handle to the brush to be used to paint the background. This brush then will be used to paint the regions of the rectangle used for drawing that will not painted with the image itself. |
void MV_DISPLAY_API_CALL mvDispSetBitmapRectangle | ( | TDisp * | pDisp, |
int | left, | ||
int | top, | ||
int | width, | ||
int | height ) |
Sets the position and dimension of bitmap data region.
This defines the area relative within the area consumed by the window associated with the window handle that is bound to this display. See mvDispInit() for a detailed description on how to define the different rectangles and areas for drawing.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | left | The left offset of the rectangle. |
[in] | top | The top offset of the rectangle. |
[in] | width | The width of the bitmap rectangle. |
[in] | height | The height of the rectangle. |
void MV_DISPLAY_API_CALL mvDispSetDDrawOverlayKeyColor | ( | TDisp * | pDisp, |
ColorValue | keyColor ) |
Defines the key color for the DirectDraw® overlay.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | keyColor | The key color to be used for the DirectDraw® overlay. |
void MV_DISPLAY_API_CALL mvDispSetDisplayMode | ( | TDisp * | pDisp, |
TDisplayMode | mode ) |
Switches to a different display mode.
Valid display modes are defined by TDisplayMode.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | mode | The new display mode. |
void MV_DISPLAY_API_CALL mvDispSetDisplayRectangle | ( | TDisp * | pDisp, |
int | left, | ||
int | top, | ||
int | width, | ||
int | height ) |
Defines the rectangle used for drawing within the window associated with the display structure.
This function can be used to define a rectangle within the defined window Only this then will be used for drawing. This window can be smaller than the image defined by mvDispSetImage() or mvDispSetImageEx(). Then just a part of the image will be displayed when in DM_Fastest or the whole image will be scaled down to fit into the rectangle when in DM_Default mode.
When the display rectangle is larger than the image the image will be placed in the lower left corner of the display rectangle (either scaled or unscaled). See mvDispInit() for a detailed description on how to define the different rectangles and areas for drawing.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | left | The left offset within the window. |
[in] | top | The top offset within the window. |
[in] | width | The width of the rectangle to use for drawing. |
[in] | height | The height of the rectangle to use for drawing. |
void MV_DISPLAY_API_CALL mvDispSetImage | ( | TDisp * | pDisp, |
const void * | pData, | ||
int | width, | ||
int | height, | ||
int | bitsPerPixel, | ||
int | pitch ) |
Sets the next image to display.
This function can deal with RGB888x packed images, 8 bit grey-scale images and 16 bit Packed RGB images. For other formats the function mvDispSetImageEx() must be used.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | pData | A pointer to the address of the pixel data. |
[in] | width | The width of the image. |
[in] | height | The height of the image. |
[in] | bitsPerPixel | The number of bits per pixel. |
[in] | pitch | The pitch in bytes of one line of pixel data (bytes per pixel * width in pixel per line). |
void MV_DISPLAY_API_CALL mvDispSetImageEx | ( | TDisp * | pDisp, |
const void ** | ppData, | ||
size_t | ppDataArraySize, | ||
TFormatFlags | format, | ||
int | width, | ||
int | height, | ||
int | bitsPerPixel, | ||
int | pitch ) |
Sets the next image to display.
This is an enhanced version of the function mvDispSetImage().
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | ppData | An array of pointers that point to the actual image data For planar RGB images e.g. this can be 3 pointers each pointing to one color plane. |
[in] | ppDataArraySize | The number of pointers passed via ppData. |
[in] | format | The pixel format as defined by TFormatFlags. |
[in] | width | The width of the image. |
[in] | height | The height of the image. |
[in] | bitsPerPixel | The number of bits per pixel. |
[in] | pitch | The pitch in bytes of one line of pixel data (bytes per pixel * width in pixel per line). |
void MV_DISPLAY_API_CALL mvDispSetImageFromImageBuffer | ( | TDisp * | pDisp, |
const ImageBuffer * | pBuf ) |
Sets the next image to display.
This function can deal with any pixel format supported by Impact Acquire.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | pBuf | The image buffer object that shall be displayed. |
|
inline |
Sets the next image to display.
This function can deal with any pixel format supported by Impact Acquire.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | pRequest | The request object that shall be displayed. |
void MV_DISPLAY_API_CALL mvDispSetInterpolationMode | ( | TDisp * | pDisp, |
TInterpolationMode | interpolationMode ) |
Sets the new interpolation mode that will be used for scaling if display window rectangle is different to input image rectangle.
Valid interpolation modes are defined by TInterpolationMode.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | interpolationMode | The new interpolation mode. |
void MV_DISPLAY_API_CALL mvDispSetOverlayCallbackFunction | ( | TDisp * | pDisp, |
TImageDisplayOverlayFunction | fctOverlay, | ||
void * | pUserParam ) |
Installs an overlay callback function.
This function will be executed when operated in DM_Default mode and can be used to draw a user defined overlay on top of the image before it is displayed.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | fctOverlay | The address of the function to be called for a user. defined overlay |
[in] | pUserParam | A pointer to a user defined parameter. |
void MV_DISPLAY_API_CALL mvDispSetShift | ( | TDisp * | pDisp, |
int | shift ) |
Sets the shift value that shall be subtracted from the shift value needed to display the 8 msb of a pixel.
This function will allow to select which 8 bits out of a multi-byte pixel format shall be displayed the next time mvDispUpdate() is called. When the shift value is 0 the 8 msb of each pixel will be displayed so e.g. for a 12 bit format bits 11 to 4 will be displayed by default.
Consider the typical layout of 12 mono pixel data in memory:
So with an application defined shift value of 0 (the default), the display module will shift each 2 byte pixel by 4 positions to the right. This will remove the 4 lsb from the data. Afterwards the now empty upper byte of each pixel is removed from the data resulting in the following memory layout which is then displayed on the canvas:
Now sometimes it is required to display other bits from the image e.g. for analysis purposes. As most operating systems only support to display 8 bits per color component this requires to select a different range of pixels to be sent to the canvas. This can be done by calling this function and passing a custom shift value to it. The custom shift value will be subtracted from the value that would be needed to display the 8 msb for a given format.
So to display the 8 lsb for a 12 bit mono format, shift must be set to 4. This then results in the display module to use a actual shift value of 4(required to display the 8 msb) - 4(defined by calling this function) = 0. Then removing the upper byte from each pixel results in only the 8 lsb of each pixel being displayed.
When e.g. setting shift to 3 for a 12 bit mono for would result in bits 8 - 1 to be displayed:
The shift value that has actually been applied the last time an image has been displayed (thus '1' when taking the example in the image above (4(required) - 3(defined))) can be queried by calling mvDispGetAppliedShift().
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | shift | The shift value to apply to the displayed images. The maximum value for this function is 8, the minimum 0. Values out of this range will be ignored. It is NOT possible to shift pixel data in such a way that less than 8 bits contain valid data, thus e.g. a shift value of 2 applied to 8 bit mono data will be ignored. |
void MV_DISPLAY_API_CALL mvDispSetWindowHandle | ( | TDisp * | pDisp, |
WindowHandle | hwnd ) |
Assigns a new destination window handle to a display object.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
[in] | hwnd | The handle of the new destination window. |
void MV_DISPLAY_API_CALL mvDispUpdate | ( | TDisp * | pDisp | ) |
Immediately redraws the current image.
[in] | pDisp | A handle to a display structure obtained from a successful call to mvDispInit(). |
HDISP MV_DISPLAY_API_CALL mvDispWindowCreate | ( | const char * | title | ) |
Creates a new display window object.
This function will allocate all internal data structures needed to work with a display window object. It uses the functions declared in mvDisplay.h internally and provides a complete window class as well. Calling this function will NOT display the window. To display the window, mvDispWindowShow() must be called.
[in] | title | The title of the window (will be displayed in the windows title bar). |
void MV_DISPLAY_API_CALL mvDispWindowDestroy | ( | HDISP | hDisp | ) |
Closes a display window and frees allocated memory.
This function frees every memory allocated by calls to mvDispWindowCreate() and mvDispWindowShow(). Afterwards the pointer returned by the function mvDispWindowGetDisplayHandle() will be invalid.
[in] | hDisp | A handle to a display window previously created with mvDispWindowCreate(). |
TDisp *MV_DISPLAY_API_CALL mvDispWindowGetDisplayHandle | ( | HDISP | hDisp | ) |
Returns a pointer to the internal object used for displaying the image data.
[in] | hDisp | A handle to a display window previously created with mvDispWindowCreate(). |
TPreProcessMessage MV_DISPLAY_API_CALL mvDispWindowGetMessageHandler | ( | HDISP | hDisp | ) |
Returns the current message handler for this window.
[in] | hDisp | A handle to a display window previously created with mvDispWindowCreate(). |
WindowHandle MV_DISPLAY_API_CALL mvDispWindowGetWindowHandle | ( | HDISP | hDisp | ) |
Returns the handle of the display window.
[in] | hDisp | A handle to a display window previously created with mvDispWindowCreate(). |
void MV_DISPLAY_API_CALL mvDispWindowSetMessageHandler | ( | HDISP | hDisp, |
TPreProcessMessage | handler ) |
Installs a callback to handle the window messages.
[in] | hDisp | A handle to a display window previously created with mvDispWindowCreate(). |
[in] | handler | Pointer to a function which is called by the windows procedure before the display update is done. If zero is passed here even the internal default handler will be disabled and WM_SIZE and WM_LBUTTONDBLCLK will no longer be handled internally. |
int MV_DISPLAY_API_CALL mvDispWindowSetRefreshTime | ( | HDISP | hDisp, |
int | time_ms ) |
Defines the refresh time in ms.
This function can be used to define a refresh period that - when elapsed - will automatically repaint the window.
[in] | hDisp | A handle to a display window previously created with mvDispWindowCreate(). |
[in] | time_ms | The refresh period for the window in ms. Passing 0 will disable the automatic repaint behaviour. |
void MV_DISPLAY_API_CALL mvDispWindowShow | ( | HDISP | hDisp | ) |
Shows the display window.
Shows the display window previously created by mvDispWindowCreate().
[in] | hDisp | A handle to a display window previously created with mvDispWindowCreate(). |