Rotate BMP

Rotate BMP

Postby Silvio » Wed Jan 20, 2010 12:15 pm

CAn I rotate an Bitmaps ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Rotate BMP

Postby StefanHaupt » Wed Jan 20, 2010 6:30 pm

Silvio,

with FreeImage you can rotate images.

Sample:
Code: Select all  Expand view


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)


DLL32 STATIC FUNCTION FIInitialise( lLoadPlug AS LONG) AS VOID;
      PASCAL FROM "_FreeImage_Initialise@4" LIB hLib

DLL32 STATIC FUNCTION FIDeInitialise(  ) AS VOID;
      PASCAL FROM "_FreeImage_DeInitialise@0" LIB hLib

DLL32 STATIC FUNCTION FIGetWidth ( hDib AS LONG ) AS LONG;
      PASCAL FROM "_FreeImage_GetWidth@4" LIB hLib

DLL32 STATIC FUNCTION FIGetHeight ( hDib AS LONG ) AS LONG;
      PASCAL FROM "_FreeImage_GetHeight@4" LIB hLib

DLL32 STATIC FUNCTION FIRotate ( hDib AS LONG, nAngle AS _DOUBLE ) AS LONG;
      PASCAL FROM "_FreeImage_RotateClassic@12" LIB hLib

DLL32 STATIC FUNCTION FIRotateEX ( hDib AS LONG, nAngle AS _DOUBLE, x_Shift AS _DOUBLE,y_Shift AS _DOUBLE,;
                                   x_Orig AS _DOUBLE, y_Orig AS _DOUBLE, lMask AS BOOL ) AS LONG;
      PASCAL FROM "_FreeImage_RotateEx@48" LIB hLib
 
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Rotate BMP

Postby devtuxtla » Tue Jan 26, 2010 3:09 am

Hi Stefan

Could you give an example and complete with all variables defined?

Thanks
Visite Chiapas, el paraiso de México.
devtuxtla
 
Posts: 392
Joined: Tue Jul 29, 2008 1:55 pm

Re: Rotate BMP

Postby StefanHaupt » Tue Jan 26, 2010 9:13 am

Hi,

sorry, this is the only sample I have. I didn´t use this function so far.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 87 guests

cron