DisplayStart

#include "BIDISP.H"

 

UINT CALLBACK DisplayStart( HWND          hWnd,
HBITMAP    hBitmap,
HPALETTE  hPal,
LPPOINT      lpptDPI,
LPRECT        lprScroll,
LPRECT        lprScale,
UINT             wDisplayFormat,
LPDISPLAYSTRUCT  cb)

Description

This function displays the image passed as a device dependent bitmap. The LPDISPLAYSTRUCT structure will be filled automatically. This structure is used internally for scrolling and to format the image to display.

Parameters

HWND

hWnd

Window handle to getting client parameters.

HBITMAP

hBitmap

Device dependent bitmap handle.

HPALETTE

hPal

Palette handle.

LPPOINT

lpptDPI

Image DPI, if NULL use screen DPI.

LPRECT

lprScroll

Describes which part of 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

If hPal is NULL it will not be used.

If lpptDPI is NULL or the x and y field is zero, then the resolution will default to the screen resolution.

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_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 both the vertical and horizontal direction.

DISP_INVERT                     - Displays the image as inverted image.

DISP_SCALED                    - Use DPI information for displaying image.

DISP_CENTER                    -  Forces the image to align centered onto the
window.

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

DISP_NOVERTSCROLL   - Prevents the vertical scroll bar to be showed.

DISP_NOHORZSCROLL   - Prevents the horizontal scroll bar to be showed.

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

#include "BIDISP.H"

                . . .

                case WM_CREATE:

                                rOrg .left = rOrg.top = rOrg.right = rOrg.bottom = 0;

                                rScale.left = rScale.top = rScale.right = rScale.bottom = 1;

                                DisplayDIBStart(hWnd, hDib, &rOrg, &rScale, &sDisplayStruct);

                                break;

                case WM_PAINT:

                                DisplayWmPaint(hWnd, &sDisplayStruct);

                                break;

                case WM_HSCROLL:

                                DisplayWmHorzScroll(hWnd, wParam, lParam, &sDisplayStruct);

                                break;

                case WM_VSCROLL:

                                DisplayWmVertScroll(hWnd, wParam, lParam, &sDisplayStruct);

                                break;

                case WM_SIZE:

                                DisplayWmSize(hWnd, wParam, lParam, &sDisplayStruct);

                                break;