L_DlgGIFWebTuner

#include "l_bitmap.h"

L_LTDLG_API L_INT L_DlgGIFWebTuner(hWndOwner, pDlgParams)

L_HWND hWndOwner;

owner of dialog

LPGIFWEBTUNERDLGPARAMS pDlgParams;

pointer to a structure

Displays the GIF Web Tuner dialog box, and gets tuning options used by L_ColorResBitmap, L_FillBitmap, L_SaveBitmap and L_SetBitmapRgnColorRGBRange.

Parameter

Description

hWndOwner

Handle of the window, which owns the dialog.

pDlgParams

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.

Comments

The GIF Web Tuner dialog.

Returns

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

LTDLGWEB
LTDLGKRN
LTDLGUTL
LTDLGCTRL
LTDLGCOM
LTDIS
LTIMG
LTKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

L_DlgInit, L_SaveBitmap, L_DlgPNGWebTuner, L_DlgJPEGWebTuner

Topics:

Dialogs: HTML/Web

 

Using Imaging Common Dialog

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
// 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) 
{ 
   {// TRANSPERANCY 
      if ( pParam->bTransparent ) 
      { 
         COLORREF crTransparentStart ; 
         COLORREF crTransparentEnd ; 
         crTransparentStart = AddTolerance ( pParam->crTransparent, 
         - pParam->nTransparencyTolerance ) ; 
         crTransparentEnd   = AddTolerance ( pParam->crTransparent, 
         pParam->nTransparencyTolerance ) ; 
         // reset 
         L_FreeBitmapRgn ( pBitmap ) ; 
         // set attributes 
         pBitmap->Flags.Transparency = TRUE ; 
         pBitmap->Transparency       = pParam->crTransparent ; 
         // replace colors 
         if ( 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 RESOLUTION 
      L_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 DISK 
      SAVEFILEOPTION 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; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Common Dialog C API Help