Displays the Underlay dialog box, and gets the options for LBitmapBase::Underlay.
#include "ltwrappr.h"
virtual L_INT LDialogImageEffect::DoModalUnderlay(hWndOwner)
Handle of the window which owns the dialog.
Value | Meaning |
---|---|
SUCCESS_DLG_OK | The "OK" button was pressed, and the dialog exited successfully. |
SUCCESS_DLG_CANCEL | The "Cancel" button was pressed, and the dialog exited successfully. |
< 1 | An error occurred. Refer to Return Codes. |
LDialogImageEffect::SetUnderlayParams must be called before using this function to set the initial values for the dialog. You can get the updated UNDERLAYDLGPARAMS with the values entered by the user through the dialog by using LDialogImageEffect::GetUnderlayParams.
L_INT LDialogImageEffect_DoModalUnderlayExample(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet;
LDialogImageEffect DlgImageEffect;
nRet = LDialogImageEffect::Initialize(DLG_INIT_COLOR );
if(nRet != SUCCESS)
return nRet;
DlgImageEffect.SetBitmap(pBitmap);
UNDERLAYDLGPARAMS DlgParams;
DLGBITMAPLISTITEM Items [ 1 ];
DLGBITMAPLIST BitmapList;
LBitmap TmpBitmap;
memset ( &DlgParams, 0, sizeof ( UNDERLAYDLGPARAMS ) );
DlgParams. uStructSize = sizeof ( UNDERLAYDLGPARAMS );
Items [ 0 ].pszFileName = ( L_TCHAR * ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH );
lstrcpy ( Items [ 0 ].pszFileName, MAKE_IMAGE_PATH(TEXT("ULAY1.BMP") ) );
nRet = TmpBitmap.LoadResize (Items [ 0 ].pszFileName,
100,
0,
24,
0,
ORDER_BGR,
NULL,
NULL );
if(nRet != SUCCESS)
return nRet;
Items [ 0 ].pBitmap = TmpBitmap.GetHandle ();
BitmapList.uStructSize = sizeof ( DLGBITMAPLIST );
BitmapList.pBitmapList = Items;
BitmapList.nCount = 1;
DlgParams.uUnderlayFlags = UB_TILE;
DlgParams.nUnderlayBitmapIndex = 0;
DlgParams.pBitmapList = &BitmapList;
DlgImageEffect.EnableCallBack (FALSE);
DlgImageEffect.EnablePreview(TRUE);
DlgImageEffect.EnableAutoProcess(TRUE);
DlgImageEffect.EnableToolbar(TRUE);
nRet = DlgImageEffect.SetUnderlayParams(&DlgParams);
if(nRet != SUCCESS)
return nRet;
nRet = DlgImageEffect.DoModalUnderlay(hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgImageEffect.GetUnderlayParams(&DlgParams, sizeof(DlgParams));
if(nRet != SUCCESS)
return nRet;
nRet = LDialogImageEffect::Free();
if(nRet != SUCCESS)
return nRet;
nRet = TmpBitmap.Free();
if(nRet != SUCCESS)
return nRet;
free ( Items [ 0 ].pszFileName );
return SUCCESS;
}