Gluing bitmaps

Natter
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Gluing bitmaps

Post by Natter »

It seems that under the FW2010 version, the ability to label one bitmap on another has stopped working

Code: Select all | Expand

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 )
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: Gluing bitmaps

Post by karinha »

Intente asi:

Code: Select all | Expand

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
Natter
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Post by Natter »

Paths to C files:\pct1.bmp and C:\pct1 .bmp are written for example only. :D
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: Gluing bitmaps

Post by karinha »

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
Natter
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Post by Natter »

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)
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: Gluing bitmaps

Post by karinha »

Look this:

http://forums.fivetechsupport.com/viewt ... =3&t=39876

\samples\OLGA1.PRG

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Gluing bitmaps

Post by nageswaragunupudi »

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: Select all | Expand

      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: Select all | Expand

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
Natter
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Post by Natter »

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
User avatar
Antonio Linares
Site Admin
Posts: 42268
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Gluing bitmaps

Post by Antonio Linares »

Dear Natter,

static hLib must be declared before any code above
regards, saludos

Antonio Linares
www.fivetechsoft.com
Natter
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Post by Natter »

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 )
User avatar
Antonio Linares
Site Admin
Posts: 42268
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Gluing bitmaps

Post by Antonio Linares »

Dear Natter,

Please recompile FWH\source\classes\image.prg using this dll.ch. Please update FWH\include\dll.ch:

Code: Select all | Expand

// 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
Natter
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Post by Natter »

Antonio, please, send them to me ! :|
User avatar
Antonio Linares
Site Admin
Posts: 42268
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Gluing bitmaps

Post by Antonio Linares »

Already sent to your email :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Natter
Posts: 1226
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Post by Natter »

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 )
User avatar
Antonio Linares
Site Admin
Posts: 42268
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Gluing bitmaps

Post by Antonio Linares »

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

How to reproduce the error ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply