can I rotate a BMP ?
----------------------------------
#include "FreeImage.ch" && This should be before of "fivewin.ch"
#include "fivewin.ch"
#include "common.ch"
*************
function main
*************
local cFoto := "FIVEWIN.bmp"
testeimagem( cFoto, 0 )
testeimagem( cFoto, 60 )
testeimagem( cFoto, 90 )
testeimagem( cFoto, 180 )
testeimagem( cFoto, 270 )
cFoto := "FIVEWIN.jpg"
testeimagem( cFoto, 0 )
testeimagem( cFoto, 60 )
testeimagem( cFoto, 90 )
testeimagem( cFoto, 180 )
testeimagem( cFoto, 270 )
RETURN NIL
********************
FUNCTION TesteImagem( cFOTO, ngrau )
********************
LOCAL im, rotated, rotatedEx, cFif, cDef
fi_Initialise()
cFif := iif( at( ".BMP", upper(cFoto) ) > 0, FIF_BMP, FIF_JPEG )
cDef := iif( at( ".BMP", upper(cFoto) ) > 0, BMP_DEFAULT, JPEG_DEFAULT )
cExt := iif( at( ".BMP", upper(cFoto) ) > 0, ".bmp", ".jpg" )
im := fi_Load( cFif, cFOTO, cDef )
msgstop( "Rotate Classic :" + cvaltochar( rotated := fi_RotateClassic( im, ngrau ) ) + CRLF + ;
"Save ? :" + cvaltochar( fi_Save( cFif, rotated, "rotac"+strzero(ngrau,3)+cExt, cDef ) ), "Rotate " + str( ngrau, 3 ) )
fi_Unload( rotated )
centerx := fi_GetWidth( im ) / 2
centery := fi_GetHeight( im ) / 2
msgstop( "Rotate Ex : " + cvaltochar( rotatedEx := fi_RotateEx( im, nGrau, 0, 0, centerx, centery, TRUE ) ) + CRLF + ;
"Save ? : " + cvaltochar( fi_Save( cFif, rotatedEx, "rotae"+strzero(ngrau,3)+cExt, cDef ) ), "RotateEx " + str( ngrau, 3 ) )
fi_Unload( rotatedEx )
fi_unload(im)
fi_Deinitialise()
RETURN(NIL)
For this function you be necessary use the class freeimage of xharbour.org, located in “\xharbour\contrib\freeimage\.."
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 86 guests