Display

This section covers the Display Capabilities of the Document Imaging SDK.

Display Functions

This section covers Display Functions of the Document Imaging SDK.


DisplayDIBImage

#include "BIDISP.H"

 

VOID CALLBACK DisplayDIBImage(                   HWND           hWnd,
HANDLE   hDIB,
LPRECT     lprScroll,
LPRECT     lprScale,
WORD       wDisplayFormat)

Description

This function displays the device independent bitmap. The DisplayDIBImage() function should be called only in response to the WM_PAINT message.

Parameters

HWND

hWnd

Window handle to display image.

HANDLE

hDIB

Device independent bitmap handle.

LPRECT

lprScroll

The scrolling area.

LPRECT

lprScale

The X and Y scaling factor.

WORD

wDisplayFormat

Display mode.

Return values

None.

Programming notes

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

The scaling factor is stored in the a 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 example:

Scaling in X axis = left:top           1:3 increase the image width by three times.

Scaling in Y axis = right:bottom   1:3 increase the image height by three times.

WORD wDisplayFormat can be set to DISP_NORMAL, DISP_ZOOM, or DISP_PREVIEW. The  DISP_NORMAL will display the image proportionally. The DISP_ZOOM user has to set the lprScale factor to reflect the zoom in or out factor. The DISP_PREVIEW forces the image to fit into the client area.

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_PAINT:

            // Image is in the DIB

            DisplayDIBImage(hWnd, hDIB, &rScroll, &rScale, nDispFormat);

         break;

            .

            .

            .


DisplayDIBImageDC

#include "BIDISP.H"

 

WORD CALLBACK DisplayDIBImageDC(               HDC           hdc
                                                                        LPDISPLAYSTRUCT cb)

Description

This function displays the image passed as a device independent bitmap onto the given device context. The DPI resolution is part of the BITMAPINFOHEADER data structure.

Parameters

HDC

hdc

Identifies the handle of a device context.

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 member of the cb structure 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 picture.

   DISP_SCALED                     - Use DPI information for displaying image.

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

   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.


DisplayDIBStart

#include "BIDISP.H"

 

WORD CALLBACK DisplayDIBStart(                      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 DisplayDIBStart(). Each time one changes the DIB, such as rotate, invert, or replace, one must set the DISP_NEWDIB flag.

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 picture.

   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().


DisplayImage

#include "BIDISP.H"

 

VOID CALLBACK DisplayImage(                       HWND  hWnd,
HBITMAP      hBitmap,
HPALETTE    hPal,
LPRECT         lprScroll,
LPPOINT       lpptDPI,
LPRECT         lprScale,
WORD            wDisplayFormat)

Description

This function displays the bitmap image passed as a device dependent bitmap. The DisplayImage() function should be called only in response to the WM_PAINT message.

Parameters

HWND

hWnd

Window handle to display image.

HBITMAP

hBitmap

Device dependent bitmap handle.

HPALETTE

hPal

Bitmap's palette handle.

LPRECT

lprScroll

The scroll range in physical coordinates

LPPOINT

lpptDPI

Dot per inch resolution of the image.

LPRECT

lprScale

The X and Y scaling factor.

WORD

wDisplayFormat

Display mode.

Return values

None.

Programming notes

If hPal is NULL it will not be used.

if lpptDPI is NULL or the x and y field is zero, then DPI 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 example:

Scaling in X axis = left:top              1:3    increase the image width by three times.

Scaling in Y axis = right:bottom      1:3    increase the image height by three times.

WORD wDisplayFormat can be set to DISP_NORMAL, DISP_ZOOM, or DISP_PREVIEW. The DISP_NORMAL will display the image proportionally. The DISP_ZOOM user has to set the lprScale factor to reflect the zoom in or out factor. The DISP_PREVIEW forces the image to fit into the client area.

The lpScroll parameter has meaning only when the Bitmap is larger then the Device Context (DC).

Description: kep        

 

 

If lpScroll.left is < 0 then lpScroll.right  is the top let corner of the Bitmap relative to the DC and the distance of ‘a’ = lpScroll.right (Inch/100.)

 

If lpScroll.left is > 0 then ‘a’ is computed as ‘a’= lpScroll.let(bitmap pixel) + lpScroll.right(DC pixel).

 

If lpScroll.top is < 0 then lpScroll.bottom  is the top let corner of the Bitmap relative to the DC and the distance of ‘b’ = lpScroll.bottom (Inch/100.)

 

If lpScroll.left is > 0 then ‘b’ is computed as ‘b’= lpScroll.top(bitmap pixel) + lpScroll.bottom(DC pixel).

 

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code Example

            #include "BIDISP.H"

 

            .

            .

            .

      case WM_PAINT:

            // Image is in the bitmap

            DisplayImage(hWnd, hCurrentBitmap, hPal, &rScroll, &ptDpi, &rScale, nDispFormat);

            break;

            .

            .

            .


DisplayImageDC

#include "BIDISP.H"

 

UINT CALLBACK DisplayImageDC(                           HDC     hdc,
LPDISPLAYSTRUCT   cb)

Description

This function displays the image passed as a device dependent bitmap to the given device context.

Parameters

HDC

hdc

Identifies the handle of a device context.

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 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 member of the cb structure 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 picture.

DISP_SCALED                    - Use DPI information for displaying image.

DISP_CENTER                    -  Forces the image to align 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 both in 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.


DisplayGetStretchBltMode

#include "BIDISP.H"

 

int CALLBACK DisplayGetStretchBltMode ()

Description

The DisplayGetStretchBltMode function returns the current StretchBltMode that is used to display the image.

Parameters

HWND

hWnd

Window handle to get client parameters.

Return values

The function returns the current StretchBltMode. Valid values are the following:

BLACKONWHITE                                            1
WHITEONBLACK                                            2
COLORONCOLOR                                           3
HALFTONE                                                       4

For more information about these values, please refer to the description of the SetStretchBltMode WIN32 function in the WIN32 documentation.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code example

See sample code at DisplayWmCreate().


DisplayNote

#include "BIDISP.H"

 

LRESULT CALLBACK DisplayNote(                                       HDC         hDc,
         LPDISPLAYSTRUCT  lpView
         LPNOTESTRUCT        lpNote)

Description

The DisplayNote() function should be called in response to the WM_PAINT message. The propose of this function is to display a text Note on the image.

Parameters

HDC

hDc

Window Device Context handle.

LPDISPLAYSTRUCT

lpView

Display information structure.

LPNOTESTRUCT

lpNote

The Note data structure.

Return values

The return value is the result of the message processing.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


DisplaySetScrollPos

#include "BIDISP.H"

 

LRESULT CALLBACK DisplaySetScrollPos( HWND                          hWnd,
LPDISPLAYSTRUCT  lpView,
LPPOINT                      ptPos)

Description

Scrolls the displayed image to the new position. Create a Pan Window with this function.

Parameters

HWND

hWnd

Window handle to getting client parameters.

LPDISPLAYSTRUCT

lpView

Display information structure.

LPPOINT

ptPos

New scroll position.

Return values

Returns 0 on success, or error code.

Programming notes

The scroll position in the scroll range is stored in the DISPLAYSTRUCT

rcScrollRange      store the valid scroll positions.

                             rcScrollRange.left   - minimum X scroll position.

                             rcScrollRange.right - maximum X scroll position.

                             rcScrollRange.top   - minimum Y scroll position. 

                             rcScrollRange.bottom - maximum Y scroll position.

 

pScrollPos            store the current scroll positions.

                             pScrollPos.x - current X scroll position.

                             pScrollPos.y - current Y scroll position.

 

All scroll positions use device coordinates in pixel.

Not all scroll positions are valid. The function checks the new position and scrolls to the best valid position . The minimum scrollable unit depends on the  scaling mode and the scaling factor. This value is not stored in DISPLAYSTRUCT but can be calculated by using MapDisplayDC function.

POINT ptMinScrollUnit;

HDD hDc = GetDC(hWnd);

MapDisplayDC(hDC,&Disp);

GetViewportExtEx(hDC,& ptMinScrollUnit );

ReleaseDC(hWnd,hDC);

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code example

Example code to create pan with this function.

POINT ptStartScroll , ptStartMouse;

BOOL bDown;

 

LRESULT WndProc(HWND hWNd,UINT iMessage,WPARAM wParam,LPARAM lParam)

{

  switch (iMessage)

  {

     case WM_LBUTTONDOWN:

            bDown = TRUE;

            ptStartScroll = sDisplay.pScrollPos;

            ptStart = (POINT) lParam;

            break;

     case WM_MOUSEMOVE:

           if ( bDown )

           {

                POINT ptNewPos ,ptMouse;

                ptMouse = (POINT) lParam;

                ptNewPos.x = ptStartScroll.x - ( ptMouse.x- ptStartMouse.x);

                ptNewPos.y = ptStartScrolll.y - (ptMouse.y- ptStartMouse.y);

                DisplaySetScrollPos(hWnd,&sDisplay,&ptNewPos);

           }

           break;

     case WM_LBUTTONUP:

           bDown = FALSE;

           break;

  }

}


DisplaySetStretchBltMode

#include "BIDISP.H"

 

int CALLBACK DisplaySetStretchBltMode (int iNewDisplayStretchBltMode)

Description

The DisplaySetStretchBltMode function set the StretchBltMode that is used to display the image.

Parameters

int

iNewDisplayStretchBltMode

Window handle to get client parameters.

 

 

Specifies the new StretchBltMode. Valid values are:

BLACKONWHITE          1
WHITEONBLACK          2
COLORONCOLOR         3
HALFTONE                   4

 

For more information about these values, please refer to the description of the SetStretchBltMode WIN32 function in the WIN32 documentation.

Return values

The function returns the current StretchBltMode.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code example

None.


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 picture.

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;


DisplayWmCreate

#include "BIDISP.H"

 

LRESULT CALLBACK DisplayWmCreate(                       HWND           hWnd,
                  WPARAM      wParam,
                  LPARAM       lParam,
                  LPDISPLAYSTRUCT cb)

Description

The DisplayWmCreate function should be called in response to the WM_CREATE message. The propose of this function is to initialize the cb structure.

Parameters

HWND

hWnd

Window handle to get client parameters.

WPARAM

wParam

First 32 bits additional information of the window
procedure.

LPARAM

lParam

Second 32 bits additional information of the window
procedure.

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

The return value is the result of the message processing.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code example

#include "BIDISP.H"

 

            . . .

            case WM_CREATE:

                        DisplayWmCreate(hWnd, hDib, wParam, lParam, &sDisplayStruct);

                        break;

            // user defined message to display the image.

            case WM_USER:

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

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

                        DisplayDIBStart(hWnd, hDib, &rOrg, &rScale, wDispFormat,
                        &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;

            case WM_DESTROY:

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

                        break;


DisplayWmDestroy

#include "BIDISP.H"

 

LRESULT CALLBACK DisplayWmDestroy(                     HWND    hWnd,
WPARAM   wParam,
LPARAM    lParam,
LPDISPLAYSTRUCT        cb)

Description

The DisplayWmDestroy function should be called in response to the WM_DESTROY message. The propose of this function is to free up all allocated objects.

Parameters

HWND

hWnd

Window handle to get client parameters.

WPARAM

wParam

First 32 bits additional information of the window procedure.

LPARAM

lParam

Second 32 bits additional information of the window procedure.

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

The return value is the result of the message processing.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code example

See sample code at DisplayWmCreate().


DisplayWmHorzScroll

#include "BIDISP.H"

 

LRESULT CALLBACK DisplayWmHorzScroll(                     HWND     hWnd,
WPARAM   wParam,
LPARAM    lParam,
LPDISPLAYSTRUCT  cb)

Description

The DisplayWmHorzScroll function should be called in response to the WM_HSCROLL message.

Parameters

HWND

hWnd

Window handle to get client parameters.

WPARAM

wParam

First 32 bits additional information of the window procedure.

LPARAM

lParam

Second 32 bits additional information of the window procedure.

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

The return value is the result of the message processing.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code example

See sample code at DisplayWmCreate().


DisplayWmPaint

#include "BIDISP.H"

 

LRESULT CALLBACK DisplayWmPaint(                 HWND          hWnd,
LPDISPLAYSTRUCT  cb)

Description

The DisplayWmPaint function should be called only in response to the WM_PAINT message.

Parameters

HWND

hWnd

Window handle to get client parameters.

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

The return value is the result of the message processing.

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().


DisplayWmSize

#include "BIDISP.H"

 

LRESULT CALLBACK DisplayWmSize(                     HWND     hWnd,
WPARAM   wParam,
LPARAM    lParam,
LPDISPLAYSTRUCT cb)

Description

The DisplayWmSize function should be called in response to the WM_SIZE message.

Parameters

HWND

hWnd

Window handle to get client parameters.

WPARAM

wParam

First 32 bits additional information of the window procedure.

LPARAM

lParam

Second 32 bits additional information of the window procedure.

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

The return value is the result of the message processing.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code example

See sample code at DisplayWmCreate().


DisplayWmVertScroll

#include "BIDISP.H"

 

LRESULT CALLBACK DisplayWmVertScroll( HWND          hWnd,
WPARAM    wParam,
LPARAM      lParam,
LPDISPLAYSTRUCT   cb)

Description

The DisplayWmVertScroll function should be called in response to the WM_VSCROLL message.

Parameters

HWND

hWnd

Window handle to get client parameters.

WPARAM

wParam

First 32 bits additional information of the window procedure.

LPARAM

lParam

Second 32 bits additional information of the window procedure.

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

The return value is the result of the message processing.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

Code example

See sample code at DisplayWmCreate().


GetBiDispVersion

#include "BIDISP.H"

 

VOID CALLBACK GetBiDispVersion(            LPCTSTR lpBuffer,

                                                                              int              nMaxByte)

Description

Returns the BIDISP DLL version string in the form of "Version x.y".

Parameters

LPCTSTR

lpBuffer

The buffer where the version string is copied.

int

nMaxByte

The buffer size including NULL terminator.

Return values

None.

Requirements

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

Library :    Use BiDisp.lib.

DLLs :       BiDisp.dll.

 


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 picture.

   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().

ICM Functions

This section covers Color Management Functions of the Document Imaging SDK.

GetICMUsage

#include "BIDISP.H"

 

BOOL CALLBACK GetICMUsage()

Description

This function returns  a Boolean variable. It is TRUE, if the color management is switched ON (See SetICMUsage function), and returns with FALSE, if it is OFF.

Parameters

Return values

TRUE, if color management is used ON


 

SetICMUsage

#include "BIDISP.H"

 

void CALLBACK SetICMUsage( BOOL bUse )

Description

This function switches the usage of color management ON or OFF, according to the bUse parameter. Switching the color management OFF results in faster execution of displaying functions, while switching it ON results in more precise visualization.

Parameters

BOOL

bUse

switch for turning the color management ON or OFF

Return values

None

 

Zoom Functions

This section covers Zoom Functions of the Document Imaging SDK.


BZoomEnd

#include "BIDISP.H"

 

VOID CALLBACK BZoomEnd(                                      HWND  hWnd,
LPPOINT                      ptMouse,
LPZOOMSTRUCT       zm
LPDISPLAYSTRUCT cb)

Description

This function recalculates the origo (zm->rOrigoOut) and scaling factor
(zm->rScaleOut) for the display functions, If BZoomStart is called with ZOOM_SELECT zoom flag, the selection rectangle will be hidden.

Parameters

HWND

hWnd

Window handle to display image.

LPPOINT

lpMouse

Coordinates of the mouse pointer.

LPZOOMSTRUCT

zm

Zoom structure created by BzoomStart function

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


BZoomGetScaleSteps

#include "BIDISP.H"

 

int CALLBACK BZoomGetScaleSteps(                               LPZOOMSTEPS        enlarge,
LPZOOMSTEPS   reduce)

Description

This function returns the current scaling settings. For meaning of the parameters and the returning value, see BZoomSetScaleSteps() function.

Parameters

LPZOOMSTEPS

enlarge

Pointer to a structure containing the scaling factors used when the image is enlarged.

LPZOOMSTEPS

reduce

Pointer to a structure containing the scaling factors used when the image is reduced.

Return values

Return the basic scaling factor.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


BZoomScreenEnd

#include "BIDISP.H"

 

VOID CALLBACK BZoomScreenEnd(                                 HWND        hWnd,
          LPPOINT                  ptMouse,
          LPZOOMSTRUCT   zm
          LPZOOMSCREEN  zc)

Description

This function recalculates the origo (zm->rOrigoOut), scaling factor
(zm->rScaleOut) and positions of scroll bars(zc->pScrollPos) for the decompress to screen function, If BZoomStart is called with ZOOM_SELECT zoom flag the selection rectangle will be hidden.

Parameters

HWND

hWnd

Window handle to display image.

LPPOINT

lpMouse

Coordinates of the mouse pointer.

LPZOOMSTRUCT

zm

Zoom structure created by BzoomStart function

LPZOOMSCREEN

zc

Display information structure of decompress to screen function.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


BZoomScreenStep

#include "BIDISP.H"

 

VOID CALLBACK BZoomScreenStep(                                 HWND        hWnd,
LPRECT                  lprScale,
ZOOMFLAG          zoomflg,
LPZOOMSTRUCT zm,
LPZOOMSCREEN zc)

Description

This function recalculates scaling factor (zm->rScaleOut) for the function using the next or previous scaling value for decompress to screen function. zoomflg (see BZoomStart function) defines the direction of the zooming. The new scaling factor is returned in the zm->rScaleOut structure. The origo of the image remains unchanged.

Parameters

HWND

hWnd

Window handle to display image.

LPPOINT

lprScale

Coordinates of the mouse pointer.

ZOOMFLAG

zoomflg

Determines the operation of zoom.

LPZOOMSTRUCT

zm

Zoom structure created by BzoomStart function

LPZOOMSCREEN

zc

Display information structure of decompress to screen function.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


BZoomSetScaleSteps

#include "BIDISP.H"

 

VOID CALLBACK BZoomSetScaleSteps(                              int   base,
                LPZOOMSTEPS  enlarge,
                LPZOOMSTEPS  reduce)

Description

This function defines the scaling factor tables when the image is reduced or enlarged by the zoom with step function. The base parameter defines a basic scale factor (the default is 10) in range 1 to 1000. The enlarge structure defines the scale factors (the defaults are 10, 20, 40, 60, 80) when the image is enlarged. The enlarge parameter defines the scale factors (the defaults are 10, 15, 30, 40, 50) when the image is reduced. Scaling factors can be defined up to 10. The real scaling factor can be calculated

            enlarge->step[i]/scale_base

or

            scale_base/reduce->step[i]

Parameters

int

base

Defines the basic scale factor

LPZOOMSTEPS

enlarge

Pointer to a structure containing the scaling factors used when the image is enlarged. (The defaults are 10, 20, 40, 60, 80)

LPZOOMSTEPS

reduce

Pointer to a structure containing the scaling factors used when the image is reduced (The defaults are 10, 15, 30, 40, 50)

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


BZoomStart

#include "BIDISP.H"

 

VOID CALLBACK BZoomStart(                                  HWND     hWnd,
LPPOINT                  ptMouse,
LPRECT                    lprScale,
ZOOMFLAG            zoomflg,
LPZOOMSTRUCT   zm,
BOOL                       bMouseScreen)

Description

This function can be used to respond to the WM_LBUTTONDOWN and WM_RBUTTONDOWN message. lprScale specifies the actual scaling parameters of the image. The given zoom structure will be initialized for using in the other zoom functions. If bScreenMode is TRUE the given ptMouse mouse position will be interpreted as screen coordinates, otherwise it will be interpreted as client coordinates.

Parameters

HWND

hWnd

Window handle to display image.

LPPOINT

lpMouse

Coordinates of the mouse pointer.

LPRECT

lprScale

The X and Y scaling factor.

ZOOMFLAG

zoomflg

Determines the operation of zoom. The flags
can be

 

ZOOM_SELECT

Select rectangle

 

ZOOM_SELECT_MOVE

Only scroll

 

ZOOM_SELECT_LARGE

Select rectangle or step larger

 

ZOOM_SELECT_SMALL

Select a rectangle or step smaller

 

ZOOM_SELECT_PLUS

Select a rectangle or step about 10 times
smaller than ZOOM_SELECT_LARGE.

 

ZOOM_SELECT_MINUS

Select a rectangle or step about 10 times
smaller than ZOOM_SELECT_SMALL

 

ZOOM_STEP

Select step

 

ZOOM_STEP_CUSTOM

Set custom scale (not step)

 

ZOOM_STEP_LARGE

Not select rectangle and step larger

 

ZOOM_STEP_SMALL

Not select rectangle and step larger

 

ZOOM_STEP_PLUS

Not select a rectangle or step about 10 times
smaller than ZOOM_SELECT_LARGE.

 

ZOOM_STEP_MINUS

Not select a rectangle or step about 10 times
smaller than ZOOM_SELECT_SMALL.

LPZOOMSTRUCT

zm

 

BOOL

bMouseScreen

Interpretation of lpMouse coordinates (TRUE
screen, FALSE client).

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

 


BZoomStep

#include "BIDISP.H"

 

VOID CALLBACK BZoomStep(HWND                         hWnd,
LPRECT                        lprScale,
ZOOMFLAG                zoomflg,
LPZOOMSTRUCT       zm
LPDISPLAYSTRUCT cb)

Description

This function recalculates scaling factor (zm->rScaleOut) for the function using the next or previous scaling value. zoomflg (see BZoomStart function) defines the direction of the zooming. The new scaling factor is returned in the zm->rScaleOut structure. The origo of the image remains unchanged.

Parameters

HWND

hWnd

Window handle to display image.

LPPOINT

lpMouse

Coordinates of the mouse pointer.

ZOOMFLAG

zoomflg

Determines the operation of zoom.

LPZOOMSTRUCT

zm

Zoom structure created by BzoomStart function

LPZOOMSCREEN

zc

Display information structure of decompress to screen function.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

 

 


BZoomUpdate

#include "BIDISP.H"

 

VOID CALLBACK BZoomUpdate(                                 HWND  hWnd,
LPPOINT                  ptMouse,
LPZOOMSTRUCT   zm)

Description

This function updates the selection rectangle on the specified window. This function has effect when the BZoomStart function created the zoom structure with the ZOOM_SELECT zoom flag. lpMouse parameter must point to the actual location of the window in screen coordinates if BZoomStart was called with TRUE screen flag or client coordinates, if BZoomStart was called FALSE screen flag.

Parameters

HWND

hWnd

Window handle to display image.

LPPOINT

lpMouse

Coordinates of the mouse pointer.

LPZOOMSTRUCT

zm

Zoom structure created by BzoomStart function

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


Zoom

#include "BIDISP.H"

 

VOID CALLBACK Zoom(                  HWND        hWnd,
LONG       lPoint,
LPRECT   lpRect)

Description

This function computes Zoom scaling factor for a display function. The lPoint is Mouse position. This function should be called in response to WM_LBUTTONDOWN or WM_RBUTTONDOWN. The lpRect will return the new scaling factor. It should be used with DisplayImage or DisplayDIBImage().

This function is OBSOLETE. Use the Zoom functions listed under Group C.

Parameters

HWND

hWnd

The client window handle.

LONG

lPoint

The mouse position.

LPRECT

lpRect

The returned scaling factor.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


ZoomArea

#include "BIDISP.H"

 

VOID CALLBACK ZoomArea(  HWND                      hWnd,
LPRECT                    lpArea,
LPRECT                    lprScale,
ZOOMFLAG            zoomflg,
LPZOOMSTRUCT   zm,
BOOL                       bMouseScreen,
LPDISPLAYSTRUCT cb)

Description

This function can be used to zoom without user activity. lprScale specifies the actual scaling parameters of the image. The given zoom structure will be initialized for using in the other zoom functions. If bMouseScreen is TRUE the given ptMouse mouse position will be interpreted as screen coordinates, otherwise it will be interpreted as client coordinates.

Parameters

HWND

hWnd

Window handle to display image.

LPRECT

lpArea

Zooming rectangle.

LPRECT

lprScale

The X and Y scaling factor.

ZOOMFLAG

zoomflg

Determines the operation of zoom. The flags
can be

 

ZOOM_SELECT

Select rectangle

 

ZOOM_SELECT_MOVE

Only scroll

 

ZOOM_SELECT_LARGE

Select rectangle or step larger

 

ZOOM_SELECT_SMALL

Select a rectangle or step smaller

 

ZOOM_SELECT_PLUS

Select a rectangle or step about 10 times
smaller than ZOOM_SELECT_LARGE.

 

ZOOM_SELECT_MINUS

Select a rectangle or step about 10 times
smaller than ZOOM_SELECT_SMALL

 

ZOOM_STEP

Select step

 

ZOOM_STEP_CUSTOM

Set custom scale (not step)

 

ZOOM_STEP_LARGE

Not select rectangle and step larger

 

ZOOM_STEP_SMALL

Not select rectangle and step larger

 

ZOOM_STEP_PLUS

Not select a rectangle or step about 10 times
smaller than ZOOM_SELECT_LARGE.

 

ZOOM_STEP_MINUS

Not select a rectangle or step about 10 times
smaller than ZOOM_SELECT_SMALL.

LPZOOMSTRUCT

zm

Zoom structure.

BOOL

bMouseScreen

Interpretation of lpMouse coordinates (TRUE
screen, FALSE client).

LPDISPLAYSTRUCT

cb

Display information structure.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


Magnifying Functions

This section covers Magnifying Functions of the Document Imaging SDK.


M_CalcRect

#include "BIDISP.H"

 

VOID CALLBACK M_CalcRect(                   int     X,
int               Y,
LPRECT     lpScale,
LPRECT     lpOut)

Description

This function should be called in response to the WM_MOUSEMOVE message or whenever one wants to update the magnifying window. This function calling sequence should be:

1, M_CalcRect() calculate area of bitmap to be displayed.

2, M_StretchBitmap() stretch the bitmap into a background bitmap.

3, M_CopyBitmap() copy the bitmap into a magnifying window.

Having three separate function calls for displaying the magnified bitmap will enable us to build custom and more elaborate magnifying windows in the future.

Parameters

int

X

The magnifying window top left X coordinate in screen coordinate.

int

Y

The magnifying window top left Y coordinate in screen coordinate.

LPRECT

lpScale

Scaling factor for magnification. For more details on how scaling is computed, see DisplayDIBStart().

LPRECT

lpOut

The newly calculated bitmap area. Use this output value as width and height in M_StretchBitmap() function.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

 


M_CopyBitmap

#include "BIDISP.H"

 

VOID CALLBACK M_CopyBitmap(HWND hWnd, int X, int Y)

Description

This function should be called in response to the WM_MOUSEMOVE message or whenever one wants to update the magnifying window. This function calling sequence should be:

1, M_CalcRect() calculate area of bitmap to be displayed.

2, M_StretchBitmap() stretch the bitmap into a background bitmap.

3, M_CopyBitmap() copy the bitmap into a magnifying window.

Having three separate function calls for displaying the magnified bitmap will enable us to build custom and more elaborate magnifying windows in the future.

Parameters

HWND

hWnd

The parent window handle.

int

X

The magnifying window top left X coordinate in screen coordinate.

int

Y

The magnifying window top left Y coordinate in screen coordinate.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.

 

 


M_GetHeight

#include "BIDISP.H"

 

int CALLBACK M_GetHeight(VOID)

Description

This function returns the height of the magnifying window in pixels.

Parameters

None.

Return values

Returns the height of magnifying window.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


M_GetWidth

#include "BIDISP.H"

 

int CALLBACK M_GetWidth(VOID)

Description

This function returns the width of the magnifying window in pixels.

Parameters

None.

Return values

Returns the width of magnifying window.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


M_SetSizes

#include "BIDISP.H"

 

VOID CALLBACK M_SetSizes(     int X, int Y)

Description

This function can change the default size of the magnifying window.

Parameters

int

X

Set the width of magnifying window in pixels.

int

Y

Set the height of magnifying window in pixels.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


M_StartMagnify

#include "BIDISP.H"

 

VOID CALLBACK M_StartMagnify(                     HWND           hWnd,
HPALETTE  hPal)

Description

This function should be called in response to the WM_LBUTTONDOWN message. It will create a magnifying window.

Parameters

HWND

hWnd

The parent window for the magnifying window.

HPALETTE

hPal

The palette for the image. One can use the palette from the Display structure.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


M_StopMagnify

#include "BIDISP.H"

 

VOID CALLBACK M_StopMagnify(VOID)

Description

This function should be called in response to the WM_LBUTTONUP message. It will release all resources.

Parameters

None.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.


M_StretchBitmap

#include "BIDISP.H"

 

VOID CALLBACK M_StretchBitmap(                   HBITMAP      hBitmap,
int               X,
int               Y,
int               nWidth,
int               nHeight)

Description

This function should be called in response to the WM_MOUSEMOVE message or whenever one wants to update the magnifying window. This function calling sequence should be:

1, M_CalcRect() calculate area of bitmap to be displayed.

2, M_StretchBitmap() stretch the bitmap into a background bitmap.

3, M_CopyBitmap() copy the bitmap into a magnifying window.

Having three separate function calls for displaying the magnified bitmap will enable us to build custom and more elaborate magnifying windows in the future.

Parameters

HBITMAP

hBitmap

The handle for the bitmap.

int

X

The mouse X screen coordinate.

int

Y

The mouse Y screen coordinate.

int

nWidth

The bitmap width returned by M_CalcRect() lpOutPut parameter.

int

nHeight

The bitmap height returned by M_CalcRect() lpOutPut parameter.

Return values

None.

Requirements

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

Library :    Use BIDisp.lib.

DLLs :       BIDisp.dll.