Bad quality with GIF (and GDI+)

User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by nageswaragunupudi »

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: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by nageswaragunupudi »

Just sent you revised libs.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by nageswaragunupudi »

Please try:

Code: Select all | Expand

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
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

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

EMG
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by nageswaragunupudi »

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

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
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

Rao,

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

Code: Select all | Expand

#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: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Bad quality with GIF (and GDI+)

Post by Enrico Maria Giordano »

Enrico Maria Giordano wrote:Rao,

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

Code: Select all | Expand

#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
Post Reply