/*[]=====================================================================[]*/ /*[] LeadTools Run Time Library - Version 13 []*/ /*[] []*/ /*[] dialogs.c []*/ /*[] []*/ /*[] []*/ /*[] Copyright (c) 1991-2001 LEAD Technologies, Inc. []*/ /*[] All Rights Reserved. []*/ /*[]=====================================================================[]*/ #include #include #include "../../../include/l_bitmap.h" #include "../../../include/l_error.h" #include "../../../include/lttmb.h" #include "demo.h" L_INT nBitmapsCount ; L_INT L_FAR L_EXPORT BrowseBitmapsCB ( pBITMAPHANDLE pBitmap, L_TCHAR L_FAR *pszFile, pFILEINFO pInfo, L_INT nStatusCode, L_INT nPercent, L_VOID L_FAR *pUserData) { if ( nStatusCode == SUCCESS ) { LPDLGBITMAPLIST pBitmapList ; pBitmapList = ( LPDLGBITMAPLIST ) pUserData ; nBitmapsCount++ ; if ( nBitmapsCount >= DLG_IMAGE_LIST_COUNT ) { nBitmapsCount-- ; return ERROR_USER_ABORT; } if ( ( pInfo->Width < BITMAPWIDTH ( pBitmap ) ) && ( pInfo->Height < BITMAPHEIGHT ( pBitmap ) ) ) { L_LoadBitmap ( pszFile, pBitmapList->pBitmapList[nBitmapsCount].pBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL ) ; } else { L_CopyBitmap ( pBitmapList->pBitmapList [ nBitmapsCount ].pBitmap, pBitmap, sizeof(BITMAPHANDLE) ) ; } if ( NULL != pBitmapList->pBitmapList [ nBitmapsCount ].pszFileName ) { lstrcpy ( pBitmapList->pBitmapList [ nBitmapsCount ].pszFileName, pszFile ) ; } if ( NULL != pBitmapList->pBitmapList [ nBitmapsCount ].pszDescription ) { lstrcpy ( pBitmapList->pBitmapList [ nBitmapsCount ].pszDescription, pszFile ) ; } } return SUCCESS; } L_INT GenerateBitampList ( HWND hWnd, L_TCHAR L_FAR * pszFolder, LPDLGBITMAPLIST pDlgBitmapList, L_BOOL fThumbnail ) { THUMBOPTIONS ThumbOptions ; ZeroMemory ( &ThumbOptions,sizeof ( THUMBOPTIONS ) ) ; ThumbOptions.uStructSize = sizeof ( THUMBOPTIONS ) ; ThumbOptions.nWidth = ( fThumbnail ? 250 : 0 ) ; ThumbOptions.nHeight = ( fThumbnail ? 250 : 0 ) ; ThumbOptions.nBits = 24 ; ThumbOptions.uCRFlags = CRF_BYTEORDERBGR ; ThumbOptions.bMaintainAspect = fThumbnail ; ThumbOptions.bForceSize = FALSE ; ThumbOptions.crBackColor = GetSysColor ( COLOR_BTNFACE ) ; ThumbOptions.bLoadStamp = FALSE ; ThumbOptions.bResample = TRUE ; nBitmapsCount = -1 ; L_BrowseDir ( pszFolder, TEXT("*.*"), &ThumbOptions, FALSE, // don't stop on error FALSE, // do not recurse subdirectories FALSE, // do not expand multipage files 0, // no limit on file size 4000 * 1024, // set limit on image size to 4MB BrowseBitmapsCB, // callback pDlgBitmapList ) ; // no user data if ( nBitmapsCount < 0 ) { MessageBox ( hWnd, TEXT("There are file(s) cannot be loaded"), TEXT("Error"), 0 ) ; return FAILURE ; } else { pDlgBitmapList->nCount = nBitmapsCount + 1 ; } return SUCCESS ; } //{{ FILE MENU LEAD COMMON DIALOGS L_INT ShowFileConvertDialog ( HWND hWnd, LPFILECONVERSIONDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( FILECONVERSIONDLGPARAMS ) ; pDlgParams->uOverwrite = DLG_FILECONVERSION_OVERWRITE_SKIP ; pDlgParams->pFileFormats = NULL ; pDlgParams->nFileFormatsCount = 0 ; pDlgParams->bUseLogReport = TRUE ; pDlgParams->bRemoveSrcFile = FALSE ; pDlgParams->bShowFullPath = TRUE ; pDlgParams->bUseOriginalFolder = TRUE ; pDlgParams->pszSrcFileList = NULL ; pDlgParams->uDlgFlags = DLG_FILECONVERSION_SHOW_PREVIEW | DLG_FILECONVERSION_SHOW_LOADOPTIONS | DLG_FILECONVERSION_SHOW_FILEINFO | DLG_FILECONVERSION_SHOW_PREVIEW_PAGES | DLG_FILECONVERSION_SHOW_RESIZE | DLG_FILECONVERSION_SHOW_ROTATE | DLG_FILECONVERSION_SHOW_NAMINGTEMPLATE | DLG_FILECONVERSION_SHOW_OVERWRITE | DLG_FILECONVERSION_SHOW_OVERWRITE_ALL | DLG_FILECONVERSION_SHOW_ADD | DLG_FILECONVERSION_SHOW_ADDFOLDER | DLG_FILECONVERSION_SHOW_REMOVE | DLG_FILECONVERSION_SHOW_SELECTALL | DLG_FILECONVERSION_SHOW_DELETEORIGINAL | DLG_FILECONVERSION_SHOW_NEWFORMATSUPDATES; return L_DlgFileConversion ( hWnd, pDlgParams ) ; } L_INT ShowJPEGWebTunerDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPJPEGWEBTUNERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( JPEGWEBTUNERDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->uDlgFlags = (fShowPreview?DLG_JPEGWEBTUNER_SHOW_PREVIEW:0)| DLG_JPEGWEBTUNER_SHOW_EXPORT | DLG_JPEGWEBTUNER_SHOW_INFORMATION | DLG_JPEGWEBTUNER_SHOW_TOOL_ZOOMLEVEL | DLG_JPEGWEBTUNER_SHOW_OPTIONS | DLG_JPEGWEBTUNER_SHOW_SAVETHUMBNAIL ; return L_DlgJPEGWebTuner ( hWnd, pDlgParams ) ; } L_INT ShowPNGWebTunerDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPPNGWEBTUNERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( PNGWEBTUNERDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->uDlgFlags = (fShowPreview?DLG_PNGWEBTUNER_SHOW_PREVIEW:0)| DLG_PNGWEBTUNER_SHOW_EXPORT| DLG_PNGWEBTUNER_SHOW_INFORMATION | DLG_PNGWEBTUNER_SHOW_TOOL_ZOOMLEVEL | DLG_PNGWEBTUNER_SHOW_TOOL_COLORPICKER | DLG_PNGWEBTUNER_SHOW_TRANSPARENCY | DLG_PNGWEBTUNER_SHOW_ADDWINDOWCOLOR | (fShowApply?DLG_PNGWEBTUNER_SHOW_APPLY:0); return L_DlgPNGWebTuner ( hWnd, pDlgParams ) ; } L_INT ShowGIFWebTunerDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPGIFWEBTUNERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( GIFWEBTUNERDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->uDlgFlags = (fShowPreview?DLG_GIFWEBTUNER_SHOW_PREVIEW:0)| DLG_GIFWEBTUNER_SHOW_EXPORT | DLG_GIFWEBTUNER_SHOW_INFORMATION | DLG_GIFWEBTUNER_SHOW_TOOL_ZOOMLEVEL | DLG_GIFWEBTUNER_SHOW_TOOL_COLORPICKER | DLG_GIFWEBTUNER_SHOW_TRANSPARENCY | DLG_GIFWEBTUNER_SHOW_OPTIONS | DLG_GIFWEBTUNER_SHOW_ADDWINDOWCOLOR ; return L_DlgGIFWebTuner ( hWnd, pDlgParams ) ; } L_INT ShowHTMLMapperDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPHTMLMAPPERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( HTMLMAPPERDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; return L_DlgHTMLMapper ( hWnd, pDlgParams ) ; } L_INT ShowFilesAssociationDialog ( HWND hWnd, LPFILESASSOCIATIONDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( FILESASSOCIATIONDLGPARAMS ) ; pDlgParams->pszFormats = NULL ; pDlgParams->pszServerAppName = REGISTRYKEY_SERVER_NAME ; pDlgParams->pszSelectedExt = NULL ; return L_DlgFilesAssociation ( hWnd, pDlgParams ) ; } L_INT ShowPrintPreviewDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPPRINTPREVIEWDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( PRINTPREVIEWDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->nCmdShow = SW_SHOW ; return L_DlgPrintPreview ( hWnd, pDlgParams ) ; } L_INT ShowPrintStitchedImagesDialog ( HWND hWnd, LPPRINTSTITCHEDIMAGESDLGPARAMS pDlgParams ) { L_INT nRet = SUCCESS_DLG_OK ; GETDIRECTORYDLGPARAMS DirectoryDlgParams ; ZeroMemory ( &DirectoryDlgParams, sizeof (GETDIRECTORYDLGPARAMS)) ; DirectoryDlgParams.uStructSize = sizeof (GETDIRECTORYDLGPARAMS); DirectoryDlgParams.pszDirectory = malloc ( L_MAXPATH * 2 ) ; DirectoryDlgParams.pszTitle = TEXT("Select a Folder") ; DirectoryDlgParams.nBuffSize = L_MAXPATH ; DirectoryDlgParams.pszFilter = NULL ; DirectoryDlgParams.nFilterIndex = 1 ; nRet = L_DlgGetDirectory ( hWnd, &DirectoryDlgParams ) ; // Get the Border directory if ( nRet == SUCCESS_DLG_OK ) { DLGBITMAPLIST BitmapList ; L_INT i = 0 ; HCURSOR hCursor; hCursor = SetCursor (LoadCursor (NULL, IDC_WAIT)); BitmapList.pBitmapList = malloc ( sizeof ( DLGBITMAPLISTITEM ) * DLG_IMAGE_LIST_COUNT ) ; if ( NULL == BitmapList.pBitmapList ) { return ERROR_NO_MEMORY ; } else { for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { BitmapList.pBitmapList [ i ].pBitmap = malloc ( sizeof ( BITMAPHANDLE ) ) ; BitmapList.pBitmapList [ i ].pszFileName = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; BitmapList.pBitmapList [ i ].pszDescription = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; memset(BitmapList.pBitmapList [ i ].pBitmap,0, sizeof(BITMAPHANDLE)); memset(BitmapList.pBitmapList [ i ].pszFileName,0, sizeof ( L_TCHAR ) * L_MAXPATH ); memset(BitmapList.pBitmapList [ i ].pszDescription,0, sizeof ( L_TCHAR ) * L_MAXPATH ); } } if ( SUCCESS == GenerateBitampList ( hWnd, DirectoryDlgParams.pszDirectory, &BitmapList, FALSE ) ) { pDlgParams->uStructSize = sizeof ( PRINTSTITCHEDIMAGESDLGPARAMS ) ; pDlgParams->pBitmapList = &BitmapList ; pDlgParams->nCmdShow = SW_SHOW ; SetCursor (hCursor); nRet = L_DlgPrintStitchedImages ( hWnd, pDlgParams ) ; } else { nRet = FAILURE ; } // clean up for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { if ( NULL != BitmapList.pBitmapList [ i ].pBitmap ) { if ( BitmapList.pBitmapList [ i ].pBitmap->Flags.Allocated ) { L_FreeBitmap ( BitmapList.pBitmapList [ i ].pBitmap ) ; } free ( BitmapList.pBitmapList [ i ].pBitmap ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszFileName ) { free ( BitmapList.pBitmapList [ i ].pszFileName ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszDescription ) { free ( BitmapList.pBitmapList [ i ].pszDescription ) ; } } if ( NULL != BitmapList.pBitmapList ) { free ( BitmapList.pBitmapList ) ; } return nRet ; } else { return nRet ; } } //}} FILE MENU LEAD COMMON DIALOGS //{{ IMAGE MENU LEAD COMMON DIALOGS L_INT ShowRotateDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPROTATEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( ROTATEDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->nAngle = 0 ; pDlgParams->bResize = TRUE ; pDlgParams->uDlgFlags = (fShowPreview?DLG_ROTATE_SHOW_PREVIEW:0)| (L_BitmapHasRgn(pBitmap)?0:DLG_ROTATE_SHOW_RESIZE) | (L_BitmapHasRgn(pBitmap)?0:DLG_ROTATE_SHOW_BACKCOLOR); return L_DlgRotate ( hWnd, pDlgParams ) ; } L_INT ShowShearDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSHEARDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( SHEARDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->nAngle = 0 ; pDlgParams->bHorizontal = TRUE ; pDlgParams->uDlgFlags = (fShowPreview?DLG_SHEAR_SHOW_PREVIEW:0)| (L_BitmapHasRgn(pBitmap)?0:DLG_SHEAR_SHOW_HORIZONTAL) | (L_BitmapHasRgn(pBitmap)?0:DLG_SHEAR_SHOW_BACKCOLOR); return L_DlgShear ( hWnd, pDlgParams ) ; } L_INT ShowAutoTrimDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPAUTOTRIMDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( AUTOTRIMDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->nThreshold = 128 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_AUTOTRIM_SHOW_PREVIEW:0)| (fShowApply?DLG_AUTOTRIM_SHOW_APPLY:0); return L_DlgAutoTrim ( hWnd, pDlgParams ) ; } L_INT ShowAddBorderDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPADDBORDERDLGPARAMS pDlgParams, LPADDBORDERINFO pAddBorderInfo) { L_INT nRet = SUCCESS_DLG_OK ; GETDIRECTORYDLGPARAMS DirectoryDlgParams ; ZeroMemory ( &DirectoryDlgParams, sizeof (GETDIRECTORYDLGPARAMS)) ; DirectoryDlgParams.uStructSize = sizeof (GETDIRECTORYDLGPARAMS); DirectoryDlgParams.pszDirectory = malloc ( L_MAXPATH * 2 ) ; DirectoryDlgParams.pszTitle = TEXT("Select a Folder") ; DirectoryDlgParams.nBuffSize = L_MAXPATH ; DirectoryDlgParams.pszFilter = NULL ; DirectoryDlgParams.nFilterIndex = 1 ; nRet = L_DlgGetDirectory ( hWnd, &DirectoryDlgParams ) ; // Get the Border directory if ( nRet == SUCCESS_DLG_OK ) { DLGBITMAPLIST BitmapList ; L_INT i = 0 ; HCURSOR hCursor; hCursor = SetCursor (LoadCursor (NULL, IDC_WAIT)); BitmapList.pBitmapList = malloc ( sizeof ( DLGBITMAPLISTITEM ) * DLG_IMAGE_LIST_COUNT ) ; if ( NULL == BitmapList.pBitmapList ) { return ERROR_NO_MEMORY ; } else { for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { BitmapList.pBitmapList [ i ].pBitmap = malloc ( sizeof ( BITMAPHANDLE ) ) ; BitmapList.pBitmapList [ i ].pszFileName = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; BitmapList.pBitmapList [ i ].pszDescription = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; memset(BitmapList.pBitmapList [ i ].pBitmap,0, sizeof(BITMAPHANDLE)); memset(BitmapList.pBitmapList [ i ].pszFileName,0, sizeof ( L_TCHAR ) * L_MAXPATH ); memset(BitmapList.pBitmapList [ i ].pszDescription,0, sizeof ( L_TCHAR ) * L_MAXPATH ); } } if ( SUCCESS == GenerateBitampList ( hWnd, DirectoryDlgParams.pszDirectory, &BitmapList, TRUE ) ) { pDlgParams->uStructSize = sizeof ( ADDBORDERDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->nLeftThickness = BITMAPWIDTH(pBitmap)/20 ; pDlgParams->nTopThickness = BITMAPHEIGHT(pBitmap)/20 ; pDlgParams->nRightThickness = BITMAPWIDTH(pBitmap)/20 ; pDlgParams->nBottomThickness = BITMAPHEIGHT(pBitmap)/20 ; pDlgParams->nLocation = BORDER_OUTSIDE ; pDlgParams->nStyle = BORDER_STYLE_GRADIENT ; pDlgParams->nEffectStyle = BORDER_EFFECT_CURVEDIN ; pDlgParams->nGradientStyle = BORDER_GRAD_CENTEROUT ; pDlgParams->crGradientStart = RGB ( 94, 72, 20 ) ; pDlgParams->crGradientEnd = RGB ( 156, 120, 34 ) ; pDlgParams->nCurveIntensity = 200 ; pDlgParams->bSoftCurve = TRUE ; pDlgParams->bShadow = TRUE ; pDlgParams->nShadowSize = 3 ; pDlgParams->nShadowDirection = BORDER_SHADOW_LEFT ; pDlgParams->bBumpyShadow = FALSE ; pDlgParams->pBitmapList = &BitmapList ; pDlgParams->uDlgFlags = (fShowPreview?DLG_ADDBORDER_SHOW_PREVIEW:0)| DLG_ADDBORDER_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_ADDBORDER_SHOW_APPLY:0); SetCursor (hCursor); nRet = L_DlgAddBorder ( hWnd, pDlgParams ) ; if ( SUCCESS_DLG_OK == nRet ) { if ( NULL != pAddBorderInfo ) { pAddBorderInfo->uStructSize = sizeof(ADDBORDERINFO); pAddBorderInfo->nLeftThickness = pDlgParams->nLeftThickness; pAddBorderInfo->nTopThickness = pDlgParams->nTopThickness; pAddBorderInfo->nRightThickness = pDlgParams->nRightThickness; pAddBorderInfo->nBottomThickness = pDlgParams->nBottomThickness; pAddBorderInfo->nLocation = pDlgParams->nLocation; pAddBorderInfo->nStyle = pDlgParams->nStyle; pAddBorderInfo->nEffectStyle = pDlgParams->nEffectStyle; pAddBorderInfo->nGradientStyle = pDlgParams->nGradientStyle; pAddBorderInfo->crGradientStart = pDlgParams->crGradientStart; pAddBorderInfo->crGradientEnd = pDlgParams->crGradientEnd; pAddBorderInfo->nCurveIntensity = pDlgParams->nCurveIntensity; pAddBorderInfo->bSoftCurve = pDlgParams->bSoftCurve; pAddBorderInfo->bShadow = pDlgParams->bShadow; pAddBorderInfo->bBumpyShadow = pDlgParams->bBumpyShadow; pAddBorderInfo->nShadowSize = pDlgParams->nShadowSize; pAddBorderInfo->nShadowDirection = pDlgParams->nShadowDirection; if(pAddBorderInfo->nStyle==BORDER_STYLE_TILES) { if ( ( pDlgParams->nTileBitmapIndex >=0 ) || ( pDlgParams->nTileBitmapIndex < DLG_IMAGE_LIST_COUNT ) ) { if(SUCCESS!=L_LoadFile(BitmapList.pBitmapList[pDlgParams->nTileBitmapIndex].pszFileName, pAddBorderInfo->pTileBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, LOADFILE_ALLOCATE | LOADFILE_STORE, NULL, NULL, NULL, NULL)) { nRet = FAILURE; } } else { nRet = FAILURE; } } } else { nRet = FAILURE ; } } } else { nRet = FAILURE ; } // clean up for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { if ( NULL != BitmapList.pBitmapList [ i ].pBitmap ) { if ( BitmapList.pBitmapList [ i ].pBitmap->Flags.Allocated ) { L_FreeBitmap ( BitmapList.pBitmapList [ i ].pBitmap ) ; } free ( BitmapList.pBitmapList [ i ].pBitmap ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszFileName ) { free ( BitmapList.pBitmapList [ i ].pszFileName ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszDescription ) { free ( BitmapList.pBitmapList [ i ].pszDescription ) ; } } if ( NULL != BitmapList.pBitmapList ) { free ( BitmapList.pBitmapList ) ; } return nRet ; } else { return nRet ; } } L_INT ShowAddFrameDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPADDFRAMEDLGPARAMS pDlgParams, LPADDFRAMEINFO pAddFrameInfo) { L_INT nRet = SUCCESS_DLG_OK ; GETDIRECTORYDLGPARAMS DirectoryDlgParams ; ZeroMemory ( &DirectoryDlgParams, sizeof (GETDIRECTORYDLGPARAMS)) ; DirectoryDlgParams.uStructSize = sizeof (GETDIRECTORYDLGPARAMS); DirectoryDlgParams.pszDirectory = malloc ( L_MAXPATH * 2 ) ; DirectoryDlgParams.pszTitle = TEXT("Select a Folder") ; DirectoryDlgParams.nBuffSize = L_MAXPATH ; DirectoryDlgParams.pszFilter = NULL ; DirectoryDlgParams.nFilterIndex = 1 ; nRet = L_DlgGetDirectory ( hWnd, &DirectoryDlgParams ) ; // Get the Frame directory if ( nRet == SUCCESS_DLG_OK ) { DLGBITMAPLIST BitmapList ; L_INT i = 0 ; HCURSOR hCursor; hCursor = SetCursor (LoadCursor (NULL, IDC_WAIT)); BitmapList.pBitmapList = malloc ( sizeof ( DLGBITMAPLISTITEM ) * DLG_IMAGE_LIST_COUNT ) ; if ( NULL == BitmapList.pBitmapList ) { return ERROR_NO_MEMORY ; } else { for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { BitmapList.pBitmapList [ i ].pBitmap = malloc ( sizeof ( BITMAPHANDLE ) ) ; BitmapList.pBitmapList [ i ].pszFileName = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; BitmapList.pBitmapList [ i ].pszDescription = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; memset(BitmapList.pBitmapList [ i ].pBitmap,0, sizeof(BITMAPHANDLE)); memset(BitmapList.pBitmapList [ i ].pszFileName,0, sizeof ( L_TCHAR ) * L_MAXPATH ); memset(BitmapList.pBitmapList [ i ].pszDescription,0, sizeof ( L_TCHAR ) * L_MAXPATH ); } } if ( SUCCESS == GenerateBitampList ( hWnd, DirectoryDlgParams.pszDirectory, &BitmapList, TRUE ) ) { pDlgParams->uStructSize = sizeof ( ADDFRAMEDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->pBitmapList = &BitmapList ; pDlgParams->bKeepFrameState = FALSE ; pDlgParams->bUseMask = FALSE ; pDlgParams->SmoothEdge = 0 ; pDlgParams->nLocation = FRAME_INSIDE ; pDlgParams->nQuality = FRAME_QUALITY_LOW ; pDlgParams->uDlgFlags = (fShowPreview?DLG_ADDFRAME_SHOW_PREVIEW:0)| DLG_ADDFRAME_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_ADDFRAME_SHOW_APPLY:0); SetCursor (hCursor); nRet = L_DlgAddFrame ( hWnd, pDlgParams ) ; if ( SUCCESS_DLG_OK == nRet ) { if ( NULL != pAddFrameInfo ) { pAddFrameInfo->uStructSize = sizeof(ADDFRAMEINFO); pAddFrameInfo->bKeepFrameState = pDlgParams->bKeepFrameState; pAddFrameInfo->bUseMask = pDlgParams->bUseMask; pAddFrameInfo->crMask = pDlgParams->crMask; pAddFrameInfo->nLocation = pDlgParams->nLocation; pAddFrameInfo->nQuality = pDlgParams->nQuality; pAddFrameInfo->SmoothEdge = pDlgParams->SmoothEdge; if ( ( pDlgParams->nFrameBitmapIndex >=0 ) || ( pDlgParams->nFrameBitmapIndex < DLG_IMAGE_LIST_COUNT ) ) { if(SUCCESS!=L_LoadFile(BitmapList.pBitmapList[pDlgParams->nFrameBitmapIndex].pszFileName, pAddFrameInfo->pBitmapFrame, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, LOADFILE_ALLOCATE | LOADFILE_STORE, NULL, NULL, NULL, NULL)) { nRet = FAILURE; } } else { nRet = FAILURE; } } else { nRet = FAILURE ; } } } else { nRet = FAILURE ; } // clean up for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { if ( NULL != BitmapList.pBitmapList [ i ].pBitmap ) { if ( BitmapList.pBitmapList [ i ].pBitmap->Flags.Allocated ) { L_FreeBitmap ( BitmapList.pBitmapList [ i ].pBitmap ) ; } free ( BitmapList.pBitmapList [ i ].pBitmap ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszFileName ) { free ( BitmapList.pBitmapList [ i ].pszFileName ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszDescription ) { free ( BitmapList.pBitmapList [ i ].pszDescription ) ; } } if ( NULL != BitmapList.pBitmapList ) { free ( BitmapList.pBitmapList ) ; } return nRet ; } else { return nRet ; } } L_INT ShowSmoothDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSMOOTHDLGPARAMS pDlgParams ) { BITMAPHANDLE BitmapRegion ; memset ( &BitmapRegion, 0, sizeof ( BITMAPHANDLE ) ) ; memset ( &pDlgParams->Smooth, 0, sizeof ( SMOOTH ) ) ; pDlgParams->uStructSize = sizeof ( SMOOTHDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->Smooth.uStructSize = sizeof ( SMOOTH ) ; pDlgParams->Smooth.pBitmapRegion = &BitmapRegion ; pDlgParams->Smooth.uBitmapStructSize = sizeof ( BITMAPHANDLE ) ; pDlgParams->Smooth.uFlags = 0 ; pDlgParams->Smooth.iLength = 1 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_SMOOTH_SHOW_PREVIEW:0) | DLG_SMOOTH_SHOW_TOOL_ZOOMLEVEL ; return L_DlgSmooth ( hWnd, pDlgParams ) ; } L_INT ShowLineRemoveDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPLINEREMOVEDLGPARAMS pDlgParams ) { BITMAPHANDLE BitmapRegion ; memset ( &BitmapRegion, 0, sizeof ( BITMAPHANDLE ) ) ; memset ( &pDlgParams->LineRemove, 0, sizeof ( LINEREMOVE ) ) ; pDlgParams->uStructSize = sizeof ( LINEREMOVEDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->LineRemove.uStructSize = sizeof ( LINEREMOVE ) ; pDlgParams->LineRemove.iGapLength = 3 ; pDlgParams->LineRemove.iMaxLineWidth = 9 ; pDlgParams->LineRemove.iMaxWallPercent = 10 ; pDlgParams->LineRemove.iMinLineLength = 400 ; pDlgParams->LineRemove.iVariance = 3 ; pDlgParams->LineRemove.iWall = 15 ; pDlgParams->LineRemove.pBitmapRegion = &BitmapRegion ; pDlgParams->LineRemove.uBitmapStructSize = sizeof ( BITMAPHANDLE ) ; pDlgParams->LineRemove.uFlags = LINE_USE_GAP | LINE_USE_VARIANCE ; pDlgParams->LineRemove.uRemoveFlags = LINEREMOVE_HORIZONTAL ; pDlgParams->uDlgFlags = (fShowPreview?DLG_LINEREMOVE_SHOW_PREVIEW:0) | DLG_LINEREMOVE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgLineRemove ( hWnd, pDlgParams ) ; } L_INT ShowBorderRemoveDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPBORDERREMOVEDLGPARAMS pDlgParams ) { BITMAPHANDLE BitmapRegion ; memset ( &BitmapRegion, 0, sizeof ( BITMAPHANDLE ) ) ; memset ( &pDlgParams->BorderRemove, 0, sizeof ( BORDERREMOVE ) ) ; pDlgParams->uStructSize = sizeof ( BORDERREMOVEDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->BorderRemove.uStructSize = sizeof ( BORDERREMOVE ) ; pDlgParams->BorderRemove.iBorderPercent = 20 ; pDlgParams->BorderRemove.iVariance = 3 ; pDlgParams->BorderRemove.pBitmapRegion = &BitmapRegion ; pDlgParams->BorderRemove.uBitmapStructSize = sizeof ( BITMAPHANDLE ) ; pDlgParams->BorderRemove.iWhiteNoiseLength = 9 ; pDlgParams->BorderRemove.uBorderToRemove = BORDER_ALL ; pDlgParams->BorderRemove.uFlags = 0 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_BORDERREMOVE_SHOW_PREVIEW:0) | DLG_BORDERREMOVE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgBorderRemove ( hWnd, pDlgParams ) ; } L_INT ShowDotRemoveDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPDOTREMOVEDLGPARAMS pDlgParams ) { BITMAPHANDLE BitmapRegion ; memset ( &BitmapRegion, 0, sizeof ( BITMAPHANDLE ) ) ; memset ( &pDlgParams->DotRemove, 0, sizeof ( DOTREMOVE ) ) ; pDlgParams->uStructSize = sizeof ( DOTREMOVEDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->DotRemove.uStructSize = sizeof ( DOTREMOVE ) ; pDlgParams->DotRemove.pBitmapRegion = &BitmapRegion ; pDlgParams->DotRemove.uBitmapStructSize = sizeof ( BITMAPHANDLE ) ; pDlgParams->DotRemove.iMinDotWidth = 6 ; pDlgParams->DotRemove.iMinDotHeight = 6 ; pDlgParams->DotRemove.iMaxDotWidth = 8 ; pDlgParams->DotRemove.iMaxDotHeight = 8 ; pDlgParams->DotRemove.uFlags = DOT_USE_SIZE | DOT_USE_DIAGONALS ; pDlgParams->uDlgFlags = (fShowPreview?DLG_DOTREMOVE_SHOW_PREVIEW:0) | DLG_DOTREMOVE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgDotRemove ( hWnd, pDlgParams ) ; } L_INT ShowInvertedTextDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPINVERTEDTEXTDLGPARAMS pDlgParams ) { BITMAPHANDLE BitmapRegion ; memset ( &BitmapRegion, 0, sizeof ( BITMAPHANDLE ) ) ; memset ( &pDlgParams->InvertedText, 0, sizeof ( INVERTEDTEXT ) ) ; pDlgParams->uStructSize = sizeof ( INVERTEDTEXTDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->InvertedText.uStructSize = sizeof ( INVERTEDTEXT ) ; pDlgParams->InvertedText.pBitmapRegion = &BitmapRegion ; pDlgParams->InvertedText.uBitmapStructSize = sizeof ( BITMAPHANDLE ) ; pDlgParams->InvertedText.iMinInvertHeight = 375 ; pDlgParams->InvertedText.iMinInvertWidth = 6000 ; pDlgParams->InvertedText.iMinBlackPercent = 75 ; pDlgParams->InvertedText.iMaxBlackPercent = 95 ; pDlgParams->InvertedText.uFlags = INVERTEDTEXT_USE_DPI ; pDlgParams->uDlgFlags = (fShowPreview?DLG_INVERTEDTEXT_SHOW_PREVIEW:0) | DLG_INVERTEDTEXT_SHOW_TOOL_ZOOMLEVEL ; return L_DlgInvertedText ( hWnd, pDlgParams ) ; } L_INT ShowHolePunchRemoveDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPHOLEPUNCHREMOVEDLGPARAMS pDlgParams ) { BITMAPHANDLE BitmapRegion ; memset ( &BitmapRegion, 0, sizeof ( BITMAPHANDLE ) ) ; memset ( &pDlgParams->HolePunchRemove, 0, sizeof ( HOLEPUNCH ) ) ; pDlgParams->uStructSize = sizeof ( HOLEPUNCHREMOVEDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->HolePunchRemove.uStructSize = sizeof ( HOLEPUNCH ) ; pDlgParams->HolePunchRemove.pBitmapRegion = &BitmapRegion ; pDlgParams->HolePunchRemove.uBitmapStructSize = sizeof ( BITMAPHANDLE ) ; pDlgParams->HolePunchRemove.iMinHoleWidth = 1 ; pDlgParams->HolePunchRemove.iMinHoleHeight = 1 ; pDlgParams->HolePunchRemove.iMaxHoleWidth = 2 ; pDlgParams->HolePunchRemove.iMaxHoleHeight = 2 ; pDlgParams->HolePunchRemove.iMinHoleCount = 2 ; pDlgParams->HolePunchRemove.iMaxHoleCount = 4 ; pDlgParams->HolePunchRemove.uFlags = HOLEPUNCH_USE_DPI | HOLEPUNCH_USE_COUNT | HOLEPUNCH_USE_LOCATION ; pDlgParams->HolePunchRemove.iLocation = HOLEPUNCH_LEFT ; pDlgParams->uDlgFlags = (fShowPreview?DLG_HOLEPUNCHREMOVE_SHOW_PREVIEW:0) | DLG_HOLEPUNCHREMOVE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgHolePunchRemove ( hWnd, pDlgParams ) ; } L_INT ShowRemoveRedeyeDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPREMOVEREDEYEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( REMOVEREDEYEDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->crNewColor = RGB(128,128,128); pDlgParams->uThreshold = 0; pDlgParams->nLightness = 100; pDlgParams->uDlgFlags = (fShowPreview?DLG_REMOVEREDEYE_SHOW_PREVIEW:0) | DLG_REMOVEREDEYE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_REMOVEREDEYE_SHOW_APPLY:0); return L_DlgRemoveRedeye ( hWnd, pDlgParams ) ; } L_INT ShowCanvasResizeDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPCANVASRESIZEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof ( CANVASRESIZEDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->nCurrentHeight = pBitmap->Height; pDlgParams->nCurrentWidth = pBitmap->Width; pDlgParams->nNewHeight = pBitmap->Height ; pDlgParams->nNewWidth = pBitmap->Width ; pDlgParams->uDlgFlags = DLG_CANVASRESIZE_AUTOPROCESS | DLG_CANVASRESIZE_SHOW_BACKCOLOR | DLG_CANVASRESIZE_SHOW_CURRENT_HEIGHT | DLG_CANVASRESIZE_SHOW_CURRENT_WIDTH | DLG_CANVASRESIZE_SHOW_HORIZPOS | DLG_CANVASRESIZE_SHOW_VERTZPOS | DLG_CANVASRESIZE_SHOW_KEEPASPECT ; return L_DlgCanvasResize ( hWnd, pDlgParams ) ; } L_INT ShowResizeDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPRESIZEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(RESIZEDLGPARAMS); pDlgParams->uOriginalWidth = BITMAPWIDTH(pBitmap); pDlgParams->uOriginalHeight = BITMAPHEIGHT(pBitmap); pDlgParams->uOriginalBitsPerPixel = pBitmap->BitsPerPixel; pDlgParams->uOriginalResolutionX = pBitmap->XResolution; pDlgParams->uOriginalResolutionY = pBitmap->YResolution; pDlgParams->uNewWidth = BITMAPWIDTH(pBitmap); pDlgParams->uNewHeight = BITMAPHEIGHT(pBitmap); pDlgParams->uNewResolutionX = pBitmap->XResolution; pDlgParams->uNewResolutionY = pBitmap->YResolution; pDlgParams->uResize = SIZE_NORMAL ; pDlgParams->uDlgFlags = DLG_RESIZE_SHOW_PERCENTAGE | DLG_RESIZE_SHOW_IDENTICALVALUE | DLG_RESIZE_SHOW_MAINTAINASPECT | DLG_RESIZE_SHOW_RESOLUTIONGRP; return L_DlgResize ( hWnd, pDlgParams ) ; } L_INT ShowHistogramDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPHISTOGRAMDLGPARAMS pDlgParams ) { L_INT nLowBits, nHighBits; L_GetMinMaxBits (pBitmap, &nLowBits, &nHighBits); pBitmap->LowBit = nLowBits ; pBitmap->HighBit = nHighBits ; pDlgParams->uStructSize = sizeof(HISTOGRAMDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->crRedChannelPen = RGB(255,0,0); pDlgParams->crGreenChannelPen = RGB(0,255,0); pDlgParams->crBlueChannelPen = RGB(0,0,255); pDlgParams->crMasterPen = RGB(0,0,0 ) ; pDlgParams->uHistogramFlags = HIST_LOWHIGH_BITS ; pDlgParams->uDlgFlags = DLG_HISTOGRAM_SHOW_VIEWSTYLE | DLG_HISTOGRAM_USERPENCOLORS ; return L_DlgHistogram ( hWnd, pDlgParams ) ; } //}} IMAGE MENU LEAD COMMON DIALOGS //{{ EFFECTS MENU LEAD COMMON DIALOGS L_INT ShowMotionBlurDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPMOTIONBLURDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(MOTIONBLURDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 1 ; pDlgParams->nAngle = 0 ; pDlgParams->bUnidirectional = FALSE ; pDlgParams->uDlgFlags = (fShowPreview?DLG_MOTIONBLUR_SHOW_PREVIEW:0)| DLG_MOTIONBLUR_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_MOTIONBLUR_SHOW_APPLY:0); return L_DlgMotionBlur ( hWnd, pDlgParams ) ; } L_INT ShowRadialBlurDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPRADIALBLURDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(RADIALBLURDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 1 ; pDlgParams->uStress = 1 ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uDlgFlags = (fShowPreview?DLG_RADIALBLUR_SHOW_PREVIEW:0)| DLG_RADIALBLUR_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_RADIALBLUR_SHOW_APPLY:0); return L_DlgRadialBlur ( hWnd, pDlgParams ) ; } L_INT ShowZoomBlurDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPZOOMBLURDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(ZOOMBLURDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 1 ; pDlgParams->uStress = 1 ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uDlgFlags = (fShowPreview?DLG_ZOOMBLUR_SHOW_PREVIEW:0)| DLG_ZOOMBLUR_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_ZOOMBLUR_SHOW_APPLY:0); return L_DlgZoomBlur ( hWnd, pDlgParams ) ; } L_INT ShowGaussianBlurDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPGAUSSIANBLURDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(GAUSSIANBLURDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nRadius = 1 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_GAUSSIANBLUR_SHOW_PREVIEW:0)| DLG_GAUSSIANBLUR_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_GAUSSIANBLUR_SHOW_APPLY:0); return L_DlgGaussianBlur ( hWnd, pDlgParams ) ; } L_INT ShowAntiAliasDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPANTIALIASDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(ANTIALIASDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uThreshold = 50 ; pDlgParams->uDim = 5 ; pDlgParams->uFilter = ANTIALIAS_DIAG ; pDlgParams->uDlgFlags = (fShowPreview?DLG_ANTIALIAS_SHOW_PREVIEW:0)| DLG_ANTIALIAS_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_ANTIALIAS_SHOW_APPLY:0); return L_DlgAntiAlias ( hWnd, pDlgParams ) ; } L_INT ShowAverageDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPAVERAGEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(AVERAGEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 3 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_AVERAGE_SHOW_PREVIEW:0)| DLG_AVERAGE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgAverage ( hWnd, pDlgParams ) ; } L_INT ShowMedianDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPMEDIANDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(MEDIANDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 3 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_MEDIAN_SHOW_PREVIEW:0)| DLG_MEDIAN_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_MEDIAN_SHOW_APPLY:0); return L_DlgMedian ( hWnd, pDlgParams ) ; } L_INT ShowAddNoiseDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPADDNOISEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(ADDNOISEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uRange = 100 ; pDlgParams->uChannel = CHANNEL_MASTER ; pDlgParams->uDlgFlags = (fShowPreview?DLG_ADDNOISE_SHOW_PREVIEW:0)| DLG_ADDNOISE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgAddNoise ( hWnd, pDlgParams ) ; } L_INT ShowMaxFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPMAXFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(MAXFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 3 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_MAXFILTER_SHOW_PREVIEW:0)| DLG_MAXFILTER_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_MAXFILTER_SHOW_APPLY:0); return L_DlgMaxFilter ( hWnd, pDlgParams ) ; } L_INT ShowMinFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPMINFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(MINFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 3; pDlgParams->uDlgFlags = (fShowPreview?DLG_MINFILTER_SHOW_PREVIEW:0)| DLG_MINFILTER_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_MINFILTER_SHOW_APPLY:0); return L_DlgMinFilter ( hWnd, pDlgParams ) ; } L_INT ShowUnsharpMaskDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPUNSHARPMASKDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(UNSHARPMASKDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nAmount = 0 ; pDlgParams->nRadius = 1 ; pDlgParams->nThreshold = 0 ; pDlgParams->uUnshrpMaskFlags = RGB_SPACE ; pDlgParams->uDlgFlags = (fShowPreview?DLG_UNSHARPMASK_SHOW_PREVIEW:0)| DLG_UNSHARPMASK_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_UNSHARPMASK_SHOW_APPLY:0); return L_DlgUnsharpMask ( hWnd, pDlgParams ) ; } L_INT ShowSharpenDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSHARPENDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(SHARPENDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nSharpness = 0 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_SHARPEN_SHOW_PREVIEW:0)| DLG_SHARPEN_SHOW_TOOL_ZOOMLEVEL ; return L_DlgSharpen ( hWnd, pDlgParams ) ; } L_INT ShowMultiplyDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPMULTIPLYDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(MULTIPLYDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uFactor = 100 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_MULTIPLY_SHOW_PREVIEW:0)| DLG_MULTIPLY_SHOW_TOOL_ZOOMLEVEL ; return L_DlgMultiply ( hWnd, pDlgParams ) ; } L_INT ShowAddBitmapsDialog ( HWND hWnd, LPADDBITMAPSDLGPARAMS pDlgParams, LPDLGBITMAPLIST pBitmapList ) { L_INT nRet = SUCCESS_DLG_OK ; GETDIRECTORYDLGPARAMS DirectoryDlgParams ; if ( NULL == pBitmapList ) { return FAILURE ; } ZeroMemory ( &DirectoryDlgParams, sizeof (GETDIRECTORYDLGPARAMS)) ; DirectoryDlgParams.uStructSize = sizeof (GETDIRECTORYDLGPARAMS); DirectoryDlgParams.pszDirectory = malloc ( L_MAXPATH * 2 ) ; DirectoryDlgParams.pszTitle = TEXT("Select a Folder") ; DirectoryDlgParams.nBuffSize = L_MAXPATH ; DirectoryDlgParams.pszFilter = NULL ; DirectoryDlgParams.nFilterIndex = 1 ; nRet = L_DlgGetDirectory ( hWnd, &DirectoryDlgParams ) ; // Get the Border directory if ( nRet == SUCCESS_DLG_OK ) { L_INT i = 0 ; HCURSOR hCursor; hCursor = SetCursor (LoadCursor (NULL, IDC_WAIT)); pBitmapList->pBitmapList = malloc ( sizeof ( DLGBITMAPLISTITEM ) * DLG_IMAGE_LIST_COUNT ) ; if ( NULL == pBitmapList->pBitmapList ) { return ERROR_NO_MEMORY ; } else { for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { pBitmapList->pBitmapList [ i ].pBitmap = malloc ( sizeof ( BITMAPHANDLE ) ) ; pBitmapList->pBitmapList [ i ].pszFileName = NULL ; pBitmapList->pBitmapList [ i ].pszDescription = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; memset(pBitmapList->pBitmapList [ i ].pBitmap,0, sizeof(BITMAPHANDLE)); memset(pBitmapList->pBitmapList [ i ].pszDescription,0, sizeof ( L_TCHAR ) * L_MAXPATH ); } } if ( SUCCESS != GenerateBitampList ( hWnd, DirectoryDlgParams.pszDirectory, pBitmapList, FALSE ) ) { pDlgParams->pBitmapList = NULL; return FAILURE; } else { pDlgParams->uStructSize = sizeof(ADDBITMAPSDLGPARAMS); pDlgParams->pBitmapList = pBitmapList; pDlgParams->uAddBitmapsFlags = BC_AVG ; pDlgParams->uDlgFlags = (fShowPreview?DLG_ADDBITMAPS_SHOW_PREVIEW:0)| DLG_ADDBITMAPS_SHOW_TOOL_ZOOMLEVEL ; L_CreateBitmapList ( &pDlgParams->hList ) ; SetCursor (hCursor); return L_DlgAddBitmaps ( hWnd, pDlgParams ) ; } } else { return nRet ; } } L_INT ShowStitchDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSTITCHDLGPARAMS pDlgParams ) { L_INT nRet = SUCCESS_DLG_OK ; GETDIRECTORYDLGPARAMS DirectoryDlgParams ; ZeroMemory ( &DirectoryDlgParams, sizeof (GETDIRECTORYDLGPARAMS)) ; DirectoryDlgParams.uStructSize = sizeof (GETDIRECTORYDLGPARAMS); DirectoryDlgParams.pszDirectory = malloc ( L_MAXPATH * 2 ) ; DirectoryDlgParams.pszTitle = TEXT("Select a Folder") ; DirectoryDlgParams.nBuffSize = L_MAXPATH ; DirectoryDlgParams.pszFilter = NULL ; DirectoryDlgParams.nFilterIndex = 1 ; nRet = L_DlgGetDirectory ( hWnd, &DirectoryDlgParams ) ; // Get the Underlay directory if ( nRet == SUCCESS_DLG_OK ) { DLGBITMAPLIST BitmapList ; L_INT i = 0 ; HCURSOR hCursor; hCursor = SetCursor (LoadCursor (NULL, IDC_WAIT)); BitmapList.pBitmapList = malloc ( sizeof ( DLGBITMAPLISTITEM ) * DLG_IMAGE_LIST_COUNT ) ; if ( NULL == BitmapList.pBitmapList ) { return ERROR_NO_MEMORY ; } else { for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { BitmapList.pBitmapList [ i ].pBitmap = malloc ( sizeof ( BITMAPHANDLE ) ) ; BitmapList.pBitmapList [ i ].pszFileName = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; BitmapList.pBitmapList [ i ].pszDescription = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; memset(BitmapList.pBitmapList [ i ].pBitmap,0, sizeof ( BITMAPHANDLE ) ) ; memset(BitmapList.pBitmapList [ i ].pszFileName,0, sizeof ( L_TCHAR ) * L_MAXPATH ) ; memset(BitmapList.pBitmapList [ i ].pszDescription,0, sizeof ( L_TCHAR ) * L_MAXPATH ) ; } } if ( SUCCESS == GenerateBitampList ( hWnd, DirectoryDlgParams.pszDirectory, &BitmapList, FALSE ) ) { pDlgParams->uStructSize = sizeof(STITCHDLGPARAMS); pDlgParams->pResultingBitmap = pBitmap ; pDlgParams->uResultingBitmapStructSize = sizeof(BITMAPHANDLE); pDlgParams->nResultingBitmapWidth = 320 ; pDlgParams->nResultingBitmapHeight = 200 ; pDlgParams->nResultingBitmapBitsPerPixel = 24 ; pDlgParams->nRes = 72 ; pDlgParams->crBackGround = RGB ( 255, 255, 255 ) ; pDlgParams->pBitmapList = &BitmapList ; pDlgParams->uDlgFlags = 0 ; pDlgParams->nCmdShow = SW_SHOW ; SetCursor (hCursor); nRet = L_DlgStitch ( hWnd, pDlgParams ) ; } else { nRet = FAILURE ; } // clean up for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { if ( NULL != BitmapList.pBitmapList [ i ].pBitmap ) { if ( BitmapList.pBitmapList [ i ].pBitmap->Flags.Allocated ) { L_FreeBitmap ( BitmapList.pBitmapList [ i ].pBitmap ) ; } free ( BitmapList.pBitmapList [ i ].pBitmap ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszFileName ) { free ( BitmapList.pBitmapList [ i ].pszFileName ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszDescription ) { free ( BitmapList.pBitmapList [ i ].pszDescription ) ; } } if ( NULL != BitmapList.pBitmapList ) { free ( BitmapList.pBitmapList ) ; } return nRet ; } else { return nRet ; } } L_INT ShowFreeHandWaveDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPFREEHANDWAVEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(FREEHANDWAVEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uScale = 100 ; pDlgParams->uWaveLen = 100 ; pDlgParams->uFreeHandWaveFlags = FILL_RPT | DIS_PER ; pDlgParams->uDlgFlags = (fShowPreview?DLG_FREEHANDWAVE_SHOW_PREVIEW:0)| DLG_FREEHANDWAVE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_FREEHANDWAVE_SHOW_APPLY:0); return L_DlgFreeHandWave ( hWnd, pDlgParams ) ; } L_INT ShowWindDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPWINDDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(WINDDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 1 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_WIND_SHOW_PREVIEW:0)| DLG_WIND_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_WIND_SHOW_APPLY:0); return L_DlgWind ( hWnd, pDlgParams ) ; } L_INT ShowPolarDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPPOLARDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(POLARDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uPolarFlags = FILL_CLR | CART_TO_POL ; pDlgParams->crFill = RGB(0,0,0); pDlgParams->uDlgFlags = (fShowPreview?DLG_POLAR_SHOW_PREVIEW:0)| DLG_POLAR_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_POLAR_SHOW_APPLY:0); return L_DlgPolar ( hWnd, pDlgParams ) ; } L_INT ShowZoomWaveDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPZOOMWAVEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(ZOOMWAVEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uAmplitude = 1 ; pDlgParams->uFrequency = 1 ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uZoomWaveFlags = FILL_CLR ; pDlgParams->uDlgFlags = (fShowPreview?DLG_ZOOMWAVE_SHOW_PREVIEW:0)| DLG_ZOOMWAVE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_ZOOMWAVE_SHOW_APPLY:0); return L_DlgZoomWave ( hWnd, pDlgParams ) ; } L_INT ShowRadialWaveDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPRADIALWAVEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(RADIALWAVEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uAmplitude = 1 ; pDlgParams->uWaveLen = 100 ; pDlgParams->nPhase = 0 ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uRadialWaveFlags = FILL_RPT | DIS_PER ; pDlgParams->uDlgFlags = (fShowPreview?DLG_RADIALWAVE_SHOW_PREVIEW:0)| DLG_RADIALWAVE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_RADIALWAVE_SHOW_APPLY:0); return L_DlgRadialWave ( hWnd, pDlgParams ) ; } L_INT ShowSwirlDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSWIRLDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(SWIRLDLGPARAMS); pDlgParams->pBitmap = pBitmap ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uDlgFlags = (fShowPreview?DLG_SWIRL_SHOW_PREVIEW:0)| DLG_SWIRL_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_SWIRL_SHOW_APPLY:0); return L_DlgSwirl ( hWnd, pDlgParams ) ; } L_INT ShowWaveDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPWAVEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(WAVEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uAmplitude = 1 ; pDlgParams->uWaveLen = 100 ; pDlgParams->nAngle = 0 ; pDlgParams->uHorzScale = 100 ; pDlgParams->uVertScale = 100 ; pDlgParams->uWaveFlags = FILL_CLR | DIS_PER | WV_SIN ; pDlgParams->uDlgFlags = (fShowPreview?DLG_WAVE_SHOW_PREVIEW:0)| DLG_WAVE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_WAVE_SHOW_APPLY:0); return L_DlgWave ( hWnd, pDlgParams ) ; } L_INT ShowWaveShearDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPWAVESHEARDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(WAVESHEARDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uScale = 50 ; pDlgParams->uWaveShearFlags = FILL_CLR | SHR_VERT ; pDlgParams->uDlgFlags = (fShowPreview?DLG_WAVESHEAR_SHOW_PREVIEW:0)| DLG_WAVESHEAR_SHOW_TOOL_ZOOMLEVEL ; return L_DlgWaveShear ( hWnd, pDlgParams ) ; } L_INT ShowEmbossDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPEMBOSSDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(EMBOSSDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDepth = 0 ; pDlgParams->uDirection = EMBOSS_N ; pDlgParams->uDlgFlags = (fShowPreview?DLG_EMBOSS_SHOW_PREVIEW:0)| DLG_EMBOSS_SHOW_TOOL_ZOOMLEVEL ; return L_DlgEmboss ( hWnd, pDlgParams ) ; } L_INT ShowPunchDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPPUNCHDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(PUNCHDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nValue = 0 ; pDlgParams->uStress = 1 ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uPunchFlags = FILL_CLR | FILL_WOUTROT ; pDlgParams->uDlgFlags = (fShowPreview?DLG_PUNCH_SHOW_PREVIEW:0)| DLG_PUNCH_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_PUNCH_SHOW_APPLY:0); return L_DlgPunch ( hWnd, pDlgParams ) ; } L_INT ShowRippleDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPRIPPLEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(RIPPLEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uAmplitude = 0 ; pDlgParams->uFrequency = 1 ; pDlgParams->nPhase = 0 ; pDlgParams->uAttenuation = 0 ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uRippleFlag = FILL_CLR ; pDlgParams->uDlgFlags = (fShowPreview?DLG_RIPPLE_SHOW_PREVIEW:0)| DLG_RIPPLE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_RIPPLE_SHOW_APPLY:0); return L_DlgRipple ( hWnd, pDlgParams ) ; } L_INT ShowBendingDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPBENDINGDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(BENDINGDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nValue = 0 ; pDlgParams->crFill = RGB (0,0,0) ; pDlgParams->uBendingFlags = BND_NORM | FILL_CLR | FILL_WOUTROT ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uDlgFlags = (fShowPreview?DLG_BENDING_SHOW_PREVIEW:0)| DLG_BENDING_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_BENDING_SHOW_APPLY:0); return L_DlgBending ( hWnd, pDlgParams ) ; } L_INT ShowCylindricalDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPCYLINDRICALDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(CYLINDRICALDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nValue = 0 ; pDlgParams->uType = CYL_HORZ ; pDlgParams->uDlgFlags = (fShowPreview?DLG_CYLINDRICAL_SHOW_PREVIEW:0)| DLG_CYLINDRICAL_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_CYLINDRICAL_SHOW_APPLY:0); return L_DlgCylindrical ( hWnd, pDlgParams ) ; } L_INT ShowSpherizeDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSPHERIZEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(SPHERIZEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nValue = 0 ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uSpherizeFlags = FILL_CLR | FILL_WOUTROT ; pDlgParams->uDlgFlags = (fShowPreview?DLG_SPHERIZE_SHOW_PREVIEW:0)| DLG_SPHERIZE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_SPHERIZE_SHOW_APPLY:0); return L_DlgSpherize ( hWnd, pDlgParams ) ; } L_INT ShowImpressionistDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPIMPRESSIONISTDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(IMPRESSIONISTDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uHorzDim = 1 ; pDlgParams->uVertDim = 1 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_IMPRESSIONIST_SHOW_PREVIEW:0)| DLG_IMPRESSIONIST_SHOW_TOOL_ZOOMLEVEL ; return L_DlgImpressionist ( hWnd, pDlgParams ) ; } L_INT ShowOilifyDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPOILIFYDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(OILIFYDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 3 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_OILIFY_SHOW_PREVIEW:0)| DLG_OILIFY_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_OILIFY_SHOW_APPLY:0); return L_DlgOilify ( hWnd, pDlgParams ) ; } L_INT ShowUnderlayDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPUNDERLAYDLGPARAMS pDlgParams, pBITMAPHANDLE pUnderLayBitmap ) { L_INT nRet = SUCCESS_DLG_OK ; GETDIRECTORYDLGPARAMS DirectoryDlgParams ; ZeroMemory ( &DirectoryDlgParams, sizeof (GETDIRECTORYDLGPARAMS)) ; DirectoryDlgParams.uStructSize = sizeof (GETDIRECTORYDLGPARAMS); DirectoryDlgParams.pszDirectory = malloc ( L_MAXPATH * 2 ) ; DirectoryDlgParams.pszTitle = TEXT("Select a Folder") ; DirectoryDlgParams.nBuffSize = L_MAXPATH ; DirectoryDlgParams.pszFilter = NULL ; DirectoryDlgParams.nFilterIndex = 1 ; nRet = L_DlgGetDirectory ( hWnd, &DirectoryDlgParams ) ; // Get the Underlay directory if ( nRet == SUCCESS_DLG_OK ) { DLGBITMAPLIST BitmapList ; L_INT i = 0 ; HCURSOR hCursor; hCursor = SetCursor (LoadCursor (NULL, IDC_WAIT)); BitmapList.pBitmapList = malloc ( sizeof ( DLGBITMAPLISTITEM ) * DLG_IMAGE_LIST_COUNT ) ; if ( NULL == BitmapList.pBitmapList ) { return ERROR_NO_MEMORY ; } else { for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { BitmapList.pBitmapList [ i ].pBitmap = malloc ( sizeof ( BITMAPHANDLE ) ) ; BitmapList.pBitmapList [ i ].pszFileName = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; BitmapList.pBitmapList [ i ].pszDescription = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; memset(BitmapList.pBitmapList [ i ].pBitmap,0, sizeof(BITMAPHANDLE)); memset(BitmapList.pBitmapList [ i ].pszFileName,0, sizeof ( L_TCHAR ) * L_MAXPATH ); memset(BitmapList.pBitmapList [ i ].pszDescription,0, sizeof ( L_TCHAR ) * L_MAXPATH ); } } if ( SUCCESS == GenerateBitampList ( hWnd, DirectoryDlgParams.pszDirectory, &BitmapList, TRUE ) ) { pDlgParams->uStructSize = sizeof ( UNDERLAYDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->pBitmapList = &BitmapList ; pDlgParams->uDlgFlags = (fShowPreview?DLG_UNDERLAY_SHOW_PREVIEW:0)| DLG_UNDERLAY_SHOW_TOOL_ZOOMLEVEL ; SetCursor (hCursor); nRet = L_DlgUnderlay ( hWnd, pDlgParams ) ; if ( SUCCESS_DLG_OK == nRet ) { if ( ( pDlgParams->nUnderlayBitmapIndex >=0 ) || ( pDlgParams->nUnderlayBitmapIndex < DLG_IMAGE_LIST_COUNT ) ) { if(SUCCESS!=L_LoadFile(BitmapList.pBitmapList[pDlgParams->nUnderlayBitmapIndex].pszFileName, pUnderLayBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, LOADFILE_ALLOCATE | LOADFILE_STORE, NULL, NULL, NULL, NULL)) { nRet = FAILURE; } } else { nRet = FAILURE; } } } else { nRet = FAILURE ; } // clean up for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { if ( NULL != BitmapList.pBitmapList [ i ].pBitmap ) { if ( BitmapList.pBitmapList [ i ].pBitmap->Flags.Allocated ) { L_FreeBitmap ( BitmapList.pBitmapList [ i ].pBitmap ) ; } free ( BitmapList.pBitmapList [ i ].pBitmap ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszFileName ) { free ( BitmapList.pBitmapList [ i ].pszFileName ) ; } if ( NULL != BitmapList.pBitmapList [ i ].pszDescription ) { free ( BitmapList.pBitmapList [ i ].pszDescription ) ; } } if ( NULL != BitmapList.pBitmapList ) { free ( BitmapList.pBitmapList ) ; } return nRet ; } else { return nRet ; } } L_INT ShowPixelateDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPPIXELATEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(PIXELATEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uCellHeight = 1 ; pDlgParams->uCellWidth = 1 ; pDlgParams->uOpacity = 100 ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->ptCenter.y = RECTHEIGHT(&rcRGN) / 2 ; pDlgParams->ptCenter.x = RECTWIDTH(&rcRGN) / 2 ; } else { pDlgParams->ptCenter.y = BITMAPHEIGHT(pBitmap) / 2 ; pDlgParams->ptCenter.x = BITMAPWIDTH(pBitmap) / 2 ; } pDlgParams->uPixelateFlags = PIX_AVR | PIX_RECT | PIX_WPER | PIX_HPER ; pDlgParams->uDlgFlags = (fShowPreview?DLG_PIXELATE_SHOW_PREVIEW:0)| DLG_PIXELATE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_PIXELATE_SHOW_APPLY:0); return L_DlgPixelate ( hWnd, pDlgParams ) ; } L_INT ShowMosaicDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPMOSAICDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(MOSAICDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDim = 3 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_MOSAIC_SHOW_PREVIEW:0)| DLG_MOSAIC_SHOW_TOOL_ZOOMLEVEL ; return L_DlgMosaic ( hWnd, pDlgParams ) ; } L_INT ShowPicturizeDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPPICTURIZEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(PICTURIZEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nCellHeight = 10 ; pDlgParams->nCellWidth = 10 ; pDlgParams->nBitmapHeight = pBitmap->Height ; pDlgParams->nBitmapWidth = pBitmap->Width ; pDlgParams->uResize = PICTURIZE_RESIZE ; pDlgParams->uDlgFlags = 0 ; return L_DlgPicturize ( hWnd, pDlgParams ) ; } L_INT ShowEdgeDetectorDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPEDGEDETECTORDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(EDGEDETECTORDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uThreshold = 0 ; pDlgParams->uFilter = EDG_SOBEL_VERT ; pDlgParams->uDlgFlags = (fShowPreview?DLG_EDGEDETECTOR_SHOW_PREVIEW:0)| DLG_EDGEDETECTOR_SHOW_TOOL_ZOOMLEVEL ; return L_DlgEdgeDetector ( hWnd, pDlgParams ) ; } L_INT ShowErosionFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPEROSIONFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(EROSIONFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->pFilter = BFLT_EROSION_OMNI ; pDlgParams->uDlgFlags = (fShowPreview?DLG_EROSIONFILTER_SHOW_PREVIEW:0)| DLG_EROSIONFILTER_SHOW_TOOL_ZOOMLEVEL ; return L_DlgErosionFilter ( hWnd, pDlgParams ) ; } L_INT ShowDilationFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPDILATIONFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(DILATIONFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->pFilter = BFLT_DILATION_OMNI ; pDlgParams->uDlgFlags = (fShowPreview?DLG_DILATIONFILTER_SHOW_PREVIEW:0)| DLG_DILATIONFILTER_SHOW_TOOL_ZOOMLEVEL ; return L_DlgDilationFilter ( hWnd, pDlgParams ) ; } L_INT ShowContourFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPCONTOURFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(CONTOURFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nThreshold = 15 ; pDlgParams->nDeltaDirection = 35 ; pDlgParams->nMaxError = 5 ; pDlgParams->nOption = CONTOUR_THIN ; pDlgParams->uOptionFlags = DLG_CONTOURFILTER_SHOW_OPTION_THIN | DLG_CONTOURFILTER_SHOW_OPTION_LINK_BW | DLG_CONTOURFILTER_SHOW_OPTION_LINK_GRAY | DLG_CONTOURFILTER_SHOW_OPTION_LINK_COLOR | DLG_CONTOURFILTER_SHOW_OPTION_APPROX_COLOR; pDlgParams->uDlgFlags = (fShowPreview?DLG_CONTOURFILTER_SHOW_PREVIEW:0)| DLG_CONTOURFILTER_SHOW_OPTION | DLG_CONTOURFILTER_SHOW_THRESHOLD | DLG_CONTOURFILTER_SHOW_DELTADIRECTION | DLG_CONTOURFILTER_SHOW_MAXIMUMERROR | DLG_CONTOURFILTER_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_CONTOURFILTER_SHOW_APPLY:0); return L_DlgContourFilter ( hWnd, pDlgParams ) ; } L_INT ShowGradientFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPGRADIENTFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(GRADIENTFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->pFilter = FLT_GRADIENT_N ; pDlgParams->uDlgFlags = (fShowPreview?DLG_GRADIENTFILTER_SHOW_PREVIEW:0)| DLG_GRADIENTFILTER_SHOW_TOOL_ZOOMLEVEL ; return L_DlgGradientFilter ( hWnd, pDlgParams ) ; } L_INT ShowLaplacianFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPLAPLACIANFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(LAPLACIANFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->pFilter = FLT_LAPLACE_1 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_LAPLACIANFILTER_SHOW_PREVIEW:0)| DLG_LAPLACIANFILTER_SHOW_TOOL_ZOOMLEVEL ; return L_DlgLaplacianFilter ( hWnd, pDlgParams ) ; } L_INT ShowSobelFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSOBELFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(SOBELFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->pFilter = FLT_SOBEL_HORZ ; pDlgParams->uDlgFlags = (fShowPreview?DLG_SOBELFILTER_SHOW_PREVIEW:0)| DLG_SOBELFILTER_SHOW_TOOL_ZOOMLEVEL ; return L_DlgSobelFilter ( hWnd, pDlgParams ) ; } L_INT ShowPrewittFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPPREWITTFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(PREWITTFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->pFilter = FLT_PREWITT_HORZ ; pDlgParams->uDlgFlags = (fShowPreview?DLG_PREWITTFILTER_SHOW_PREVIEW:0)| DLG_PREWITTFILTER_SHOW_TOOL_ZOOMLEVEL ; return L_DlgPrewittFilter ( hWnd, pDlgParams ) ; } L_INT ShowShiftDifferenceFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSHIFTDIFFERENCEFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(SHIFTDIFFERENCEFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->pFilter = FLT_SHIFTDIFF_DIAG ; pDlgParams->uDlgFlags = (fShowPreview?DLG_SHIFTDIFFERENCEFILTER_SHOW_PREVIEW:0)| DLG_SHIFTDIFFERENCEFILTER_SHOW_TOOL_ZOOMLEVEL ; return L_DlgShiftDifferenceFilter ( hWnd, pDlgParams ) ; } L_INT ShowLineSegmentFilterDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPLINESEGMENTFILTERDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(LINESEGMENTFILTERDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->pFilter = FLT_LINESEG_HORZ ; pDlgParams->uDlgFlags = (fShowPreview?DLG_LINESEGMENTFILTER_SHOW_PREVIEW:0)| DLG_LINESEGMENTFILTER_SHOW_TOOL_ZOOMLEVEL ; return L_DlgLineSegmentFilter ( hWnd, pDlgParams ) ; } //}} EFFECTS MENU LEAD COMMON DIALOGS //{{ COLOR MENU LEAD COMMON DIALOGS L_INT ShowIntensityDetectDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPINTENSITYDETECTDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(INTENSITYDETECTDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uLow = 128 ; pDlgParams->uHigh = 255 ; pDlgParams->crInColor = RGB ( 0, 0, 0 ) ; pDlgParams->crOutColor = RGB(255, 255, 255) ; pDlgParams->uChannel = IDB_CHANNEL_MASTER ; pDlgParams->uDlgFlags = (fShowPreview?DLG_INTENSITYDETECT_SHOW_PREVIEW:0)| DLG_INTENSITYDETECT_SHOW_TOOL_ZOOMLEVEL ; return L_DlgIntensityDetect ( hWnd, pDlgParams ) ; } L_INT ShowSolarizeDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSOLARIZEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(SOLARIZEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nThreshold = 0 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_SOLARIZE_SHOW_PREVIEW:0)| DLG_SOLARIZE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgSolarize ( hWnd, pDlgParams ) ; } L_INT ShowPosterizeDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPPOSTERIZEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(POSTERIZEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nLevels = 2 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_POSTERIZE_SHOW_PREVIEW:0)| DLG_POSTERIZE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgPosterize ( hWnd, pDlgParams ) ; } L_INT ShowBrightnessDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPBRIGHTNESSDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(BRIGHTNESSDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nChange = 0 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_BRIGHTNESS_SHOW_PREVIEW:0)| DLG_BRIGHTNESS_SHOW_TOOL_ZOOMLEVEL ; return L_DlgBrightness ( hWnd, pDlgParams ) ; } L_INT ShowContrastDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPCONTRASTDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(CONTRASTDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nChange = 0; pDlgParams->uDlgFlags = (fShowPreview?DLG_CONTRAST_SHOW_PREVIEW:0)| DLG_CONTRAST_SHOW_TOOL_ZOOMLEVEL ; return L_DlgContrast ( hWnd, pDlgParams ) ; } L_INT ShowHueDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPHUEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(HUEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nAngle = 0 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_HUE_SHOW_PREVIEW:0)| DLG_HUE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgHue ( hWnd, pDlgParams ) ; } L_INT ShowSaturationDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPSATURATIONDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(SATURATIONDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nChange = 0 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_SATURATION_SHOW_PREVIEW:0)| DLG_SATURATION_SHOW_TOOL_ZOOMLEVEL ; return L_DlgSaturation ( hWnd, pDlgParams ) ; } L_INT ShowGammaAdjustmentDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPGAMMAADJUSTMENTDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(GAMMAADJUSTMENTDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nRedValue = 150 ; pDlgParams->nGreenValue = 150 ; pDlgParams->nBlueValue = 150 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_GAMMAADJUSTMENT_SHOW_PREVIEW:0)| DLG_GAMMAADJUSTMENT_SHOW_TOOL_ZOOMLEVEL | DLG_GAMMAADJUSTMENT_FORCELINKCHANNELS; return L_DlgGammaAdjustment ( hWnd, pDlgParams ) ; } L_INT ShowBalanceColorsDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPBALANCECOLORSDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(BALANCECOLORSDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->RedFactor.toRed = 1 ; pDlgParams->GreenFactor.toGreen = 1 ; pDlgParams->BlueFactor.toBlue = 1 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_BALANCECOLORS_SHOW_PREVIEW:0)| DLG_BALANCECOLORS_SHOW_TOOL_ZOOMLEVEL ; return L_DlgBalanceColors ( hWnd, pDlgParams ) ; } L_INT ShowHalftoneDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPHALFTONEDLGPARAMS pDlgParams, LPDLGBITMAPLIST pBitmapList ) { L_INT nRet = SUCCESS_DLG_OK ; GETDIRECTORYDLGPARAMS DirectoryDlgParams ; if ( NULL == pBitmapList ) { return FAILURE ; } ZeroMemory ( &DirectoryDlgParams, sizeof (GETDIRECTORYDLGPARAMS)) ; DirectoryDlgParams.uStructSize = sizeof (GETDIRECTORYDLGPARAMS); DirectoryDlgParams.pszDirectory = malloc ( L_MAXPATH * 2 ) ; DirectoryDlgParams.pszTitle = TEXT("Select a Folder") ; DirectoryDlgParams.nBuffSize = L_MAXPATH ; DirectoryDlgParams.pszFilter = NULL ; DirectoryDlgParams.nFilterIndex = 1 ; nRet = L_DlgGetDirectory ( hWnd, &DirectoryDlgParams ) ; // Get the Border directory if ( nRet == SUCCESS_DLG_OK ) { L_INT i = 0 ; HCURSOR hCursor; hCursor = SetCursor (LoadCursor (NULL, IDC_WAIT)); pBitmapList->pBitmapList = malloc ( sizeof ( DLGBITMAPLISTITEM ) * DLG_IMAGE_LIST_COUNT ) ; if ( NULL == pBitmapList->pBitmapList ) { return ERROR_NO_MEMORY ; } else { for ( i = 0 ; i < DLG_IMAGE_LIST_COUNT ; i++ ) { pBitmapList->pBitmapList [ i ].pBitmap = malloc ( sizeof ( BITMAPHANDLE ) ) ; pBitmapList->pBitmapList [ i ].pszFileName = NULL ; pBitmapList->pBitmapList [ i ].pszDescription = malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; memset(pBitmapList->pBitmapList [ i ].pBitmap,0, sizeof(BITMAPHANDLE)); memset(pBitmapList->pBitmapList [ i ].pszDescription,0, sizeof ( L_TCHAR ) * L_MAXPATH ); } pBitmapList->nCount = DLG_IMAGE_LIST_COUNT ; } if ( SUCCESS != GenerateBitampList ( hWnd, DirectoryDlgParams.pszDirectory, pBitmapList, TRUE ) ) { pDlgParams->pBitmapList = NULL; } else { pDlgParams->pBitmapList = pBitmapList; } pDlgParams->uStructSize = sizeof(HALFTONEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nAngle = 0 ; pDlgParams->uType = HT_PRINT ; pDlgParams->uDlgFlags = (fShowPreview?DLG_HALFTONE_SHOW_PREVIEW:0)| DLG_HALFTONE_SHOW_TOOL_ZOOMLEVEL ; L_CreateBitmapList ( &pDlgParams->hList ) ; SetCursor (hCursor); nRet = L_DlgHalftone ( hWnd, pDlgParams ) ; return nRet ; } else { return nRet ; } } L_INT ShowColorResDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPCOLORRESDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(COLORRESDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nBitsPerPixel = pBitmap->BitsPerPixel ; pDlgParams->uColorResFlags = CRF_SLOWMATCH; pDlgParams->uDlgFlags = (fShowPreview?DLG_COLORRES_SHOW_PREVIEW:0) | DLG_COLORRES_SHOW_ORDER | DLG_COLORRES_SHOW_TOOL_ZOOMLEVEL | DLG_COLORRES_SHOW_OPENPALFILE ; pDlgParams->uDlgFlagsEx = DLG_COLORRES_SHOW_BITALL | DLG_COLORRES_SHOW_DITHER_ALL | DLG_COLORRES_SHOW_PAL_ALL ; return L_DlgColorRes ( hWnd, pDlgParams ) ; } L_INT ShowGrayScaleDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPGRAYSCALEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(GRAYSCALEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nRedFactor = 250 ; pDlgParams->nGreenFactor = 625 ; pDlgParams->nBlueFactor = 125 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_GRAYSCALE_SHOW_PREVIEW:0)| DLG_GRAYSCALE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgGrayScale ( hWnd, pDlgParams ) ; } L_INT ShowColoredGrayDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPCOLOREDGRAYDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(COLOREDGRAYDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nRedFactor = 250 ; pDlgParams->nGreenFactor = 625 ; pDlgParams->nBlueFactor = 125 ; pDlgParams->nRedGrayFactor = 300 ; pDlgParams->nGreenGrayFactor = 200 ; pDlgParams->nBlueGrayFactor = 100 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_COLOREDGRAY_SHOW_PREVIEW:0)| DLG_COLOREDGRAY_SHOW_TOOL_ZOOMLEVEL ; return L_DlgColoredGray ( hWnd, pDlgParams ) ; } L_INT ShowRemapIntensityDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPREMAPINTENSITYDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(REMAPINTENSITYDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uChannel = CHANNEL_MASTER ; pDlgParams->uDlgFlags = (fShowPreview?DLG_REMAPINTENSITY_SHOW_PREVIEW:0)| DLG_REMAPINTENSITY_SHOW_TOOL_ZOOMLEVEL ; return L_DlgRemapIntensity ( hWnd, pDlgParams ) ; } L_INT ShowRemapHueDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPREMAPHUEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(REMAPHUEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uDlgFlags = (fShowPreview?DLG_REMAPHUE_SHOW_PREVIEW:0)| DLG_REMAPHUE_SHOW_TOOL_ZOOMLEVEL ; return L_DlgRemapHue ( hWnd, pDlgParams ) ; } L_INT ShowLocalHistoEqualizeDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPLOCALHISTOEQUALIZEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(LOCALHISTOEQUALIZEDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->uType = RGB_SPACE ; if ( SUCCESS == L_BitmapHasRgn ( pBitmap ) ) { RECT rcRGN ; RGNXFORM xform ; xform.nXOffset = 0 ; xform.nYOffset = 0 ; xform.nXScalarDen = 1 ; xform.nXScalarNum = 1 ; xform.nYScalarDen = 1 ; xform.nYScalarNum = 1 ; xform.uViewPerspective = TOP_LEFT ; L_GetBitmapRgnBounds ( pBitmap, &xform, &rcRGN ) ; pDlgParams->nHeight = RECTHEIGHT(&rcRGN) ; pDlgParams->nWidth = RECTWIDTH(&rcRGN) ; } else { pDlgParams->nHeight = BITMAPHEIGHT(pBitmap) ; pDlgParams->nWidth = BITMAPWIDTH(pBitmap) ; } pDlgParams->uDlgFlags = (fShowPreview?DLG_LOCALHISTOEQUALIZE_SHOW_PREVIEW:0)| DLG_LOCALHISTOEQUALIZE_SHOW_TOOL_ZOOMLEVEL| (fShowApply?DLG_LOCALHISTOEQUALIZE_SHOW_APPLY:0); return L_DlgLocalHistoEqualize ( hWnd, pDlgParams ) ; } L_INT ShowHistoContrastDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPHISTOCONTRASTDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(HISTOCONTRASTDLGPARAMS); pDlgParams->pBitmap = pBitmap ; pDlgParams->nChange = 0 ; pDlgParams->uDlgFlags = (fShowPreview?DLG_HISTOCONTRAST_SHOW_PREVIEW:0)| DLG_HISTOCONTRAST_SHOW_TOOL_ZOOMLEVEL ; return L_DlgHistoContrast ( hWnd, pDlgParams ) ; } L_INT ShowCustomizePaletteDialog ( HWND hWnd, LPCUSTOMIZEPALETTEDLGPARAMS pDlgParams ) { pDlgParams->uStructSize = sizeof(CUSTOMIZEPALETTEDLGPARAMS); pDlgParams->uDlgFlags = DLG_CUSTOMIZEPALETTE_SHOW_SORT | DLG_CUSTOMIZEPALETTE_SHOW_FINDCLOSEST | DLG_CUSTOMIZEPALETTE_SHOW_ADDOPTION | DLG_CUSTOMIZEPALETTE_SHOW_REMOVEOPTION | DLG_CUSTOMIZEPALETTE_SHOW_COLORMODEL | DLG_CUSTOMIZEPALETTE_SHOW_RGBLEFTPAN | DLG_CUSTOMIZEPALETTE_SHOW_HTMLLEFTPAN | DLG_CUSTOMIZEPALETTE_SHOW_INDEXLEFTPAN | DLG_CUSTOMIZEPALETTE_SHOW_RGBRIGHTPAN | DLG_CUSTOMIZEPALETTE_SHOW_HTMLRIGHTPAN | DLG_CUSTOMIZEPALETTE_SHOW_INDEXRIGHTPAN | DLG_CUSTOMIZEPALETTE_SHOW_NEW | DLG_CUSTOMIZEPALETTE_SHOW_OPEN | DLG_CUSTOMIZEPALETTE_SHOW_SAVE | DLG_CUSTOMIZEPALETTE_SHOW_SAVEAS | DLG_CUSTOMIZEPALETTE_GENERATE_PALETTE ; return L_DlgCustomizePalette ( hWnd, pDlgParams ) ; } L_INT ShowWindowLevelDialog ( HWND hWnd, pBITMAPHANDLE pBitmap, LPWINDOWLEVELDLGPARAMS pDlgParams ) { L_INT nLowBit = 0 ; L_INT nHighBit = 0 ; L_INT nSize = 0 ; L_INT nLow = 0 ; L_INT nHigh = 0 ; // get min/max bits L_GetMinMaxBits ( pBitmap, &nLowBit, &nHighBit ) ; // get min/max values L_GetMinMaxVal ( pBitmap, &nLow, &nHigh ) ; pBitmap->MinVal = nLow ; pBitmap->MaxVal = nHigh ; nSize = ( L_UINT32 ) ( 1L<< ( nHighBit - nLowBit + 1 ) ) ; pDlgParams->uStructSize = sizeof ( WINDOWLEVELDLGPARAMS ) ; pDlgParams->pBitmap = pBitmap ; pDlgParams->pLUT = ( RGBQUAD L_HUGE* ) malloc ( ( nSize * sizeof ( RGBQUAD ) ) ) ; pDlgParams->uLUTLength = ( L_UINT32 ) nSize ; pDlgParams->uLowBit = nLowBit ; pDlgParams->uHighBit = nHighBit ; pDlgParams->nLow = nLow ; pDlgParams->nHigh = nHigh ; switch ( L_IsGrayScaleBitmap ( pBitmap ) ) { case GRAY_ORDEREDNORMAL: { pDlgParams->crStart = RGB ( 0, 0, 0 ) ; pDlgParams->crEnd = RGB ( 255, 255, 255 ) ; break ; } case GRAY_ORDEREDINVERSE: { pDlgParams->crStart = RGB ( 255, 255, 255 ) ; pDlgParams->crEnd = RGB ( 0, 0, 0 ) ; break ; } case GRAY_NOTORDERED: { pDlgParams->crStart = RGB ( 0, 0, 0 ) ; pDlgParams->crEnd = RGB ( 255, 255, 255 ) ; break ; } default: { MessageBox ( hWnd, TEXT ( "Window Level is not supported for this bitmap order" ), TEXT ( "Window Level Error" ), MB_OK ) ; return FAILURE ; } } pDlgParams->uWindowLevelFlags = FILLLUT_OUTSIDE | FILLLUT_LINEAR ; pDlgParams->uDlgFlags = (fShowPreview?DLG_WINDOWLEVEL_SHOW_PREVIEW:0)| DLG_WINDOWLEVEL_SHOW_TOOL_ZOOMLEVEL | DLG_WINDOWLEVEL_SHOW_RANGE ; return L_DlgWindowLevel( hWnd, pDlgParams ) ; } L_INT ShowICCProfileLoadDialog ( HWND hWnd ) { ICCPROFILEDLGPARAMS dlgParams ; ZeroMemory ( &dlgParams, sizeof ( ICCPROFILEDLGPARAMS ) ) ; dlgParams.uStructSize = sizeof ( ICCPROFILEDLGPARAMS ) ; lstrcpy (dlgParams.szLoadFile, TEXT("C:\\")); lstrcpy (dlgParams.szSaveFile, TEXT("C:\\")); dlgParams.uDlgFlags = DLG_ICCPROFILE_SHOW_LOAD|DLG_ICCPROFILE_SHOW_SAVE ; return L_DlgICCProfile ( hWnd, &dlgParams ) ; } //}} COLOR MENU LEAD COMMON DIALOGS