The new TcoverFlow class and resizing images

The new TcoverFlow class and resizing images

Postby ellano » 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: Select all  Expand view
   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
ellano
 
Posts: 107
Joined: Tue Sep 15, 2009 7:52 am

Re: The new TcoverFlow class and resizing images

Postby Antonio Linares » Sun Oct 11, 2009 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: The new TcoverFlow class and resizing images

Postby ellano » Sun Oct 11, 2009 1:44 pm

Thanks Antonio, now the code changed to:

Code: Select all  Expand view
    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
ellano
 
Posts: 107
Joined: Tue Sep 15, 2009 7:52 am


Return to FiveWin for Harbour/xHarbour

Who is online

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