FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bad quality with GIF (and GDI+)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Bad quality with GIF (and GDI+)
Posted: Wed Nov 04, 2015 08:54 PM
Enrico Maria Giordano wrote:Probably I'm doing something wrong but it doesn't work (GIFs are still bad rendered).

EMG

With what control are you testing?
Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Wed Nov 04, 2015 09:06 PM

Just loading with GDIP_IMAGEFROMFILE().

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Bad quality with GIF (and GDI+)
Posted: Wed Nov 04, 2015 09:21 PM

Just sent you revised libs.

Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Wed Nov 04, 2015 09:47 PM

Received and already reported back.

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Bad quality with GIF (and GDI+)
Posted: Wed Nov 04, 2015 09:50 PM
Please try:
Code (fw): Select all Collapse
function testgif()

   local cFile    := "c:\fwh\gifs\magic10.gif"
   local hBmp, oWnd

   hBmp     := GDIP_IMAGEFROMFILE( cFile, .t. )

   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd CENTERED ON PAINT oWnd:SayPalBmp( hBmp )

   DeleteObject( hBmp )

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Wed Nov 04, 2015 10:02 PM

I was not clear enough. The misalignment is between ResizeImg() and ResizeBmp().

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Bad quality with GIF (and GDI+)
Posted: Wed Nov 04, 2015 10:31 PM
I hope the quality issue is now resolved.

In any case, FWH libs are no more using ResizeImg or ResizeBmp for rendering resized images, except for Gray images. Whether both methods differ by a pixel or not now remains an academic issue. With your help, we now added resize width, height as 6,7th params to ABPaint()

Secondly, for bmp files FWH is using classic GDI but not GDI+. So for magic.bmp the FWH is using PalBmpRead() / ReadBmp()
oWnd:ReadPalBmpEx( uSource ) -> aBmpPal reads the image using the appropriate functions.
oWnd:SayPalBmp( aBmpPal/hBitmap, [aRect (default ClientRect)], [lTransparent (default .t. )], [lStretch/nResizeMode], [nAlpha/lAlpha],[lGray] )
paints the image using the appropriate painting function eg. ABPaint(), TransBmp(),PalBmpDraw()

For the sample you sent me, I suggest using FWH methods like this:
Code (fw): Select all Collapse
function magicbmp()

   local oDlg, aBmp
   local cFile := "c:\fwh\bitmaps\magic.bmp"

   DEFINE DIALOG oDlg SIZE 800,600 PIXEL

   aBmp  := oDlg:ReadPalBmpEx( cFile )

   ACTIVATE DIALOG oDlg ON PAINT ;
      oDlg:SayPalBmp( aBmp, ;
                      nil, ;  // Default full client Rect
                      .f., ;  // transparency
                      .t. )   // Stretch full ( .f. or nil -> centers image )

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Thu Nov 05, 2015 09:57 AM
Rao,

ok for the quality issue. But saving to GIF still give bad result:

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL cSrcImage := "c:\fwh\bitmaps\magic.bmp"
    LOCAL cDstImage := "magic.gif"

    LOCAL oGdi := GDIBmp():New( cSrcImage )

    oGdi:Save( cDstImage )

    oGdi:End()

    RETURN NIL


EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Thu Nov 05, 2015 09:58 AM

Rao,

you showed us your face, at last! :-D

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bad quality with GIF (and GDI+)
Posted: Fri Nov 06, 2015 03:41 PM
Enrico Maria Giordano wrote:Rao,

ok for the quality issue. But saving to GIF still give bad result:

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL cSrcImage := "c:\fwh\bitmaps\magic.bmp"
    LOCAL cDstImage := "magic.gif"

    LOCAL oGdi := GDIBmp():New( cSrcImage )

    oGdi:Save( cDstImage )

    oGdi:End()

    RETURN NIL


EMG


Any news? :-)

EMG

Continue the discussion