Home > C: Programming > Function Descriptions > History back  Previous chapter  Next chapter  Print  

is_DirectRenderer

uEye Camera Manual Version 3.80

is_DirectRenderer

Windows_Logo

Linux_Logo

USB 2.0

GigE

-

Syntax

INT is_DirectRenderer (HIDS hCam,
UINT nMode,
void* pParam,
UINT nSize)

Description

is_DirectRenderer() provides a set of advanced rendering functions and allows inserting overlay data into the camera's live image without flicker. The graphics card functions of the Direct3D library are supported under Windows.

Notes on using the function:

The second input parameter nMode specifies the effect of the is_DirectRenderer() call.
The value of the third parameter pParam depends on the mode selected with nMode: For example, when setting the overlay size (nMode = DR_SET_OVERLAY_SIZE), a pointer to an array of two values (x and y) is passed (see code samples). When you load a bitmap image (nMode = DR_LOAD_OVERLAY_FROM_FILE), pParam passes the path to the file (see code samples). The required parameters are illustrated in the sample codes at the end of this section.

Achtung

Note on system requirements

To use the Direct3D functionality, the appropriate version of the Microsoft DirectX Runtime has to be installed in your PC.
When you are using high-resolution cameras, the maximum texture size supported by the graphics card should be at least 4096 x 4096 pixels. You can check the maximum texture size by reading out the D3D_GET_MAX_OVERLAY_SIZE parameter.
The Direct3D mode automatically uses the Windows Desktop color depth setting for the display.

Please also read the notes on graphics cards which are provided in the System Requirements chapter.

Hinweis

Note on displaying monochrome or raw data formats

To display monchrome or Bayer raw data in Direct3D, please set the appropriate constants using the is_SetDisplayMode() function.

Input Parameters

hCam

Camera handle

nMode


DR_GET_OVERLAY_DC

Returns the device context (DC) handle to the overlay area of the graphics card.

More details

In Direct3D mode, the DR_GET_OVERLAY_DC mode returns the device context (DC) handle of the overlay area. Using this handle, it is possible to access the overlay using the Windows GDI functionality. Thus, all Windows graphics commands (e.g. Line, Circle, Rectangle, TextOut) are available. To transfer the drawn elements to the overlay, release the DC handle by calling DR_RELEASE_OVERLAY_DC.

- Code sample

DR_RELEASE_OVERLAY_DC

Releases the device context (DC) handle.

More details

Using DR_RELEASE_OVERLAY_DC, you can release the DC handle and update the overlay data.

- Code sample

DR_GET_MAX_OVERLAY_SIZE

Returns the width x and height y of the maximum overlay area supported by the graphics card. Code sample

DR_SET_OVERLAY_SIZE

Defines the size of the overlay area (default: current camera image size). Code sample

DR_GET_OVERLAY_SIZE

Returns the size of the overlay area. (Sample: see DR_SET_OVERLAY_SIZE)

DR_SET_OVERLAY_POSITION

Defines the position of the overlay area. Code sample

DR_GET_OVERLAY_KEY_COLOR

Returns the RGB values of the current key color (default: black). Code sample

DR_SET_OVERLAY_KEY_COLOR

Defines the RGB values of the key color. More details

The key color specifies where the camera image will be visible in the overlay area. For example: if you fill the complete overlay with the key color, the whole camera image will be visible. If you fill part of the overlay with a different color, the camera image will be covered by the overlay in those places.

The key color has no effect in semi-transparent mode!

- Code sample

DR_SHOW_OVERLAY

Enables overlay display on top of the current camera image. Code sample

DR_HIDE_OVERLAY

Disables overlay display. Code sample

DR_ENABLE_SCALING

Enables real-time scaling of the image to the size of the display window. The overlay is scaled together with the camera image. Code sample

DR_ENABLE_IMAGE_SCALING

Enables real-time scaling of the image to the size of the display window. The overlay is not scaled. (Sample: see DR_ENABLE_SCALING)

DR_DISABLE_SCALING

Disables real-time scaling. Code sample

DR_ENABLE
_SEMI_TRANSPARENT_OVERLAY

Enables a semi-transparent display of the overlay area. More details

In semi-transparent mode, the values of the camera image and the overlay data are added up for each pixel. Since black has the value 0, the complete camera image will be visible if the overlay is black; if the overlay is white, only the overlay will be visible. With all other colors, the camera image will be visible with the overlay superimposed.

The key color has no effect in semi-transparent mode!

- Code sample

DR_DISABLE
_SEMI_TRANSPARENT_OVERLAY

Disables the semi-transparent display of the overlay area. Code sample

DR_SET_VSYNC_AUTO

Enables synchronization of the image display with the monitor's image rendering. The image is displayed upon the monitor's next VSYNC signal. Code sample

DR_SET_VSYNC_OFF

Disables image display synchronization. The image is displayed immediately. Code sample

DR_SET_USER_SYNC

Enables synchronization of the image display with a monitor pixel row specified by the user. More details

When displaying very large camera images, the auto-VSYNC function might not always optimally synchronize image rendering. In this case, you can eliminate flicker by manually setting a suitable position for synchronization. The position needs to be determined individually, based on the camera type and the graphics card.

- Code sample

DR_GET_USER
_SYNC_POSITION_RANGE

Returns the minimum and maximum row position for DR_SET_USER_SYNC. Code sample

DR_LOAD_OVERLAY_FROM_FILE

Loads a bitmap image (*.BMP file) into the overlay area. If the bitmap image is larger than the overlay area, the bitmap image is clipped. Code sample

DR_CLEAR_OVERLAY

Deletes the data of the overlay area by filling it with black color. Code sample

DR_STEAL_NEXT_FRAME

Copies the next image to the active user memory (Steal function). More details - Code sample

Using the pParam parameter, you specify when the function should return:

IS_WAIT

The function waits until the image save is complete.

IS_DONT_WAIT

The function returns immediately.

DR_SET_STEAL_FORMAT

Defines the color format for the Steal function. More details - Code sample

For a list of all available color formats, see the function description for is_SetColorMode(). The default is IS_CM_BGRA8_PACKED (RGB 32).

DR_GET_STEAL_FORMAT

Returns the color format setting for the Steal function. Code sample

DR_SET_HWND

Sets a new window handle for image output in Direct3D. Code sample

DR_CHECK_COMPATIBILITY

Returns whether the graphics card supports the uEye Direct3D functions. Code sample

pParam

void-type pointer to a data object or an array of objects (depending on the mode selected using nMode).

nSize

Size (in bytes) of the data object or array.

Return Values

IS_SUCCESS

Function executed successfully

IS_NO_SUCCESS

General error message

When used with

DR_CHECK_COMPATIBILITY

IS_DR_DEVICE_CAPS_INSUFFICIENT

The graphics hardware does not fully support the uEye Direct3D functions

Related Functions

is_SetDisplayMode()
is_SetColorMode()
is_SetImageMem()
is_RenderBitmap()

Code Samples

//------------------------------------

//          DC-Handle              

//------------------------------------

 

// Get DC handle for Overlay

HDC hDC;

is_DirectRenderer (hCam, DR_GET_OVERLAY_DC, (void*)&hDC, sizeof (hDC));

 

// Release DC handle

is_DirectRenderer (hCam, DR_RELEASE_OVERLAY_DC, NULL, NULL);

 

//------------------------------------

//          Size of overlay        

//------------------------------------

 

// Query maximum size of overlay area

UINT OverlaySize[2];

is_DirectRenderer (hCam, DR_GET_MAX_OVERLAY_SIZE,
(void*)OverlaySize, sizeof(OverlaySize));

INT nWidth = OverlaySize[0];

INT nHeight = OverlaySize[1];

 

// Set size of overlay area

UINT Size[2];

Size[0] = 100;

Size[1] = 120;

is_DirectRenderer (hCam, DR_SET_OVERLAY_SIZE,
(void*)Size, sizeof (Size));

 

// Set position of overlay area

UINT Position[2];

Position[0] = 20;

Position[1] = 0;

is_DirectRenderer (hCam, DR_SET_OVERLAY_POSITION,
void*)Position, sizeof (Position));

 

//------------------------------------

//          Key color              

//------------------------------------

 

// Get current key color

UINT OverlayKeyColor[3];

is_DirectRenderer (hCam, DR_GET_OVERLAY_KEY_COLOR,
(void*)OverlayKeyColor, sizeof(OverlayKeyColor));

 

INT nRed = OverlayKeyColor[0];

INT nGreen = OverlayKeyColor[1];

INT nBlue = OverlayKeyColor[2];

 

// Set new key color

OverlayKeyColor[0] = GetRValue(m_rgbKeyColor);

OverlayKeyColor[1] = GetGValue(m_rgbKeyColor);

OverlayKeyColor[2] = GetBValue(m_rgbKeyColor);

is_DirectRenderer (hCam, DR_SET_OVERLAY_KEY_COLOR,
(void*)OverlayKeyColor, sizeof(OverlayKeyColor));

 

//------------------------------------

//          Display              

//------------------------------------

 

// Show overlay

is_DirectRenderer (hCam, DR_SHOW_OVERLAY, NULL, NULL);

 

// Hide overlay

is_DirectRenderer (hCam, DR_HIDE_OVERLAY, NULL, NULL);

 

//------------------------------------

//          Scaling              

//------------------------------------

 

// Enable scaling

is_DirectRenderer (hCam, DR_ENABLE_SCALING, NULL, NULL);

 

// Disable scaling

is_DirectRenderer (hCam, DR_DISABLE_SCALING, NULL, NULL);

 

//------------------------------------

//          Transparency              

//------------------------------------

 

// Enable semi-transparent overlay

is_DirectRenderer (hCam, DR_ENABLE_SEMI_TRANSPARENT_OVERLAY, NULL, NULL);

 

// Disable semi-transparent overlay

is_DirectRenderer (hCam, DR_DISABLE_SEMI_TRANSPARENT_OVERLAY, NULL, NULL);

 

//------------------------------------

//          Synchronization              

//------------------------------------

 

// Enable auto-synchronization

is_DirectRenderer (hCam, DR_SET_VSYNC_AUTO, NULL, NULL);

 

// User defined synchronization: Query range and set position

UINT UserSync[2];

is_DirectRenderer (hCam, DR_GET_USER_SYNC_POSITION_RANGE,
(void*)UserSync, sizeof (UserSync));

INT Min = UserSync[0];

INT Max = UserSync[1];

INT SyncPosition = 400;

is_DirectRenderer (hCam, DR_SET_USER_SYNC,
void*)&SyncPosition, sizeof (SyncPosition));

 

// Disable synchronization

is_DirectRenderer (hCam, DR_SET_VSYNC_OFF, NULL, NULL);

 

//------------------------------------

//          BMP file

//------------------------------------

 

// Load overlay from BMP file

is_DirectRenderer (hCam, DR_LOAD_OVERLAY_FROM_FILE,
(void*)”c:\test.bmp”, NULL);

 

//------------------------------------

//          Delete overlay            

//------------------------------------

 

// Delete overlay area

is_DirectRenderer (hCam, DR_CLEAR_OVERLAY, NULL, NULL);

 

//------------------------------------

//          Steal mode              

//------------------------------------

 

// Get and set color mode for image to be copied

INT nColorMode;

is_DirectRenderer (hCam, DR_GET_STEAL_FORMAT,
(void*)&nColorMode, sizeof (nColorMode));

 

nColorMode = IS_CM_MONO8;

is_DirectRenderer (hCam, DR_SET_STEAL_FORMAT,
void*)&nColorMode, sizeof (nColorMode));

 

// Copy image with function returning immediately

INT nwait = IS_DONT_WAIT;

is_DirectRenderer(hCam, DR_STEAL_NEXT_FRAME,
(void*)&wait, sizeof (wait));

 

//------------------------------------

//          Handle to window              

//------------------------------------

 

// Set new window handle for image display

is_DirectRenderer (hCam, DR_SET_HWND,
(void*)&hWnd, sizeof (hWnd));

 

 

//------------------------------------

//          Compatibility              

//------------------------------------

 

// Check graphics card compatibility

INT nRet = is_DirectRenderer (hCam, DR_CHECK_COMPATIBILITY, NULL, NULL);

 

if (nRet == IS_DR_DEVICE_CAPS_INSUFFICIENT )

// Graphics card does not support Direct3D

Sample Programs

uEyeDirectRenderer
uEyeSteal

Suggestion for improvement? Send us your short Feedback on this chapter. Thank you very much!


© 2010 IDS Imaging Development Systems GmbH
http://www.ids-imaging.com