FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Gluing bitmaps
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Gluing bitmaps
Posted: Tue Dec 13, 2022 01:03 PM
It seems that under the FW2010 version, the ability to label one bitmap on another has stopped working
Code (fw): Select all Collapse
local bmp1:="C:\pct1.bmp", bmp2:="C:\pct2.bmp"
local hBmp
local img:={FW_ReadImage( nil, bmp1 ), ; // [3],[4] are width and height
                  FW_ReadImage( nil, bmp2 )}

  hBmp := FW_MakeYourBitmap( img[1,3]+10, img[1,4]+6, ;
                  { |hDC, w, h| PaintOverlay( hDC, w, h, img) } )

  PalBmpFree( img[1] )
  PalBmpFree( img[2] )

  FW_SaveImage( hBmp, pr1 ) // cSave can be bmp,jpg,png
When executing the function FW_SaveImage, I get an error:
Error description: Error BASE/1074 Argument error: <=
Args:
[ 1] = P 0x135B0000
[ 2] = N 32

Stack Calls
===========
Called from: .\source\classes\IMAGE.PRG => LOADFREEIMAGE( 505 )
Called from: .\source\classes\IMAGE.PRG => FREEIMAGEISLOADED( 519 )
Called from: .\source\function\IMGTXTIO.PRG => FW_SAVEIMAGE( 2347 )
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 02:16 PM
Intente asi:
Code (fw): Select all Collapse
local bmp1:="C:\TEMP\pct1.bmp", bmp2:="C:\TEMP\pct2.bmp"
no use la unidad C:\

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 02:33 PM
Paths to C files:\pct1.bmp and C:\pct1 .bmp are written for example only. :D
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 03:40 PM
Natter wrote:Paths to C files:\pct1.bmp and C:\pct1 .bmp are written for example only. :D
do you run the .exe as adm?

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 04:36 PM

Karinha, this option worked for years on many computers until I updated the FW version. FreeImage.dll It has nothing to do with it (I checked)

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 05:48 PM
Look this:

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=39876

\samples\OLGA1.PRG

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 06:15 AM
Mr. Natter

I understand you are using xHarbour. Not Harbour.
You are getting the run time error at this line while executing this line in function LoadFreeImage() in image.prg
Code (fw): Select all Collapse
      if hLib <= 32
This is because while using xHarbour, hLib is a pointer but not numeric.
I also agree that this problem was not there in earlier versions. It is because some changes are made in the functions,
LoadLibrary() and FreeLibrary() in this version.

We regret the inconvenience.

Please replace the existing
function LoadFreeImage( cResName )
in the "image.prg"
from lines 492 to 514

with this revised function and try
Code (fw): Select all Collapse
function LoadFreeImage( cResFile )

   DEFAULT cResFile := If( IsExe64(), "freeimage64.dll", "freeimage.dll" )

   if hLib == nil

      #ifdef __CLIPPER__
         hLib = LoadLib32( cResFile )
      #else
         hLib = LoadLibrary( cResFile )
      #endif

      if ValType( hLib ) == "P"
         hLibP = hLib
         hLib = PtrToNum( hLib )
      endif   

      if hLib <= 32
         if !( PROCNAME( 1 ) == "FREEIMAGEISLOADED" )
            MsgAlert( "Cannot load " + If( IsExe64(), "FreeImage64.dll", "FreeImage.dll" ) )
         endif
         hLib  = 0
      endif

   endif

return hLib
Please try with this change.
Honestly, I am yet to try. I will also check and get back if necessary.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 07:48 AM
I tried to run the Load Free Image() function in my program.
I received a message about the absence of the hLib variable.
If you set STATIC hLib, the compilation message will appear - STATIC declaration follows executable statement
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 08:29 AM

Dear Natter,

static hLib must be declared before any code above

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 09:07 AM

Yes, I declared the hLib variable. But the following error occurs:

Error description: Error BASE/1089 Argument error: ABS

Args:

 [   1] = P   0x0

Stack Calls

===========

Called from: => ABS( 0 )

Called from: .\source\classes\IMAGE.PRG => FI_GETFILETYPEFROMFILENAME( 0 )

Called from: .\source\function\IMGTXTIO.PRG => FW_SAVEIMAGE( 2348 )

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 09:19 AM
Dear Natter,

Please recompile FWH\source\classes\image.prg using this dll.ch. Please update FWH\include\dll.ch:
Code (fw): Select all Collapse
// Copyright FiveTech 1993-2022

#ifndef _DLL_CH
#define _DLL_CH

#ifndef _C_TYPES
   #define _C_TYPES
   #define VOID      0
   #define BYTE      1
   #define CHAR      2
   #define WORD      3

#ifdef __CLIPPER__
   #define _INT      4         // conflicts with Clipper Int()
#else
   #define _INT      7
#endif

   #define BOOL      5
   #define HDC       6
   #define LONG      7
   #define STRING    8
   #define LPSTR     9
   #define PTR      10
   #define _DOUBLE  11         // conflicts with BORDER DOUBLE
   #define DWORD    12
   
   #define LONGLONG 13
#endif

#translate NOREF([@]<x>) => <x>

#ifndef __HARBOUR__
  #ifndef __XPP__
     #ifndef __CLIPPER__
        #ifndef __C3__
           #define __CLIPPER__
        #endif
     #endif
  #endif
#endif

#ifndef __CLIPPER__
   #translate DLL32 => DLL
#endif

//----------------------------------------------------------------------------//

#xcommand DLL [<static:STATIC>] FUNCTION <FuncName>( [ <uParam1> AS <type1> ] ;
                                                     [, <uParamN> AS <typeN> ] ) ;
             AS <return> [<pascal:PASCAL>] [ FROM <SymName> ] LIB <*DllName*> ;
       => ;
          [<static>] function <FuncName>( [NOREF(<uParam1>)] [,NOREF(<uParamN>)] ) ;;
             local _hDLL := If( ValType( <DllName> ) == "N", <DllName>, LoadLibrary( <(DllName)> ) ) ;;
             local uResult ;;
             local cFarProc ;;
             local _pOld ;;
             if ValType( _hDLL ) == "P" ;;
               _pOld = _hDLL ;; 
               _hDLL = PtrToNum( _hDLL ) ;;
             end ;;
             if Abs( _hDLL ) > 32 ;;
                cFarProc = GetProcAdd( _hDLL,;
                If( [ Empty( <SymName> ) == ] .t., <(FuncName)>, <SymName> ),;
                [<.pascal.>], <return> [,<type1>] [,<typeN>] ) ;;
                uResult = FWCallDLL( cFarProc [,<uParam1>] [,<uParamN>] ) ;;
                if ! Empty( _pOld ) ;;
                   _hDLL = _pOld ;;
                end ;;   
                If( ValType( <DllName> ) == "N",, FreeLibrary( _hDLL ) ) ;;
             else ;;
                MsgAlert( "Error code: " + LTrim( Str( _hDLL ) ) + " loading " + ;
                If( ValType( <DllName> ) == "C", <DllName>, Str( <DllName> ) ) ) ;;
             end ;;
          return uResult

//----------------------------------------------------------------------------//

#xcommand DLL32 [<static:STATIC>] FUNCTION <FuncName>( [ <uParam1> AS <type1> ] ;
                                                     [, <uParamN> AS <typeN> ] ) ;
             AS <return> [<pascal:PASCAL>] [ FROM <SymName> ] LIB <*DllName*> ;
       => ;
          [<static>] function <FuncName>( [NOREF(<uParam1>)] [,NOREF(<uParamN>)] ) ;;
             local _hDLL := If( ValType( <DllName> ) == "N", <DllName>, LoadLib32( <(DllName)> ) ) ;;
             local uResult ;;
             local cFarProc ;;
             local _pOld ;;
             if ValType( _hDLL ) == "P" ;;
               _pOld = _hDLL ;; 
               _hDLL = PtrToNum( _hDLL ) ;;
             end ;;
             if Abs( _hDLL ) > 32 ;;
                cFarProc = GetProcAdd32( _hDLL,;
                If( [ Empty( <SymName> ) == ] .t., <(FuncName)>, <SymName> ),;
                [<.pascal.>], <return> [,<type1>] [,<typeN>] ) ;;
                uResult = FWCallDLL32( cFarProc [,<uParam1>] [,<uParamN>] ) ;;
                if ! Empty( _pOld ) ;;
                   _hDLL = _pOld ;;
                end ;;   
                If( ValType( <DllName> ) == "N",, FreeLib32( _hDLL ) ) ;;
             else ;;
                MsgAlert( "Error code: " + LTrim( Str( _hDLL ) ) + " loading " + ;
                If( ValType( <DllName> ) == "C", <DllName>, Str( <DllName> ) ) ) ;;
             end ;;
          return uResult

//----------------------------------------------------------------------------//
If you don't know how to do it, or you prefer to use ours libs, then I will send them to you :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 09:49 AM
Antonio, please, send them to me ! :|
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 09:57 AM
Already sent to your email :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 10:10 AM

I replaced the libraries.

Error description: Error BASE/1099 Argument error: STR

Args:

 [   1] = U

 [   2] = U

 [   3] = U

Stack Calls

===========

Called from: => STR( 0 )

Called from: .\source\classes\IMAGE.PRG => FI_GETFILETYPEFROMFILENAME( 0 )

Called from: .\source\function\IMGTXTIO.PRG => FW_SAVEIMAGE( 2348 )

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 10:14 AM

Could you please provide a small PRG to test it here ?

How to reproduce the error ?

regards, saludos

Antonio Linares
www.fivetechsoft.com