diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fd6751cd62..02a5e1fc84 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,26 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-05-28 22:41 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * source/hbpcre/cnv_o2hb.bat + * source/hbpcre/cnv_hb2o.bat + + Added COPYING + + * contrib/hbfimage/tests/fitest.prg + * contrib/hbfimage/fi_wrp.c + + Added FI_LOADFROMMEM(), FI_GETFILETYPEFROMMEM() + ; Borrowed from Pavel Tsarenko / xhb. + + * contrib/hbclipsm/gauge.c + % Minor rearrangement. + + * contrib/hbmysql/make_vc.bat + ! #defining __WIN32__ to make it build under VC. + + ; NOTE: C++ builds of everything related to OLE2 + are broken. Could someone look into it? + (hbw32, gtwvg, hbole under BCC and MSVC) + 2008-05-28 21:53 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/Makefile * respect HB_WITHOUT_ODBC and HB_WITHOUT_ADS envvars diff --git a/harbour/contrib/hbclipsm/gauge.c b/harbour/contrib/hbclipsm/gauge.c index a10303dea9..8235126763 100644 --- a/harbour/contrib/hbclipsm/gauge.c +++ b/harbour/contrib/hbclipsm/gauge.c @@ -68,7 +68,45 @@ #define B_BOXLINES "ÚÄ¿³ÙÄÀ³" -static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent ); +static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent ) +{ + int iCenter = ( ( hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) ) / 2 ) + 1; + int iRatio = hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) - 1; + int iRow; + int iCols; + int iMax; + char szOldColor[ CLR_STRLEN ]; + char * szStr = " "; + char szPct[ 4 ]; + + hb_gtGetColorStr( szOldColor ); + hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BARCOLOR ) ); + + fPercent = ( fPercent < 0 ? 0 : ( fPercent > 1 ? 1 : fPercent ) ); + iCols = (int) (fPercent * iRatio); + + if( hb_arrayGetL( pArray, B_DISPLAYNUM ) ) + { + /* sprintf( szPct, "%3.0f\%", fPercent * 100 ); */ + sprintf( szPct, "%3.0f%%", fPercent * 100 ); + hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ), + (USHORT) iCenter + 2, (BYTE *) szPct, 4 ); + } + + hb_gtBox( hb_arrayGetNI( pArray, B_TOP ) + 1, hb_arrayGetNI( pArray, B_LEFT ) + 1, + hb_arrayGetNI( pArray, B_BOTTOM ) - 1, hb_arrayGetNI( pArray, B_RIGHT ) - 1, + ( BYTE * ) szStr ); + + iMax = hb_arrayGetNL( pArray, B_BOTTOM ) - hb_arrayGetNL( pArray, B_TOP ) - 1; + for( iRow = 1; iRow <= iMax; iRow++ ) + { + hb_gtRepChar( (USHORT) (iRow + hb_arrayGetNL( pArray, B_TOP )), + (USHORT) (hb_arrayGetNL( pArray, B_LEFT ) + 1), + ( BYTE ) * hb_arrayGetCPtr( pArray, B_BARCHAR ), iCols ); + } + + hb_gtSetColorStr( szOldColor ); +} /* GaugeNew( , , , , [], @@ -153,43 +191,3 @@ HB_FUNC( GAUGEUPDATE ) hb_itemReturn( pArray ); } } - -static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent ) -{ - int iCenter = ( ( hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) ) / 2 ) + 1; - int iRatio = hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) - 1; - int iRow; - int iCols; - int iMax; - char szOldColor[ CLR_STRLEN ]; - char * szStr = " "; - char szPct[ 4 ]; - - hb_gtGetColorStr( szOldColor ); - hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BARCOLOR ) ); - - fPercent = ( fPercent < 0 ? 0 : ( fPercent > 1 ? 1 : fPercent ) ); - iCols = (int) (fPercent * iRatio); - - if( hb_arrayGetL( pArray, B_DISPLAYNUM ) ) - { - /* sprintf( szPct, "%3.0f\%", fPercent * 100 ); */ - sprintf( szPct, "%3.0f%%", fPercent * 100 ); - hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ), - (USHORT) iCenter + 2, (BYTE *) szPct, 4 ); - } - - hb_gtBox( hb_arrayGetNI( pArray, B_TOP ) + 1, hb_arrayGetNI( pArray, B_LEFT ) + 1, - hb_arrayGetNI( pArray, B_BOTTOM ) - 1, hb_arrayGetNI( pArray, B_RIGHT ) - 1, - ( BYTE * ) szStr ); - - iMax = hb_arrayGetNL( pArray, B_BOTTOM ) - hb_arrayGetNL( pArray, B_TOP ) - 1; - for( iRow = 1; iRow <= iMax; iRow++ ) - { - hb_gtRepChar( (USHORT) (iRow + hb_arrayGetNL( pArray, B_TOP )), - (USHORT) (hb_arrayGetNL( pArray, B_LEFT ) + 1), - ( BYTE ) * hb_arrayGetCPtr( pArray, B_BARCHAR ), iCols ); - } - - hb_gtSetColorStr( szOldColor ); -} diff --git a/harbour/contrib/hbfimage/fi_wrp.c b/harbour/contrib/hbfimage/fi_wrp.c index 3c6a38024b..3214d4f899 100644 --- a/harbour/contrib/hbfimage/fi_wrp.c +++ b/harbour/contrib/hbfimage/fi_wrp.c @@ -355,6 +355,51 @@ HB_FUNC( FI_UNLOAD ) // -------------------------------------------------------------------------- // Load / Save routines ----------------------------------------------------- // -------------------------------------------------------------------------- +// DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); +// DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0)); +// DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream); +HB_FUNC( FI_LOADFROMMEM ) +{ + if ( hb_pcount() == 3 && + hb_parinfo( 1 ) & HB_IT_NUMERIC && + hb_parinfo( 2 ) & HB_IT_STRING && + hb_parinfo( 3 ) & HB_IT_NUMERIC + ) + { + FIBITMAP *dib; + FREE_IMAGE_FORMAT fif; + FIMEMORY *stream; + BYTE *szImage; + int flags; + + /* Retrieve parameters */ + fif = (FREE_IMAGE_FORMAT) hb_parni( 1 ); + szImage = hb_parcx( 2 ); + flags = hb_parni( 3 ); + + /* run function */ + stream = FreeImage_OpenMemory( szImage, hb_parclen(2) ); + dib = FreeImage_LoadFromMemory(fif, stream, flags); + FreeImage_CloseMemory( stream ); + + /* return value */ + if ( dib != NULL ) + { + hb_retptr( dib ); + } + + } + else + { + // Parameter error + { + hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, + "FI_LOADFROMMEM", 3, + hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); + return; + } + } +} // DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0)); HB_FUNC( FI_LOAD ) @@ -847,6 +892,37 @@ HB_FUNC( FI_GETFILETYPE ) // DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0)); // DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0)); // DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0)); +HB_FUNC( FI_GETFILETYPEFROMMEM ) +{ + if ( hb_pcount() >= 1 && + hb_parinfo( 1 ) & HB_IT_STRING + ) + { + BYTE * szImage; + FIMEMORY *stream; + int size; + + /* Retrieve parameters */ + szImage = hb_parcx( 1 ); + stream = FreeImage_OpenMemory( szImage, hb_parclen(1) ); + size = ( hb_parinfo( 2 ) & HB_IT_NUMERIC ? hb_parni( 1 ) : 0 ); + + /* run function & return value */ + hb_retni( FreeImage_GetFileTypeFromMemory(stream, size) ); + FreeImage_CloseMemory( stream ); + + } + else + { + // Parameter error + { + hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, + "FI_GETFILETYPE", 1, + hb_paramError( 1 ) ); + return; + } + } +} // -------------------------------------------------------------------------- // Image type request routine ----------------------------------------------- diff --git a/harbour/contrib/hbfimage/tests/fitest.prg b/harbour/contrib/hbfimage/tests/fitest.prg index 97657fe32e..f6f0eeb9b4 100644 --- a/harbour/contrib/hbfimage/tests/fitest.prg +++ b/harbour/contrib/hbfimage/tests/fitest.prg @@ -9,7 +9,9 @@ */ #include "FreeImage.ch" + #include "common.ch" +#include "fileio.ch" #define IMAGES_IN "" #define IMAGES_OUT "images_out/" @@ -45,14 +47,15 @@ PROCEDURE Main() ? "Version :", fi_GetVersion() ? "Copyright :", fi_GetCopyrightMessage() ? "File type :", fi_GetFileType( IMAGES_IN + "sample1.jpg" ) - ? "Load JPEG" - im := fi_Load( FIF_JPEG, IMAGES_IN + "sample1.jpg", JPEG_DEFAULT ) + ? "Load JPEG directly from file" + im := fi_Load( FIF_JPEG, IMAGES_IN + "sample1.jpg", JPEG_DEFAULT ) + ? "Clone image" clone := fi_Clone( im ) - + ? "Pointer :", ValToPrg( im ) - + ? "Image Type :", fi_GetImageType( im ) ? "Color Used :", fi_GetColorsUsed( im ) ? "Pixel size :", fi_GetBPP( im ) @@ -73,84 +76,84 @@ PROCEDURE Main() ? "Save BMP ? :", fi_Save( FIF_BMP , im, IMAGES_OUT + "sample1.bmp", BMP_DEFAULT ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im, IMAGES_OUT + "sample1.jpg", JPEG_DEFAULT ) ? "Save PNG ? :", fi_Save( FIF_PNG , im, IMAGES_OUT + "sample1.png", PNG_DEFAULT ) - + ? "Save TIFF ? :", fi_Save( FIF_TIFF, clone, IMAGES_OUT + "sample1.tif", TIFF_DEFAULT ) ? "Flip Horizontal ?:", fi_FlipHorizontal( clone ) ? "Save JPG ? :", fi_Save( FIF_JPEG, clone, IMAGES_OUT + "horizontal.jpg", JPEG_DEFAULT ) ? "Flip Vertical ? :", fi_FlipVertical( clone ) ? "Save JPG ? :", fi_Save( FIF_JPEG, clone, IMAGES_OUT + "vertical.jpg", JPEG_DEFAULT ) - + ? "Rotate Classic :", ValToPrg( rotated := fi_RotateClassic( clone, 90 ) ) ? "Save JPG ? :", fi_Save( FIF_JPEG, rotated, IMAGES_OUT + "rotate.jpg", JPEG_DEFAULT ) fi_Unload( rotated ) - + centerx := fi_GetWidth( clone ) / 2 centery := fi_GetHeight( clone ) / 2 ? "Rotate Ex :", ValToPrg( rotatedEx := fi_RotateEx( clone, 15, 0, 0, centerx, centery, TRUE ) ) ? "Save JPG ? :", fi_Save( FIF_JPEG, rotatedEx, IMAGES_OUT + "rotateEx.jpg", JPEG_DEFAULT ) fi_Unload( rotatedEx ) - + width := fi_GetWidth( im ) height := fi_GetHeight( im ) - + ? "Rescale :", ValToPrg( rescale := fi_Rescale( im, width / 2, height / 2, FILTER_BICUBIC ) ) ? "Save JPG ? :", fi_Save( FIF_JPEG, rescale, IMAGES_OUT + "rescale.jpg", JPEG_DEFAULT ) fi_Unload( rescale ) - + im2 := fi_Clone( im ) ? "Adjust Gamma ? :", fi_AdjustGamma( im2, 3.0 ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im2, IMAGES_OUT + "adjgamma.jpg", JPEG_DEFAULT ) fi_Unload( im2 ) - + im2 := fi_Clone( im ) ? "Adjust Brightness:", fi_AdjustBrightness( im2, -30 ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im2, IMAGES_OUT + "adjbright.jpg", JPEG_DEFAULT ) fi_Unload( im2 ) - + im2 := fi_Clone( im ) ? "Adjust Contrast ?:", fi_AdjustContrast( im2, -30 ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im2, IMAGES_OUT + "adjcontrast.jpg", JPEG_DEFAULT ) fi_Unload( im2 ) - + im2 := fi_Clone( im ) ? "Invert ? :", fi_Invert( im2 ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im2, IMAGES_OUT + "invert.jpg", JPEG_DEFAULT ) fi_Unload( im2 ) - + ? "Red Channel :", ValToPrg( im2 := fi_GetChannel( im, FICC_RED ) ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im2, IMAGES_OUT + "red.jpg", JPEG_DEFAULT ) fi_Unload( im2 ) - + ? "Green Channel :", ValToPrg( im2 := fi_GetChannel( im, FICC_GREEN ) ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im2, IMAGES_OUT + "green.jpg", JPEG_DEFAULT ) fi_Unload( im2 ) - + ? "Blue Channel :", ValToPrg( im2 := fi_GetChannel( im, FICC_BLUE ) ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im2, IMAGES_OUT + "blue.jpg", JPEG_DEFAULT ) fi_Unload( im2 ) - + ? "Copy :", ValToPrg( im2 := fi_Copy( im, 300, 100, 800, 200 ) ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im2, IMAGES_OUT + "copy.jpg", JPEG_DEFAULT ) - + im3 := fi_Clone( im ) ? "Paste ? :", fi_Paste( im3, im2, 10, 10, 70 ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im3, IMAGES_OUT + "paste.jpg", JPEG_DEFAULT ) fi_Unload( im2 ) fi_Unload( im3 ) - + ? "Allocate Bitmap :", ValToPrg( im3 := fi_AllocateT( FIT_BITMAP, 320, 200, 32 ) ) ? "Save JPG ? :", fi_Save( FIF_JPEG, im3, IMAGES_OUT + "allocate.jpg", JPEG_DEFAULT ) fi_Unload( im3 ) - + ? "Create ERROR :" ? "Save GIF ? :", fi_Save( FIF_GIF, im, IMAGES_OUT + "wrong.gif", 0 ) - + //? ValToPrg( fi_GetInfoHeader( im ) ) //bmpinfoheader:Buffer( fi_GetInfoHeader( im ), TRUE ) //bmpinfoheader:Pointer( fi_GetInfoHeader( im ) ) //? "Header :", ValToPrg( bmpinfoheader ) //? bmpinfoheader:SayMembers(" ", .t., .t.) - + //bmpinfo:Pointer( fi_GetInfo( im ) ) ? "Info :", ValToPrg( bmpinfo ) //? bmpinfo:SayMembers(" ", .t., .t.) @@ -158,42 +161,58 @@ PROCEDURE Main() //? ValType( bmpinfo:Devalue() ) //Tracelog( "bmpinfoheader", ValToPrg( bmpinfoheader ), ; // bmpinfoheader:SayMembers(, .t.), bmpinfoheader:Value(), bmpinfoheader:DeValue(), hb_dumpvar( bmpinfoheader:Array() ), hb_dumpvar( bmpinfoheader:acMembers ) ) - + //appo := bkcolor:Value() //? bkcolor:Pointer( fi_GetBackgroundColor( im ) ) //? fi_GetBackgroundColor( im, @bkcolor:Value() ) //bkcolor:Buffer( appo ) //? bkcolor:SayMembers(" ", .t., .t.) - + //bkcolor:rgbBlue := 205 //? fi_SetBackgroundColor( im, hb_String2Pointer( bkcolor:Value() ) ) Tracelog("linha 168") //? fi_SetBackgroundColor( im, bkcolor:Value() ) Tracelog("linha 170") //? bkcolor:SayMembers(" ", .t., .t.) -Tracelog("linha 162") -// ? bkcolor:Pointer( fi_GetBackgroundColor( im ) ) + Tracelog("linha 162") + //? bkcolor:Pointer( fi_GetBackgroundColor( im ) ) //? fi_GetBackgroundColor( im, @bkcolor:Value() ) //bkcolor:Buffer( appo ) -Tracelog("linha 176") + Tracelog("linha 176") //? bkcolor:SayMembers(" ", .t., .t.) - -Tracelog("linha 179") + + Tracelog("linha 179") //iccprofile:Pointer( fi_GetICCProfile( im ) ) Tracelog("linha 181") //? "Header :", ValToPrg( iccprofile ) Tracelog("linha 183") //? iccprofile:SayMembers(" ", .t., .t.) - + //bmpinfoheader:Reset() //appo := NIL //bmpinfoheader := NIL //hb_GCAll( .T. ) - + ? "Unload images from memory" fi_Unload( im ) fi_Unload( clone ) + + // + IF (nH := FOpen(IMAGES_IN + "sample1.jpg")) != F_ERROR + nLen := FSeek(nH, 0, FS_END) + FSeek(nH, 0, FS_SET) + cStr := space(nLen) + fRead(nH, @cStr, nLen) + FClose(nH) + + ? "Load JPEG from memory" + im := fi_LoadFromMem( FIF_JPEG, cStr, JPEG_DEFAULT ) + + ? "Pointer :", ValToPrg( im ) + ? "Image Type :", fi_GetImageType( im ) + ? "Save PNG ? :", fi_Save( FIF_PNG, im, IMAGES_OUT + "sample2.png", PNG_DEFAULT ) + ENDIF //---------------------------// ? "DeInitialise" diff --git a/harbour/contrib/hbmysql/make_vc.bat b/harbour/contrib/hbmysql/make_vc.bat index 9f0118a8bd..7b5cd897d0 100644 --- a/harbour/contrib/hbmysql/make_vc.bat +++ b/harbour/contrib/hbmysql/make_vc.bat @@ -14,7 +14,7 @@ goto POST_EXIT :DIR_OK -set CFLAGS=-I"%MYSQL_DIR%\include" +set CFLAGS=-I"%MYSQL_DIR%\include" -D__WIN32__ set HB_DLL_NAME=libmySQL set HB_DLL_DIR=%MYSQL_DIR%\bin diff --git a/harbour/source/hbpcre/cnv_hb2o.bat b/harbour/source/hbpcre/cnv_hb2o.bat index 3aa1b40b4c..24d8662674 100644 --- a/harbour/source/hbpcre/cnv_hb2o.bat +++ b/harbour/source/hbpcre/cnv_hb2o.bat @@ -21,6 +21,7 @@ rem don't have to mess with this tool. md ori_dst del ori_dst\*.* /Y +copy LICENSE ori_dst\LICENSE copy config.h ori_dst\config.h.generic copy pcre.h ori_dst\pcre.h.generic copy pcreinal.h ori_dst\pcre_internal.h diff --git a/harbour/source/hbpcre/cnv_o2hb.bat b/harbour/source/hbpcre/cnv_o2hb.bat index 4307e52246..eeb2773caf 100644 --- a/harbour/source/hbpcre/cnv_o2hb.bat +++ b/harbour/source/hbpcre/cnv_o2hb.bat @@ -28,6 +28,7 @@ del *.h attrib -R _hbconf.h attrib -R _hbpcreg.c +copy ori_src\LICENSE LICENSE copy ori_src\config.h.generic config.h copy ori_src\pcre.h.generic pcre.h copy ori_src\pcre_internal.h pcreinal.h