Gluing bitmaps

Gluing bitmaps

Postby Natter » Tue Dec 13, 2022 1:03 pm

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

Code: Select all  Expand view  RUN
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 )
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Postby karinha » Tue Dec 13, 2022 2:16 pm

Intente asi:

Code: Select all  Expand view  RUN

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

Re: Gluing bitmaps

Postby Natter » Tue Dec 13, 2022 2:33 pm

Paths to C files:\pct1.bmp and C:\pct1 .bmp are written for example only. :D
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Postby karinha » Tue Dec 13, 2022 3: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
User avatar
karinha
 
Posts: 7836
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Gluing bitmaps

Postby Natter » Tue Dec 13, 2022 4: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)
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Postby karinha » Tue Dec 13, 2022 5:48 pm

Look this:

viewtopic.php?f=3&t=39876

\samples\OLGA1.PRG

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7836
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Gluing bitmaps

Postby nageswaragunupudi » Wed Dec 14, 2022 6: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: Select all  Expand view  RUN
     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 view  RUN
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
User avatar
nageswaragunupudi
 
Posts: 10656
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Gluing bitmaps

Postby Natter » Wed Dec 14, 2022 7: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
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Postby Antonio Linares » Wed Dec 14, 2022 8:29 am

Dear Natter,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Gluing bitmaps

Postby Natter » Wed Dec 14, 2022 9: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 )
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Postby Antonio Linares » Wed Dec 14, 2022 9:19 am

Dear Natter,

Please recompile FWH\source\classes\image.prg using this dll.ch. Please update FWH\include\dll.ch:
Code: Select all  Expand view  RUN
// 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Gluing bitmaps

Postby Natter » Wed Dec 14, 2022 9:49 am

Antonio, please, send them to me ! :|
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: Gluing bitmaps

Postby Antonio Linares » Wed Dec 14, 2022 9:57 am

Already sent to your email :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Gluing bitmaps

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

Re: Gluing bitmaps

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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