Page 1 of 2
Gluing bitmaps
Posted: Tue Dec 13, 2022 1:03 pm
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 )
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 2:16 pm
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.
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 2:33 pm
by Natter
Paths to C files:\pct1.bmp and C:\pct1 .bmp are written for example only.

Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 3:40 pm
by karinha
Natter wrote:Paths to C files:\pct1.bmp and C:\pct1 .bmp are written for example only.

do you run the .exe as adm?
Regards, saludos.
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 4:36 pm
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)
Re: Gluing bitmaps
Posted: Tue Dec 13, 2022 5:48 pm
by karinha
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 6:15 am
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
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.
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 7:48 am
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
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 8:29 am
by Antonio Linares
Dear Natter,
static hLib must be declared before any code above
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 9:07 am
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 )
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 9:19 am
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

Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 9:49 am
by Natter
Antonio, please, send them to me !

Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 9:57 am
by Antonio Linares
Already sent to your email

Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 10:10 am
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 )
Re: Gluing bitmaps
Posted: Wed Dec 14, 2022 10:14 am
by Antonio Linares
Could you please provide a small PRG to test it here ?
How to reproduce the error ?