#include "l_bitmap.h"
L_LTDLG_API L_INT L_DlgGIFWebTuner(hWndOwner, pDlgParams)
Displays the GIF Web Tuner dialog box, and gets tuning options used by L_ColorResBitmap, L_FillBitmap, L_SaveBitmap and L_SetBitmapRgnColorRGBRange.
Handle of the window, which owns the dialog.
Pointer to a GIFWEBTUNERDLGPARAMS structure to be updated with the values entered by the user through the dialog. Set members of this structure, before calling this function, to set the dialogs initial values.
| Value | Meaning |
|---|---|
| SUCCESS_DLG_OK | The "OK" button was pressed, and the dialog exited successfully. |
| SUCCESS_DLG_CLOSE | The "Close" 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. |
Required DLLs and Libraries
// Example1:L_INT DlgGIFWebTunerFirstExample(HWND hWnd,pBITMAPHANDLE pBitmap){L_INT nRet;GIFWEBTUNERDLGPARAMS DlgParams ;memset ( &DlgParams, 0, sizeof ( GIFWEBTUNERDLGPARAMS ) ) ;DlgParams.uStructSize = sizeof ( GIFWEBTUNERDLGPARAMS ) ;DlgParams.pBitmap = pBitmap ;DlgParams.uDlgFlags = DLG_GIFWEBTUNER_SHOW_EXPORT |DLG_GIFWEBTUNER_SHOW_INFORMATION |DLG_GIFWEBTUNER_SHOW_PREVIEW |DLG_GIFWEBTUNER_SHOW_TOOL_ZOOMLEVEL |DLG_GIFWEBTUNER_SHOW_TOOL_COLORPICKER |DLG_GIFWEBTUNER_SHOW_TRANSPARENCY |DLG_GIFWEBTUNER_SHOW_OPTIONS |DLG_GIFWEBTUNER_SHOW_ADDWINDOWCOLOR ;nRet = L_DlgInit ( DLG_INIT_COLOR ) ;if(nRet != SUCCESS && nRet != ERROR_DLG_ALREADYINITIATED)return nRet;nRet = L_DlgGIFWebTuner ( hWnd, &DlgParams ) ;if(nRet < 1)return nRet;nRet = L_DlgFree () ;if(nRet != SUCCESS)return nRet;return SUCCESS;} ;// Example2:static COLORREF AddTolerance(COLORREF crColor,L_INT nTolerance){L_INT nRed ;L_INT nGreen ;L_INT nBlue ;nRed = max ( min ( ( L_INT ) GetRValue ( crColor ) + nTolerance, 255 ), 0 ) ;nGreen = max ( min ( ( L_INT ) GetGValue ( crColor ) + nTolerance, 255 ), 0 ) ;nBlue = max ( min ( ( L_INT ) GetBValue ( crColor ) + nTolerance, 255 ), 0 ) ;return RGB ( nRed, nGreen, nBlue ) ;}static L_VOID ExportBitmap(L_TCHAR* szFileName,pBITMAPHANDLE pBitmap,LPGIFWEBTUNERDLGPARAMS pParam){{// TRANSPERANCYif ( pParam->bTransparent ){COLORREF crTransparentStart ;COLORREF crTransparentEnd ;crTransparentStart = AddTolerance ( pParam->crTransparent,- pParam->nTransparencyTolerance ) ;crTransparentEnd = AddTolerance ( pParam->crTransparent,pParam->nTransparencyTolerance ) ;// resetL_FreeBitmapRgn ( pBitmap ) ;// set attributespBitmap->Flags.Transparency = TRUE ;pBitmap->Transparency = pParam->crTransparent ;// replace colorsif ( pParam->nTransparencyTolerance >= 0 ){L_SetBitmapRgnColorRGBRange ( pBitmap,crTransparentStart,crTransparentEnd,L_RGN_SET ) ;if (L_BitmapHasRgn ( pBitmap ) ){L_FillBitmap ( pBitmap, pParam->crTransparent ) ;}L_FreeBitmapRgn ( pBitmap ) ;}}}// TRANSPERANCY{// COLOR RESOLUTIONL_UINT32 uFlags ;if ( ( 24 != pParam->nBitsPerPixel ) || ( 0 != pParam->nPalType ) ){uFlags = ( ( pParam->bAddWindowsColors ) && ( CRF_OPTIMIZEDPALETTE == pParam->nPalType ) ) ? CRF_IDENTITYPALETTE : 0 ;uFlags |= pParam->nDitherType ;uFlags |= pParam->nPalType ;L_ColorResBitmap (pBitmap,pBitmap,sizeof(BITMAPHANDLE),pParam->nBitsPerPixel,uFlags,NULL,NULL,pParam->nNumOfColors,NULL,NULL ) ;}}// COLOR RESOLUTION{// SAVE TO DISKSAVEFILEOPTION SaveOptions ;memset ( &SaveOptions, 0, sizeof ( SAVEFILEOPTION ) ) ;if ( pParam->bInterlaced ){SaveOptions.Flags = ESO_INTERLACED ;}L_SaveBitmap (szFileName,pBitmap,FILE_GIF,pParam->nBitsPerPixel,0,&SaveOptions ) ;}// SAVE TO DISK}L_INT DlgGIFWebTunerSecondExample(HWND hWnd,pBITMAPHANDLE pBitmap){L_INT nRet ;GIFWEBTUNERDLGPARAMS DlgParams ;memset ( &DlgParams, 0, sizeof ( GIFWEBTUNERDLGPARAMS ) ) ;DlgParams.uStructSize = sizeof ( GIFWEBTUNERDLGPARAMS ) ;DlgParams.pBitmap = pBitmap ;DlgParams.uDlgFlags = DLG_GIFWEBTUNER_SHOW_INFORMATION |DLG_GIFWEBTUNER_SHOW_PREVIEW |DLG_GIFWEBTUNER_SHOW_TOOL_ZOOMLEVEL |DLG_GIFWEBTUNER_SHOW_TOOL_COLORPICKER |DLG_GIFWEBTUNER_SHOW_TRANSPARENCY |DLG_GIFWEBTUNER_SHOW_OPTIONS |DLG_GIFWEBTUNER_SHOW_ADDWINDOWCOLOR ;nRet = L_DlgInit ( DLG_INIT_COLOR ) ;if(nRet != SUCCESS && nRet != ERROR_DLG_ALREADYINITIATED)return nRet;nRet = L_DlgGIFWebTuner ( hWnd, &DlgParams ) ;L_DlgFree () ;if ( SUCCESS_DLG_OK == nRet ){ExportBitmap (MAKE_IMAGE_PATH(TEXT("tuned.gif")), pBitmap, &DlgParams ) ;}else if (nRet < 1)return nRet;return SUCCESS;}