Bad quality with GIF (and GDI+)

Re: Bad quality with GIF (and GDI+)

Postby nageswaragunupudi » Wed Nov 04, 2015 8: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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Bad quality with GIF (and GDI+)

Postby Enrico Maria Giordano » Wed Nov 04, 2015 9:06 pm

Just loading with GDIP_IMAGEFROMFILE().

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bad quality with GIF (and GDI+)

Postby nageswaragunupudi » Wed Nov 04, 2015 9:21 pm

Just sent you revised libs.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Bad quality with GIF (and GDI+)

Postby Enrico Maria Giordano » Wed Nov 04, 2015 9:47 pm

Received and already reported back.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bad quality with GIF (and GDI+)

Postby nageswaragunupudi » Wed Nov 04, 2015 9:50 pm

Please try:
Code: Select all  Expand view  RUN
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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Bad quality with GIF (and GDI+)

Postby Enrico Maria Giordano » Wed Nov 04, 2015 10:02 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bad quality with GIF (and GDI+)

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

Re: Bad quality with GIF (and GDI+)

Postby Enrico Maria Giordano » Thu Nov 05, 2015 9:57 am

Rao,

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

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bad quality with GIF (and GDI+)

Postby Enrico Maria Giordano » Thu Nov 05, 2015 9:58 am

Rao,

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bad quality with GIF (and GDI+)

Postby Enrico Maria Giordano » Fri Nov 06, 2015 3:41 pm

Enrico Maria Giordano wrote:Rao,

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

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

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

cron