FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bad quality with GIF (and GDI+)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Sun Nov 01, 2015 12:02 PM

And we need a solution for loading GIF too.

EMG

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bad quality with GIF (and GDI+)
Posted: Sun Nov 01, 2015 12:19 PM

when they loaded look good right?

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Sun Nov 01, 2015 12:59 PM

No. As I already wrote, with FILoadImage() the GIFs look fine while with GDIP_LOADFROMFILE() don't.

EMG

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bad quality with GIF (and GDI+)
Posted: Sun Nov 01, 2015 06:00 PM
For me work fine .. ¿?
My code :
gif used for sample https://www.dropbox.com/s/mzibdx1j1h0lo ... 0.gif?dl=0
We show the image at 2X size to appreciate pixels
Code (fw): Select all Collapse
Function Main ()
local ownd
local oimg

 DEFINE WINDOW oWnd TITLE "Testing GDI+ Class" FROM 5,5 TO 500, 890 PIXEL ;
 COLOR CLR_GRAY, CLR_GRAY
   
    @ 20,12 button "crear" size 40,20 pixel Action  oBmpLoadFromFile( oImg, 640, 400 )    
 
    @ 20 ,130 Button "salir" Action ownd:end() size 40,20 pixel
      
    @ 3, 28 BITMAP oimg  FILE "" size 640,400 of oWnd

   ACTIVATE WINDOW oWnd 

Return (nil)


Function oBmpLoadFromFile( oBmp, nWidth, nHeight )
local hBmpOld := oBmp:hBitmap
local hPalOld  := oBmp:hPalette
local ohBmp 
local hBmp := 0
local cFile:= cGetfile("coge","*.*")
 if ! Empty( cFile )
   ohBmp := GDIBmp():new(cFile)   
    if ( ! Empty( nWidth ) .or. ! Empty( nHeight ) )
        ohBmp:Resize( nWidth, nHeight )
    endif
    hBmp := ohBmp:GetGDIHbitmap()   
    ohBmp:End()   
 endif 
 oBmp:hBitmap  := hBmp      
 oBmp:hPalette := 0
 
  if ! Empty( hBmpOld )
     PalBmpFree( hBmpOld, hPalOld )
 endif
 
  obmp:HasAlpha()
  obmp:refresh()
  
RETURN nil
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Sun Nov 01, 2015 06:25 PM

Please open the GIF with any image viewer and compare with your sample. You'll see the difference.

EMG

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 07:49 AM
Enrico ,I do not find significant differences.
Paste a screenshot with 4 images. top-left gdi+ , bottom-left freeimage , top-right pixelformer and bottom-right viewer macOsx.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 08:51 AM

Too small to see any differences. Anyway, try to send me your EXE to test it here.

EMG

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 10:03 AM

the program :
for jpg,gif,tif,bmp,ico files

https://www.dropbox.com/s/sr2lij7jughmh ... 4.rar?dl=0

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 10:19 AM

Your EXE seems to work fine! Can I have the source code, please? The one that you gave me is different.

EMG

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 10:47 AM

Enrico , code here :https://www.dropbox.com/s/tpbv93i3gxv187y/gdiplus4.prg?dl=0
with emf fines work fine also.

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 10:53 AM

Ok, it doesn't work fine here. So you are not using the official FWH build 4 from Fivetech website, right?

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 11:26 AM

1) If a programmer prefers to use FreeImage, he can set UseGDI( .f. ). We provided this toggle so that the programmer can choose what he considers better.

2) Mr EMG is comparing the GDI+ code as adopted by FWH with the quality of FreeImage.

3) Possible that Mr Manuel has improved code. If Mr Manuel feels FWH code needs improvement, we would be glad to incorporate his contribution.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 11:36 AM

Enrico , All code uses the official version fwh build 4 .

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 11:41 AM

So I'm lost. I don't know what the difference could be. I'm using official FWH build 4 and BCC 7.1. Tried with Harbour and xHarbour. :-(

EMG

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bad quality with GIF (and GDI+)
Posted: Mon Nov 02, 2015 11:45 AM

enrico , please send your exe file to compare here. I use harbour , bcc7 and fwh 15.09 build4 also. ¿? :-(