byron.hopp wrote:
I have been using the TImage class because my scanner hardware died, and the other scanner only produces JPG instead of BMP. However I cannot get the Method RotateImage to work it says message not found, and I cannot seem to resize the image, does this work, or am I doing something wrong.
Thanks,
There are some FreeImage DLLS in which the Rotate function does not appear and the RotateClassic function exists, so to maintain compatibility with previous versions we are going to make the following changes to the class
//----------------------------------------------------------------------------//
METHOD RotateImage( nAngle ) CLASS TImage
local hDib := DibFromBitmap( ::hBitmap )
local cTempFile := cTempFile( , "BMP" )
local lSaved, hBmp
local hOldBmp := ::hBitmap
local hOldPal := ::hPalette
DibWrite( cTempFile, hDib )
GloBalFree( hDib )
hBmp = FIROTATEIMG( cTempFile, nAngle, Self ) // New Last parameter
FErase( cTempFile )
.../...
//----------------------------------------------------------------------------//
Function FIROTATEIMG( cSrcFile, nAngle, oImg ) // Look new last parameter
local nSrcFormat, hDib, hDib2, lOk
local nFormat, hInfoH, hInfo, hBits, hWnd, hDC, hBmp := 0
nSrcFormat := FIGETFILETYPE( cSrcFile, 0 )
hDib := FILOAD( nSrcFormat, cSrcFile, 0 )
IF hDib <> 0
hDib2 := FIRotate( hDib, nAngle )
// New
if !hb_IsNumeric( hDib2 ) .or. hDib2 == 0
hDib2 := FIRotateClassic( hDib, nAngle )
endif
IF hb_IsNumeric( hDib2 ) .and. hDib2 <> 0
hInfoH := FIGETINFOHEADER( hDib2 )
hInfo := FIGETINFO( hDib2 )
hBits := FIGETBITS( hDib2 )
hWnd := oImg:oWnd:hWnd // GETDESKTOPWINDOW()
.../...
//----------------------------------------------------------------------------//
DLL32 FUNCTION FIRotate( hDib AS LONG, nAngle AS _DOUBLE, nColor AS LONG ) AS LONG ;
PASCAL FROM If( IsExe64(), "FreeImage_Rotate", "_FreeImage_Rotate@16" ) ;
LIB hLib
// New Function
DLL32 FUNCTION FIRotateClassic( hDib AS LONG, nAngle AS _DOUBLE ) AS LONG ;
PASCAL FROM If( IsExe64(), "FreeImage_RotateClassic", "_FreeImage_RotateClassic@12" ) ;
LIB hLib
I hope it works properly for you now.