Estimado Antonio Linares,
Disculpa por la demora. Como mencioné, este es un bug que apareció en mi sistema después de la actualización de 2017.
El bug ocurre en la Function GetStrForImg() de mi sistema, en la línea que llama a FW_ReadImage(). No genera archivo log de error, por eso preparé el ejemplo para análisis.
El bug está, o no, en comentar las líneas del If de la MSVC() function ISXHBCOM().
/*
* Project: errogdi
* File: errogdi.prg
* Description:
* Author:
* Date: 12-01-2025
*/
#Include "fivewin.ch"
Static nWidth := 480
static nHeight := 320
function Main()
Local oDlg, oFont,aImage,cStrImg
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 460,640 PIXEL TRUEPIXEL FONT oFont ;
TITLE "FWH : IMAGE CONVERSION"
@ 10,10 BTNBMP PROMPT "Select Image" SIZE 100,40 PIXEL 2007 CENTER;
ACTION (cStrImg := GetStrForImg(), ;
aImage:LoadFromString(cStrImg ), ;
aImage:Refresh( .t. ), ;
oDlg:Update() )
@ 6,4 IMAGE aImage SIZE 400, 520 OF oDlg
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
Function GetStrForImg() //imagem com melhor qualidade aassim
Local gcFile,cPath:="C:\fwteam\bitmaps\"
Local hImage,cStrImg:='',lTransp,nW,nH
gcFile := cGetFile( "Arquivo de Imagem (bmp,jpg,png)|*.bmp;*.jpg;*.jpeg;*.png|",;
"Selecione a imagem", 4,cPath )
If !Empty(gcFile) .and. File(gcFile)
//nX := 234 //box - 180 + 30%
//nY := 208 //box - 160
lTransp := cFileExt(gcFile) = "png"
//mod1 top
*hImage := FW_ReadImage( nil, gcFile,nil, .F.) //boa qualidade
*hImage[1] := ResizeBmp(hImage[1], nX, nY,.T.)
//mod2 top
*hImage := FW_ReadImage( nil, gcFile,nil, .T.) //muitboa qualidade
*hImage[1] := ResizeBmp(hImage[1], nX, nY,.T.) //f=transparente,t=preto
//Exemplo 3 - Pior de todos
*hImage := FW_ReadImage( nil, gcFile, {nX,nY}, .F. )
//Nos testes esta configuração ficou melhor
//erro é aqui Antonio Linares
hImage := FW_ReadImage(, gcFile,nil, .t.) //boa qualidade
if !Empty(hImage ) .and. !Empty( hImage[ 1 ] )
nW := Max(nWidth,nHeight)
nH := Min(nWidth,nHeight)
If hImage[3] < hImage[4]
nW := Min(nWidth,nHeight)
nH := Max(nWidth,nHeight)
Endif
If hImage[3] > 500
hImage[1] := ResizeBmp(hImage[1], nW, nH, lTransp )
Endif
cStrImg := BmpToStr(hImage[1]) //iguais
Else
MsgStop("Arquivo selecionado está inválido !")
Endif
//cStrImg := FW_ImageToBLOB(hImage[1]) //iguais
Endif
Return cStrImg
**==============================================================================
Function ISXHBCOM() //pertence imgtxtio.prg nativa fivewin
Static lRet:= .t.
// if lRet == nil
// lRet := ( MSVC() > 0 .and. MSVC() <= 1200 ) // VC98
// endif
Return lRet
samples: https://drive.google.com/drive/folders/1tDxpAXayx3xFF1FlMriZwRmxdOtezztI?usp=sharing