RefreshDIB

#include "BIDISP.H"

 

WORD CALLBACK RefreshDIB (       HWND          hWnd,
HDIB            hDIB,
LPRECT        lprScroll,
LPRECT        lprScale,
UINT             wDisplayFormat,
LPDISPLAYSTRUCT cb)

Description

This function displays the image passed as a device independent bitmap. This function should be used any time the DIB changes or display mode changes. The DPI resolution is part of the BITMAPINFOHEADER data structure. The LPDISPLAYSTRUCT structure will be filled automatically. This structure is used internally for scrolling and to format the image to display. The Flag of DISP_NEWDIB should be set whenever the DIB changes physically. That includes the first time one calls RefreshDIB(). Each time one changes the DIB, such as rotate, invert, or replace, one must set the DISP_NEWDIB flag.  This function can be used instead of the DisplayDIBStart function.

Parameters

HWND

hWnd

Window handle to get client parameters.

HDIB

hDIB

Device independent bitmap handle.

LPRECT

lprScroll

Describes which part of the bitmap is displayed.

LPRECT

lprScale

Scaling factor for X and Y axis. (left:top and right:bottom)

UINT

wDisplayFormat

Display format.

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

0 on failures, display format on success.

Programming notes

The scaling factor is stored in the RECT data structure where one can define the ratio for scaling for the X or Y coordinate by two integers as 3:4 or 13:19 in the lprScale->left and lprScale->top field for X coordinate and lprScale->right and lprScale->bottom for the Y coordinate. For code example:

Scaling in X axis = left;top 1:3 increases the image width by three times
Scaling in Y axis = right;bottom 1:3 increases the image height by three times

UINT wDisplayFormat can be set to:

   DISP_NEWDIB                     - Regenerate the a new BITMAP internally.

   DISP_NORMAL                   - Display image pixel by pixel.

   DISP_PREVIEW                  - Forces the image to fit into the window client area using DPI information and unique scaling  factors in both the vertical and horizontal direction.

   DISP_INVERT                      - Displays the image an inverted image.

   DISP_SCALED                     - Use DPI information for displaying image.

   DISP_CENTER                    -  Forces the image to be aligned centered onto the window.

   DISP_FITTOWIDTH           - Forces the image to fit into the window client area using unique scaling factors in the horizontal direction.

   DISP_FITTOHEIGHT         - Forces the image to fit into the window client area using unique scaling factors in the vertical direction.

   DISP_FITSCREEN              - Forces the image to fit into the window client area using unique scaling factors in both the vertical and horizontal direction.

   DISP_NOVERTSCROLL   - Prevents the vertical scroll bar to be shown.

   DISP_NOHORZSCROLL   - Prevents the horizontal scroll bar to be shown.

The display formats can be combined by the β€œ|” binary β€œOR” operator. For example, DISP_INVERT | DISP_NORMAL is valid.

In the case of, DISP_NORMAL | DISP_SCALED. The DISP_SCALED takes precedence over DISP_NORMAL.

Requirements

Header :     Declared in BIDisp.h; include BIDisp.h.

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll, BiDIB.dll.

Code example

See sample code at DisplayWmCreate().