FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour The new TcoverFlow class and resizing images
Posts: 107
Joined: Tue Sep 15, 2009 07:52 AM
The new TcoverFlow class and resizing images
Posted: Fri Oct 09, 2009 11:41 AM
To all:

I cannot find how to resize JPG images when loading them from disk to fit them in a dialog (to use in the new TCoverFlow class):
Code (fw): Select all Collapse
    FOR i=1 TO my_var
       IF !(client->(DBSEEK(PADR(ALLTRIM(UPPER(CFileNoExt(aFolder[i]))),14,' '))))
         cTexto[1]:="No reference"
       ELSE
         cTexto[1]:="Ref. : "+client->code
       ENDIF
       oImage:LOADIMAGE(, aFolder[i])
       oImage:Resize(oImage:nWidth()/.5,oImage:nHeight()/.5)  //DOES NOT WORK  !!!!!!!!!!
       hBMP:= oImage:hBitmap
       oCF:AddCoverH( hBMP, cTexto[1], CLR_YELLOW )
     NEXT i
     oDiap:oClient = oCF
     ACTIVATE DIALOG oDiap CENTERED ON INIT ( oCF:Resize(), oCF:Refresh() )

Any ideas on how to resize using the FreeImage library methods and variables?

I also need to mention that when TCoverFlow is displayed on a WIndow it works Ok but when it is on a child Dialog it is at least 50 % slower.

Emiliano Llano Díaz
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: The new TcoverFlow class and resizing images
Posted: Sun Oct 11, 2009 06:17 AM
Emiliano,

You can resize them this way. Instead of:

oImage:Resize(oImage:nWidth()/.5,oImage:nHeight()/.5)

use:

hBitmap = ResizeBmp( oImage:hBitmap, nWidth, nHeight )

http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_resizebmp

You can improve the speed in the dialog reducing the amount of frames for animations, and/or sizes of the covers managed by the coverflow.

http://wiki.fivetechsoft.com/doku.php?id=fivewin_class_tcoverflow
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 107
Joined: Tue Sep 15, 2009 07:52 AM
Re: The new TcoverFlow class and resizing images
Posted: Sun Oct 11, 2009 01:44 PM
Thanks Antonio, now the code changed to:

Code (fw): Select all Collapse
     FOR i=1 TO my_var
       IF !(client->(DBSEEK(PADR(ALLTRIM(UPPER(CFileNoExt(aFolder[i]))),14,' '))))
         cText[1]:="No reference"
       ELSE
         cText[1]:="Ref. : "+client->code
       ENDIF
       oImage:LOADIMAGE(, aFolder[i])
       oCF:AddCoverH( ResizeBmp( oImage:hBitmap, 200, 100 ), cText[1], CLR_YELLOW )  //resize the image and return a new handle for TCoverFlow class
     NEXT i
     oDiap:oClient = oCF
     ACTIVATE DIALOG oDiap CENTERED ON INIT ( oCF:Resize(), oCF:Refresh() )


Code correction which now arises three new issues:

1. I do not know in advance if nWidth is 200 and nHeight is 100 or something else. Is there some way of having oImage:nWidth and oImage:nHeight to resize properly as a percentage of the original image?
2. Why is the text also smaller? (in my case un-readable)
3. The keyboard, which was previously working, is not working, but now the display is extremely fast since the images are small enough.

Thanks
Emiliano Llano Díaz

Continue the discussion