FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Gradient and transparent say
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Gradient and transparent say
Posted: Fri Apr 24, 2009 04:09 PM
Hello all,

I'm trying some gradient effects, but cannot have the SAY transparent.

What I'm doing wrong ?

Code (fw): Select all Collapse
DEFINE WINDOW oWnd TITLE "Test" 

    @ 150,10 SAY "Test" SIZE 90,20 PIXEL OF oWnd TRANSPARENT ADJUST

    ACTIVATE WINDOW oWnd MAXIMIZED ;
               ON PAINT GradientFill( hDC, 0, 0, oWnd:nHeight, oWnd:nWidth, { { 0.50, 16382894, 16733011 } } )


Thanks,
Davide
FWH 9.04 - xH - Bcc
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Gradient and transparent say
Posted: Fri Apr 24, 2009 08:45 PM
Hello Davide,
I'm not sure, but I think, on the Main-Window it could be a problem.

To draw some text inside the Main-Window, it might be a better solution,
to save the text as a transparent-image.
You will have much better effects like : shadows, Text-Gradient, Borders and more,
creating the text with a Graphic-program.





Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Re: Gradient and transparent say
Posted: Sat Apr 25, 2009 11:38 AM
Dear Uwe,

thank you for your reply.

ukoenig wrote:I'm not sure, but I think, on the Main-Window it could be a problem.

To draw some text inside the Main-Window, it might be a better solution,
to save the text as a transparent-image.


It's not the Main window. Just a window.

Unfortunately I cannot use images because that text is produced at runtime. I would have to create dozens of images and store them on resources.

Any other idea ?

Thank you again.
Davide
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Gradient and transparent say
Posted: Sat Apr 25, 2009 12:45 PM
Mr Davide

Does this sample code help you ?
Code (fw): Select all Collapse
#include 'fivewin.ch'

static oFont

function main()

   local oWnd

   define font oFont name 'TAHOMA' size 0,-30 bold
   define window oWnd

   activate window ownd ;
      on paint winPaint( hDC, cPS, oWnd )

return nil

static function winPaint( hDC, cPS, oWnd )

   local cMsg        := 'My Message'
   local nMsgWidth   := GetTextWidth( hDC, cMsg, oFont:hFont )

   GradientFill( hDC, 0, 0, oWnd:nHeight, oWnd:nWidth, ;
      { { 0.50, 16382894, 16733011 } } )

   oWnd:Say( oWnd:nHeight / 2 - 15, ( oWnd:nWidth - nMsgWidth ) / 2, ;
      cMsg, CLR_YELLOW, , oFont, .t., .t. )


return nil

It needs a bit more code to precisely center the message. But if the general logic serves your purpose, you can improve on that.

I am trying to do this on MDI main window, but I am not able to do
Regards



G. N. Rao.

Hyderabad, India
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Re: Gradient and transparent say
Posted: Sat Apr 25, 2009 12:58 PM
Dear Rao,

nageswaragunupudi wrote:Does this sample code help you ?
...
I am trying to do this on MDI main window, but I am not able to do

I've actually solved the problem in a similar way.
Fortunately all my labels are on the leftmost side and shorter than 100 pixels, so I switched the gradient horizontally and painted it only on the remaining width.

The SAYs still are not transparent, but the result is acceptable.

Code (fw): Select all Collapse
DEFINE WINDOW oWnd TITLE "Test" COLOR 0, 16382894

    @ 150,10 SAY "Test" SIZE 90,20 PIXEL OF oWnd TRANSPARENT 

    ACTIVATE WINDOW oWnd MAXIMIZED ;
               ON PAINT GradientFill( hDC, 0, 100, oWnd:nHeight, oWnd:nWidth, { { 0.50, 16382894, 16733011 } } , .f.)


Hope this help.

Hi,
Davide
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Gradient and transparent say
Posted: Sat Apr 25, 2009 02:40 PM
Hello Davide,

a working solution :
( I changed Your Line 150 Pixel to 50 Pixel for a smaller screenshot )


Code (fw): Select all Collapse
...
...
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT SHOW_DLG( oWnd ) 

RETURN( NIL )

// --------------------------------------------------------

FUNCTION SHOW_DLG( oWnd )
LOCAL oDlg

DEFINE DIALOG oDlg OF oWnd TITLE "Test" TRANSPARENT

@ 150,10 SAY "Test" SIZE 90,20 PIXEL OF oDlg 

ACTIVATE DIALOG oDlg ;
ON INIT oDlg:Move( 0 , 0, oWnd:nWidth, oWnd:nHeight, .f. ) ;
ON PAINT GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, { { 0.50, 16382894, 16733011 } } , .f.)

RETURN NIL


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Re: Gradient and transparent say
Posted: Sat Apr 25, 2009 06:00 PM
Dear Uwe,
ukoenig wrote:a working solution :

thank you,
Davide
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Gradient and transparent say
Posted: Sat Apr 25, 2009 10:15 PM

Uwe:

Just a question, Which one software do you use to create that text-images ?

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Gradient and transparent say
Posted: Sun Apr 26, 2009 11:35 AM
Hello Armando,

some years ago, I bought a application : MyTypeArtist.
I can use some hundreds of different font-styles.
Searching in the Internet, it seems, it is not available anymore.
The are some other very good solutions for Logo- and Textdesign, You can search in the Internet.

AAALogo
http://www.aaa-logo.com/

LogoCreator

http://www.thelogocreator.com/





BluffTitler ( Text and Animation )
http://www.outerspace-software.com/



Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Gradient and transparent say
Posted: Sun Apr 26, 2009 03:22 PM

Uwe:

Thanks a lot my friend.

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero

Continue the discussion