Page 1 of 1

Problemi nella conversione bmp->jpg utilizzando libgfl

PostPosted: Wed Nov 23, 2005 10:54 am
by Marco Turco
Ciao a tutti,
ho creato una funzione di archiviazione digitale documenti nella mia applicazione utilizzando la classe tscan.

Fin qui tutto ok. Il problema inizia quando voglio convertire il file acquisito da scanner da bmp a jpg (molto spesso infatti scanner economici restituiscono un file bmp).
Per la conversione utilizzo libgfl,
ho riscontrato però un problema:
se l'immagine bitmap è a toni di grigio, allora libgfl non riesce a convertirla in jpeg, non da alcun errore e non crea alcun file.

Qualche idea ?
Devo forse intervenire prima della conversione aumentando il numero di colori della bitmap ?

Ho anche verificato la specifiche tecniche della libreria e il formato in questione risulta supportato in scrittura.

La routine di conversione che utilizzo è disponibile su www.softwarexp.co.uk/beta/wmftojpg.prg

Marco

Re: Problemi nella conversione bmp->jpg utilizzando libgf

PostPosted: Wed Nov 23, 2005 1:28 pm
by Enrico Maria Giordano
Convertilo prima in RGB con

GFLCHANGECOLORDEPTH( nGflBitmap, 0, GFL_MODE_TO_RGB, 0 )

EMG

PostPosted: Wed Nov 23, 2005 3:32 pm
by juanito
La classe tscan è inclusa nelle FW?
Dove scaricarla in caso contrario?

PostPosted: Wed Nov 23, 2005 3:51 pm
by Marco Turco
Grazie 1000 EMG, provo subito.

La classe tscan è non è una classe standard FW,
la si può scaricare da www.fivewin.info o www.dbwide.com.ar

Saluti

Marco

PostPosted: Wed Nov 23, 2005 4:02 pm
by juanito
Grazie marco provo su fivewin.info,
avevo già provato su www.dbwide.com.ar ma il sito non funziona :?

PostPosted: Thu Nov 24, 2005 2:31 pm
by juanito
Ho trovato la classe tsca32 di rafa carmona, è quella di cui stiamo parlando o ce n'è un'altra?

// Example scanner, Class TSCAN32 and Wrappers for [x]Harbour

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this software; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
// Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).

// The exception is that, if you link the class Tscan32 and Wrappers C with other
// files to produce an executable, this does not by itself cause the
// resulting executable to be covered by the GNU General Public License.
// Your use of that executable is in no way restricted on account of
// linking the Tscan32 and Wrappers library code into it.

// 2003(c)- Rafa Carmona( Thefull )
//
// interface to Dosadi EZTWAIN library by TheFull
// Interface para la libreria EZTWAIN de Dosadi por TheFull
// 32 bits

// ATENTION. THIS LICENSE NOT APLICATTE A EZTWAIN.
// YOUR VIEW LICENSE EZTW32.DLL IN WWW.DOSADI.COM

#INCLUDE "HBCLASS.CH"


// Returns the TWAIN Protocol State per the spec.
#define TWAIN_PRESESSION 1 // source manager not loaded
#define TWAIN_SM_LOADED 2 // source manager loaded
#define TWAIN_SM_OPEN 3 // source manager open
#define TWAIN_SOURCE_OPEN 4 // source open but not enabled
#define TWAIN_SOURCE_ENABLED 5 // source enabled to acquire
#define TWAIN_TRANSFER_READY 6 // image ready to transfer
#define TWAIN_TRANSFERRING 7 // image in transit

***************************************************************************
*
* CLASS TSCAN32
* 2003(c)- by Rafa Carmona ( TheFull )
* Beta 1.0
* Beta 2.0 New. Support Get ClipBoard to hDib.
* New. ClipboardToFile( cFile ) -> Save File Jpg into Clipboard.
*
* Beta 3.0 New. ReWrite Method End, conflict GPF's ;)
*
*
****************************************************************************

CLASS TSCAN32

DATA hWnd
DATA cFile
DATA hDib
DATA lError INIT .F.
DATA nState

METHOD New( cFile, hWnd ) CONSTRUCTOR
METHOD End()
METHOD Register()
MESSAGE FreeNative METHOD End()
MESSAGE Close METHOD End()

METHOD DigiToFile( cFile )
METHOD DibToJpeg( cFile ) INLINE TW_DibWJpg( ::hDib, cFile )
METHOD DibToBmp( cFile ) INLINE TW_DibWBmp( ::hDib, cFile )
METHOD SetJpegQ( nQuality) INLINE TW_SetJpegQuality( nQuality )// 1..100 Default 75

METHOD Acquire() INLINE TW_Acquire( ::hWnd )
METHOD AcquireClipBoard() INLINE TW_AcquireToClipboard( ::hWnd , 0 )

METHOD OpenDefault()
METHOD OpenSource()
METHOD EnableSource() INLINE TW_EnableSource( ::hWnd )
METHOD Choose() INLINE TW_SelectImageSource()

// ********** Basic TWAIN Inquiries **********************************
METHOD IsAvailable() INLINE IIF( TW_Avail() = 1, .T. , .F. )
METHOD Version() INLINE ( Str( TW_EasyVersion() / 100 ) )
METHOD State() INLINE (::nState := TW_State() )
METHOD SourceName() INLINE TW_SourceName()
METHOD GetSourceName( cName ) INLINE TW_GetSourceName( cName )


//************ Global Options *****************************************
METHOD SetHide( lHide ) INLINE IIF( lHide , TW_SetHideUI(1), TW_SetHideUI(0) )


//-*********** High-level Capability Negotiation Functions **************
// These functions should only be called in State 4 (TWAIN_SOURCE_OPEN)
METHOD PixelType( nType ) INLINE ( ::State(),;
if( ::nState >= TWAIN_SOURCE_OPEN,;
TW_SetCurrentPixelType( nType ),0 ) )
METHOD SetRes( dRes ) INLINE ( ::State(),;
if( ::nState >= TWAIN_SOURCE_OPEN,;
TW_SetCurrentResolution( dRes ),0) )
METHOD SetXRes( dRes ) INLINE TW_SetXResolution( dRes )
METHOD SetYRes( dRes ) INLINE TW_SetYResolution( dRes )
METHOD SetUnits( nUnits ) INLINE TW_SETCURRENTUNITS( nUnits )
METHOD SetContrats( dContrats) INLINE TW_SETCONTRATS( dContrats )
METHOD SetBright( dBright ) INLINE TW_SETBRIGHTNESS( dBright )
METHOD SetPaper( nPaper ) INLINE TW_SETPAPERSIZE( nPaper )
METHOD GetResolution() INLINE TW_GETCURRENTRESOLUTION()


//******** Image Layout (Region of Interest) **********************
METHOD RegionSet( nLeft,nTop, nRigth, nBottom ) INLINE TW_SetImageLayout( nLeft,nTop, nRigth, nBottom )
METHOD RegionReset() INLINE TW_ResetImageLayout()
METHOD RegionGet( L,T,R,B ) INLINE TW_GetImageLayout(@L,@T,@R,@B)
METHOD RegionGetDefault( L,T,R,B ) INLINE TW_GetDefaultImageLayout(@L,@T,@R,@B)

METHOD ClipBoardToFile( cFile )
METHOD DIB_GetFromClipboard() INLINE TW_DIB_GetFromClipboard()

ENDCLASS

***********************************************************
***********************************************************
METHOD New( cFile, hWnd ) CLASS TSCAN32

IF Empty( hWnd )
::hWnd := GetActiveWindow()
ENDIF

IF Empty( cFile )
::cFile := "TestTscan32.jpg"
ELSE
::cFile := cFile
ENDIF


IF !::IsAvailable()
::lError := .T.
// MsgStop( "TWAIN no found","Attention!") // Only Fivewin
ENDIF

IF !::lError
::Register( 1,0,0,0,"1.0 Beta","by Rafa Carmona","Scan by Thefull","Scan For [x]Harbour" )
ENDIF
::OpenSource()
::OpenDefault()

RETURN Self

**********************************************************************
* Comprueba que esta disponible TWAIN y cargalo
**********************************************************************
METHOD OpenSource() CLASS TSCAN32
Local nResult := TW_LoadSourceManager()

DO CASE
CASE nResult = -1
::lError := .T.
// MsgStop("Error Driver TWAIN"," ¿ Insufficient Memory ?")
Return Self
ENDCASE

Return Self

***********************************************************************
* Abre TWAIN el ultimo que fue seleccionado desde Select ..Dialog
* Si no puede cargarlo solicita seleccionar Source.
***********************************************************************
METHOD OpenDefault() CLASS TSCAN32
Local nResult := TW_OpenDefaultSource()

DO CASE
CASE nResult = 0
::Choose()
CASE nResult = -1
::lError := .T.
OTHERWISE
::lError := .F.
ENDCASE

Return Self

**************************************************************************
* Liberamos hDib y cerramos el dispositivo
**************************************************************************
METHOD End() CLASS TSCAN32

if !Empty( ::hDib )
TW_Free( ::hDib )
endif

TW_CloseSourceManager( ::hWnd ) // Close para evitar GPF

Return NIL

***************************************************************************
* Registra la aplicacion
***************************************************************************
METHOD Register( nMajor ,nMinor,nLanguage,nCountry,cVersion,cName,cFamily,cProduct ) CLASS TSCAN32

TW_REGISTERAPP( nMajor ,nMinor,nLanguage,nCountry,;
cVersion,cName,cFamily,cProduct )

Return Self

***********************************************************
* Digitaliza hacia un fichero .jpg
***********************************************************
METHOD DigiToFile( cFile )

if EMPTY( cFile )
cFile := ::cFile
endif

IF !::lError
::hDib := ::Acquire() // Importar
ENDIF

IF !Empty( ::hDib )

IF TW_IsJpg() = 1 // Si puede hacer uso del JPG
::DibToJpeg( cFile )
ELSE
::DibToBmp( cFile ) // Si no hacemos uso de BMP
ENDIF

ENDIF

Return Self


************************************************************************
* Save content clipboard into to file.jpg
************************************************************************
METHOD ClipBoardToFile( cFile ) CLASS TSCAN32
Local hDib, nError

IF Empty( cFile )
::cFile := "TestTscan32.jpg"
ELSE
::cFile := cFile
ENDIF

hDib := ::DIB_GetFromClipboard()


IF !Empty( hDib )

IF TW_IsJpg() = 1 // Si puede hacer uso del JPG
TW_DibWJpg( hDib, ::cFile )
ELSE
TW_DibWBmp( hDib, ::cFile )
ENDIF

TW_Free( hDib )

ENDIF

RETURN Self
/* -----------------------------------------------------------------
Implementation Language C for [x]Harbour(WIN32)
2003(c)- by Rafa Carmona ( TheFull )

Wrappers for EZTW32.DLL the DosAdi.

-------------------------------------------------------------------- */
#pragma BEGINDUMP

#include <windows.h>
#include "eztwain.h"
#include "hbapi.h"


/*--------- Top-Level Calls -------------------------------------*/

HB_FUNC( TW_ACQUIRE ) // hWnd
{
hb_retnl( ( LONG )TWAIN_Acquire( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_FREE ) // hDib
{
TWAIN_FreeNative( ( HANDLE ) hb_parnl( 1 ) );
hb_ret();
}

HB_FUNC( TW_SELECTIMAGESOURCE ) // hWnd
{
hb_retni( TWAIN_SelectImageSource( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_ACQUIRENATIVE ) // hWnd, nPixTypes
{
hb_retnl( ( LONG )TWAIN_AcquireNative( ( HWND ) hb_parnl( 1 ), (unsigned) hb_parni(2) ) );
}

HB_FUNC( TW_ACQUIRETOCLIPBOARD ) // hWnd, nPixTypes
{
hb_retni( TWAIN_AcquireToClipboard( ( HWND ) hb_parnl( 1 ), (unsigned) hb_parni(2) ) );
}

HB_FUNC( TW_ACQUIREMEMORY ) // hWnd
{
hb_retnl( ( LONG )TWAIN_AcquireMemory( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_ACQUIRETOFILENAME ) // hWnd, cFileName
{
hb_retni( TWAIN_AcquireToFilename( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}

HB_FUNC( TW_ACQUIREFILE ) // hWnd, nFF, cFileName
{
hb_retni( TWAIN_AcquireFile( ( HWND ) hb_parnl( 1 ), hb_parni( 2 ) ,hb_parc( 3 ) ) );
}


//--------- Basic TWAIN Inquiries

HB_FUNC( TW_AVAIL )
{
hb_retni( TWAIN_IsAvailable() );
}

HB_FUNC( TW_EASYVERSION)
{
hb_retni( TWAIN_EasyVersion() );
}

HB_FUNC( TW_STATE )
{
hb_retni( TWAIN_State() );
}

HB_FUNC( TW_SOURCENAME )
{
hb_retc( TWAIN_SourceName() );
}

HB_FUNC( TW_GETSOURCENAME ) // pzName
{
TWAIN_GetSourceName( (LPSTR) hb_parc( 1 ) );
hb_ret();
}


//--------- DIB handling utilities ---------

HB_FUNC( TW_DIBWJPG ) // hDib, cName
{
hb_parni( DIB_WriteToJpeg( ( HANDLE ) hb_parnl(1), hb_parc( 2 ) ) );
}

HB_FUNC( TW_DIBWBMP ) // hDib, cName
{
hb_parni( DIB_WriteToBmp( ( HANDLE ) hb_parnl(1), hb_parc( 2 ) ) );
}


//--------- File Read/Write

HB_FUNC( TW_ISJPG )
{
hb_retni( TWAIN_IsJpegAvailable() );
}

HB_FUNC( TW_SETSAVEFORMAT )
{
hb_retni( TWAIN_SetSaveFormat( hb_parni( 1 ) ) );
}

HB_FUNC( TW_GETSAVEFORMAT )
{
hb_retni( TWAIN_GetSaveFormat() );
}

HB_FUNC( TW_SETJPEGQUALITY ) // nQuality 1...100
{
TWAIN_SetJpegQuality( hb_parni( 1 ) );
hb_ret();
}

HB_FUNC( TW_GETJPEGQUALITY )
{
hb_retni( TWAIN_GetJpegQuality() );
}

HB_FUNC( TW_WRITENATIVETOFILENAME )
{
hb_retni( TWAIN_WriteNativeToFilename( (HANDLE) hb_parnl(1), hb_parc(2) ));
}

HB_FUNC( TW_LOADNATIVEFROMFILENAME )
{
hb_retnl( (LONG) TWAIN_LoadNativeFromFilename( hb_parc( 1 ) ) );
}



//--------- Global Options ----------------------------------------------
HB_FUNC( TW_SETMULTITRANSFER )
{
TWAIN_SetMultiTransfer( hb_parni( 1 ) );
hb_ret();
}

HB_FUNC( TW_GETMULTITRANSFER )
{
hb_retni( TWAIN_GetMultiTransfer() );
}

HB_FUNC( TW_SETHIDEUI ) // nHide
{
TWAIN_SetHideUI( hb_parni( 1) );
hb_ret();
}

HB_FUNC( TW_GETHIDEUI )
{
hb_retni( TWAIN_GetHideUI() );
}


HB_FUNC( TW_DISABLEPARENT )
{
TWAIN_DisableParent( hb_parni( 1 ) );
hb_ret();
}

HB_FUNC( TW_GETDISABLEPARENT )
{
hb_retni( TWAIN_GetDisableParent() );
}

HB_FUNC( TW_REGISTERAPP )
{

TWAIN_RegisterApp( hb_parni(1),hb_parni(2),hb_parni(3),hb_parni(4),
hb_parc(5), hb_parc(6),
hb_parc(7), hb_parc(8) );
hb_ret();
}

HB_FUNC( TW_SETAPPTITLE )
{
TWAIN_SetAppTitle( hb_parc( 1 ) );
hb_ret();
}




//--------- TWAIN State Control ---------------------------------------

HB_FUNC( TW_LOADSOURCEMANAGER )
{
hb_retni( TWAIN_LoadSourceManager() );
}

HB_FUNC( TW_OPENSOURCEMANAGER ) // hWnd
{
hb_retni( TWAIN_OpenSourceManager( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_OPENDEFAULTSOURCE )
{
hb_retni( TWAIN_OpenDefaultSource() );
}

HB_FUNC( TW_GETSOURCELIST )
{
hb_retni( TWAIN_GetSourceList() );
}

HB_FUNC( TW_GETNEXTSOURCENAME )
{
hb_retni( TWAIN_GetNextSourceName( hb_parc( 1 ) ) );
}

HB_FUNC( TW_GETDEFAULTSOURCENAME )
{
hb_retni( TWAIN_GetDefaultSourceName( hb_parc( 1 ) ));
}

HB_FUNC( TW_OPENSOURCE )
{
hb_retni( TWAIN_OpenSource( hb_parc( 1 ) ) );
}

HB_FUNC( TW_ENABLESOURCE ) // hWnd
{
hb_retni( TWAIN_EnableSource( ( HWND ) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_DISABLESOURCE )
{
hb_retni( TWAIN_DisableSource( ) );

}

HB_FUNC( TW_CLOSESOURCE )
{
hb_retni( TWAIN_CloseSource() );
}

HB_FUNC( TW_CLOSESOURCEMANAGER )
{
hb_retni( TWAIN_CloseSourceManager( (HWND) hb_parnl( 1 ) ) );
}

HB_FUNC( TW_UNLOADSOURCEMANEGER )
{
hb_retni( TWAIN_UnloadSourceManager() );
}



//--------- High-level Capability Negotiation Functions --------------
// These functions should only be called in State 4 (TWAIN_SOURCE_OPEN)

HB_FUNC( TW_GETCURRENTUNITS )
{
hb_retni( TWAIN_GetCurrentUnits() );
}

HB_FUNC( TW_SETCURRENTUNITS ) // nUnits
{
hb_retni( TWAIN_SetCurrentUnits( hb_parni( 1 ) ) );
}

HB_FUNC( TW_GETBITDEPTH )
{
hb_retni( TWAIN_GetBitDepth() );
}

HB_FUNC( TW_SETBITDEPTH )
{
hb_retni( TWAIN_SetBitDepth( hb_parni( 1 ) ) );
}

HB_FUNC( TW_GETPIXELTYPE )
{
hb_retni( TWAIN_GetPixelType() );
}

HB_FUNC( TW_SETCURRENTPIXELTYPE ) // nBits
{
hb_retni( TWAIN_SetCurrentPixelType( hb_parni( 1 ) ) );
}

HB_FUNC( TW_GETCURRENTRESOLUTION )
{
hb_retnd( TWAIN_GetCurrentResolution());
}

HB_FUNC( TW_GETYRESOLUTION )
{
hb_retnd( TWAIN_GetYResolution());
}

HB_FUNC( TW_SETCURRENTRESOLUTION ) // dRes
{
hb_retni( TWAIN_SetCurrentResolution( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETXRESOLUTION )
{
hb_retni( TWAIN_SetXResolution( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETYRESOLUTION )
{
hb_retni( TWAIN_SetYResolution( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETCONTRATS ) //dCon
{
hb_retni( TWAIN_SetContrast( hb_parnd( 1 ) ) ); // -1000....+1000
}

HB_FUNC( TW_SETBRIGHTNESS ) //dBri
{
hb_retni( TWAIN_SetBrightness( hb_parnd( 1 ) ) ); // -1000....+1000
}

HB_FUNC( TW_SETTHRESHOLD )
{
hb_retni( TWAIN_SetThreshold( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_GETCURRENTTHRESHOLD )
{
hb_retnd( TWAIN_GetCurrentThreshold() );
}

HB_FUNC( TW_SETXFERMECH )
{
hb_retni( TWAIN_SetXferMech( hb_parni( 1 ) ) );
}

HB_FUNC( TW_XFERMECH )
{
hb_retni( TWAIN_XferMech() );
}

HB_FUNC( TW_SUPPORTSFILEXFER )
{
hb_retni( TWAIN_SupportsFileXfer() );
}

HB_FUNC( TW_SETPAPERSIZE ) // nTypePaper
{
hb_retni( TWAIN_SetPaperSize( hb_parni( 1 ) ) );
}

//-------- Document Feeder ---------------------------------

HB_FUNC( TW_HASFEEDER )
{
hb_retl( TWAIN_HasFeeder() );
}

HB_FUNC( TW_ISFEEDERSELECTED )
{
hb_retl( TWAIN_IsFeederSelected() );
}

HB_FUNC( TW_SELECTFEEDER )
{
hb_retni( TWAIN_SelectFeeder( hb_parni( 1 ) ) );
}

HB_FUNC( TW_ISAUTOFEEDON )
{
hb_retl( TWAIN_IsAutoFeedOn() );
}

HB_FUNC( TW_SETAUTOFEDD )
{
hb_retni( TWAIN_SetAutoFeed( hb_parni( 1 ) ) );
}

HB_FUNC( TW_ISFEEDERLOADED )
{
hb_retl( TWAIN_IsFeederLoaded() );
}

//-------- Duplex Scanning ------------------------------------------
HB_FUNC( TW_GETDUPLEXSUPPORT )
{
hb_retni( TWAIN_GetDuplexSupport() );
}

HB_FUNC( TW_ENABLEDUPLEX )
{
hb_retni( TWAIN_EnableDuplex( hb_parni( 1 ) ) );
}

HB_FUNC( TW_ISDUPLEXENABLED )
{
hb_retl( TWAIN_IsDuplexEnabled() );
}

//--------- Other 'exotic' capabilities --------

HB_FUNC( TW_HASCONTROLLABLEUI )
{
hb_retni( TWAIN_HasControllableUI() );
}

HB_FUNC( TW_SETINDICATORS )
{
hb_retni( TWAIN_SetIndicators( hb_parl( 1 ) ) );
}

HB_FUNC( TW_COMPRESSION )
{
hb_retni( TWAIN_Compression() );
}

HB_FUNC( TW_SETCOMPRESSION )
{
hb_retni( TWAIN_SetCompression( hb_parni( 1 ) ) );
}

HB_FUNC( TW_TILED )
{
hb_retl( TWAIN_Tiled() );
}

HB_FUNC( TW_SETTILED )
{
hb_retni( TWAIN_SetTiled( hb_parl( 1 ) ) );
}

HB_FUNC( TW_PLANARCHUNKY )
{
hb_retni( TWAIN_PlanarChunky() );
}

HB_FUNC( TW_SETPLANARCHUNKY )
{
hb_retni( TWAIN_SetPlanarChunky( hb_parni( 1 ) ) );
}

HB_FUNC( TW_PIXELFLAVOR )
{
hb_retni( TWAIN_PixelFlavor() );
}

HB_FUNC( TW_SETPIXELFLAVOR )
{
hb_retni( TWAIN_SetPixelFlavor( hb_parni( 1 ) ) );
}

HB_FUNC( TW_SETLIGHTPATH )
{
hb_retni( TWAIN_SetLightPath( hb_parl( 1 ) ) );
}

HB_FUNC( TW_SETAUTOBRIGHT )
{
hb_retni( TWAIN_SetAutoBright( hb_parl( 1 ) ) );
}

HB_FUNC( TW_SETGAMMA )
{
hb_retni( TWAIN_SetGamma( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETSHADOW )
{
hb_retni( TWAIN_SetShadow( hb_parnd( 1 ) ) );
}

HB_FUNC( TW_SETHIGHLIGHT )
{
hb_retni( TWAIN_SetHighlight( hb_parnd( 1 ) ) );
}
//--------- Image Layout (Region of Interest) --------


HB_FUNC( TW_SETIMAGELAYOUT ) // left, top, right, bottom
{
hb_retni( TWAIN_SetImageLayout( hb_parnd( 1 ),hb_parnd( 2 ),hb_parnd( 3 ),hb_parnd( 4 ) ) );
}

HB_FUNC( TW_RESETIMAGELAYOUT )
{
TWAIN_ResetImageLayout();
hb_ret();
}

HB_FUNC( TW_GETIMAGELAYOUT )
{
double L,T,R,B;
int nRet;

nRet = TWAIN_GetImageLayout( &L,&T,&R,&B );

hb_stornd( L, 1 );
hb_stornd( T, 2 );
hb_stornd( R, 3 );
hb_stornd( B, 4 );
hb_retni( nRet );
}

HB_FUNC( TW_GETDEFAULTIMAGELAYOUT )
{
double L,T,R,B;
int nRet;

nRet = TWAIN_GetDefaultImageLayout( &L, &T, &R, &B);

hb_stornd( L, 1 );
hb_stornd( T, 2 );
hb_stornd( R, 3 );
hb_stornd( B, 4 );
hb_retni( nRet );
}

//HANDLE EZTAPI DIB_GetFromClipboard(void);
HB_FUNC( TW_DIB_GETFROMCLIPBOARD )
{
hb_retnl( (LONG) DIB_GetFromClipboard() );
}

// para no depender de Five, y harbour poder el solito trabajar ;)
HB_FUNC ( GETACTIVEWINDOW )
{
hb_retnl( ( LONG ) GetActiveWindow() );
}

#pragma ENDDUMP

Ciao

PostPosted: Thu Nov 24, 2005 5:09 pm
by Enrico Maria Giordano
Vi prego di limitare il quoting ed in particolare di evitare assolutamente di incollare codice così lungo.

Grazie della collaborazione.

EMG

PostPosted: Fri Nov 25, 2005 9:07 am
by juanito
Enrico,
tu hai ragione, ma c'è un modo per allegare files ad un post come nelle news?
In ogni caso, la classe TScan di cui parla Marco, è quella che o trovato o ne esiste un'altra?
Ciao
Giovanni

PostPosted: Fri Nov 25, 2005 9:54 am
by Enrico Maria Giordano
Potevi semplicemente mandarla direttamente a Marco oppure fornire un link da cui scaricarla. Non era necessario inviarla tutta qui.

EMG

PostPosted: Fri Nov 25, 2005 11:13 am
by juanito
Ok, la prossima volta farò cosi.
Comunque, è quella o no?
Giovanni

PostPosted: Fri Nov 25, 2005 11:29 am
by Enrico Maria Giordano
Non lo so. Ti deve rispondere Marco.

EMG

PostPosted: Fri Nov 25, 2005 4:50 pm
by Marco Turco
Juanito,
la classe è quella che hai scaricato.

Insieme alla classe dovrebbe esserci anche un prg di esempio che ne mostra il funzionamento, se non ci dovesse essere richiedimelo e te lo invio per email.

Se devi fare un uso commerciale della classe ricorda che solo il wrapper scritto da Rafa Carmona è freeware mentre la libreria Eztwain la devi acquistare (il costo è comunque contenuto).

Ciao

Marco

PostPosted: Mon Nov 28, 2005 7:03 pm
by juanito
Grazie Marco, ho scaricato tutto.
Voglio solo fare delle prove, nel caso in cui dovesse servirmi.

Ciao
Giovanni