#include "ltwrappr.h"
virtual L_INT LDialogColor::DoModalHalfTone(hWndOwner)
Displays the Halftone dialog box, and gets the options for LBitmap::HalfTone.
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. |
LDialogColor::SetHalfToneParams must be called before using this function to set the initial values for the dialog. You can get the updated HALFTONEDLGPARAMS with the values entered by the user through the dialog by using LDialogColor::GetHalfToneParams.
Required DLLs and Libraries
L_INT LDialogColor_DoModalHalfToneExample(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet;
LDialogDocument DlgDocument;
nRet = LDialogDocument::Initialize(0);
if(nRet != SUCCESS)
return nRet;
DlgDocument.SetBitmap(pBitmap);
BITMAPHANDLE BitmapRegion ;
memset ( &BitmapRegion, 0, sizeof ( BITMAPHANDLE ) ) ;
DOTREMOVEDLGPARAMS DlgParams1;
memset ( &DlgParams1, 0, sizeof ( DOTREMOVEDLGPARAMS ) ) ;
DlgParams1.uStructSize = sizeof ( DOTREMOVEDLGPARAMS ) ;
DlgParams1.DotRemove.uStructSize = sizeof ( DOTREMOVE ) ;
DlgParams1.DotRemove.pBitmapRegion = &BitmapRegion;
DlgParams1.DotRemove.uBitmapStructSize = sizeof ( BITMAPHANDLE );
DlgParams1.DotRemove.iMinDotWidth = 1000 ;
DlgParams1.DotRemove.iMinDotHeight = 1000 ;
DlgParams1.DotRemove.iMaxDotWidth = 1000 ;
DlgParams1.DotRemove.iMaxDotHeight = 1000 ;
DlgParams1.DotRemove.uFlags = DOT_USE_DIAGONALS | DOT_USE_DPI ;
DlgDocument.EnableCallBack (FALSE);
DlgDocument.EnablePreview(TRUE);
DlgDocument.EnableAutoProcess(TRUE);
DlgDocument.EnableToolbar(TRUE);
nRet = DlgDocument.SetDotRemoveParams(&DlgParams1) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgDocument.DoModalDotRemove(hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgDocument.GetDotRemoveParams(&DlgParams1, sizeof(DlgParams1)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LDialogDocument::Free();
if(nRet != SUCCESS)
return nRet;
LDialogColor DlgColor;
nRet = DlgColor.Initialize(DLG_INIT_COLOR);
if(nRet != SUCCESS)
return nRet;
DlgColor.SetBitmap(pBitmap);
HALFTONEDLGPARAMS DlgParams;
memset ( &DlgParams, 0, sizeof ( HALFTONEDLGPARAMS ) ) ;
DlgParams.uStructSize = sizeof ( HALFTONEDLGPARAMS );
DlgParams.nAngle = 5;
DlgParams.uDim = 5;
DlgParams.uType = HT_RECT ;
DlgParams.uDlgFlags = DLG_HALFTONE_SHOW_PREVIEW |
DLG_HALFTONE_SHOW_TOOL_ZOOMLEVEL;
DlgColor.EnableCallBack (FALSE);
DlgColor.EnablePreview(TRUE);
DlgColor.EnableAutoProcess(TRUE);
DlgColor.EnableToolbar(TRUE);
nRet = DlgColor.SetHalfToneParams(&DlgParams) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgColor.DoModalHalfTone(hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgColor.GetHalfToneParams(&DlgParams, sizeof(DlgParams)) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgColor.Free();
if(nRet != SUCCESS)
return nRet;
return nRet;
}