#include "ltwrappr.h"
virtual L_INT LDialogDocument::DoModalBorderRemove(hWndOwner)
HWND hWndOwner; |
handle of the window which owns the dialog |
Displays the Border Remove dialog box, and gets the options for LBitmap::BorderRemove. This function is available in the Document/MedicalDocument/Medical toolkits.
Parameter |
Description |
hWndOwner |
Handle of the window which owns the dialog. |
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. |
LDialogDocument::SetBorderRemoveParams must be called before using this function to set the initial values for the dialog. You can get the updated BORDERREMOVEDLGPARAMS with the values entered by the user through the dialog by using LDialogDocument::GetBorderRemoveParams.
The LBitmap::BorderRemove function only works with 1-bit images. If you provide a bitmap in the LDialogDocument class, it must be a 1-bit bitmap.
Required DLLs and Libraries
LTDLGIMGDOC For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application |
Functions: |
|
Topics: |
L_INT LDialogDocument_DoModalBorderRemoveExample(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet;
LDialogDocument DlgDocument;
nRet = LDialogDocument::Initialize(0);
if(nRet != SUCCESS)
return nRet;
DlgDocument.SetBitmap(pBitmap);
LBitmap BitmapRegion;
BORDERREMOVEDLGPARAMS DlgParams;
nRet = BitmapRegion.Initialize ();
if(nRet != SUCCESS)
return nRet;
memset ( &DlgParams, 0, sizeof ( BORDERREMOVEDLGPARAMS ) ) ;
DlgParams.uStructSize = sizeof ( BORDERREMOVEDLGPARAMS ) ;
DlgParams.BorderRemove.uStructSize = sizeof ( BORDERREMOVE ) ;
DlgParams.BorderRemove.pBitmapRegion = BitmapRegion.GetHandle();
DlgParams.BorderRemove.uBitmapStructSize = sizeof ( BITMAPHANDLE );
DlgParams.BorderRemove.iBorderPercent = 1 ;
DlgParams.BorderRemove.iVariance = 2 ;
DlgParams.BorderRemove.iWhiteNoiseLength = 3 ;
DlgParams.BorderRemove.uBorderToRemove = BORDER_LEFT ;
DlgParams.BorderRemove.uFlags = BORDER_USE_VARIANCE ;
DlgDocument.EnableCallBack (FALSE);
DlgDocument.EnablePreview(TRUE);
DlgDocument.EnableAutoProcess(TRUE);
DlgDocument.EnableToolbar(TRUE);
nRet = DlgDocument.SetBorderRemoveParams(&DlgParams) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgDocument.DoModalBorderRemove(hWnd);
if(nRet < 1)
return nRet;
if(BitmapRegion.HasRgn())
{
nRet = BitmapRegion.Region()->Free();
if(nRet != SUCCESS)
return nRet;
}
// Gets the updated values for the structure
nRet = DlgDocument.GetBorderRemoveParams(&DlgParams, sizeof(DlgParams)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LDialogDocument::Free();
if(nRet != SUCCESS)
return nRet;
return nRet;
}