Gradient and transparent say

Post Reply
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Gradient and transparent say

Post by Davide »

Hello all,

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

What I'm doing wrong ?

Code: Select all

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
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Gradient and transparent say

Post by ukoenig »

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.

Image

Image

Regards
Uwe :lol:
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.
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Gradient and transparent say

Post by Davide »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Gradient and transparent say

Post by nageswaragunupudi »

Mr Davide

Does this sample code help you ?

Code: Select all

#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
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Gradient and transparent say

Post by Davide »

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: Select all

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
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Gradient and transparent say

Post by ukoenig »

Hello Davide,

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

Code: Select all

...
...
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 :lol:
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.
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Gradient and transparent say

Post by Davide »

Dear Uwe,
ukoenig wrote:a working solution :
thank you,
Davide
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: Gradient and transparent say

Post by Armando »

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
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Gradient and transparent say

Post by ukoenig »

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/

Image

Image

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


Regards
Uwe :lol:
Last edited by ukoenig on Sun Apr 26, 2009 8:03 pm, edited 1 time in total.
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.
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: Gradient and transparent say

Post by Armando »

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