Gradient and transparent say

Gradient and transparent say

Postby Davide » Fri Apr 24, 2009 4:09 pm

Hello all,

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

What I'm doing wrong ?

Code: Select all  Expand view
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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Gradient and transparent say

Postby ukoenig » Fri Apr 24, 2009 8: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.

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

Re: Gradient and transparent say

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

Re: Gradient and transparent say

Postby nageswaragunupudi » Sat Apr 25, 2009 12:45 pm

Mr Davide

Does this sample code help you ?
Code: Select all  Expand view
#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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Gradient and transparent say

Postby Davide » 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: Select all  Expand view
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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Gradient and transparent say

Postby ukoenig » Sat Apr 25, 2009 2:40 pm

Hello Davide,

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

Code: Select all  Expand view

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

Re: Gradient and transparent say

Postby Davide » Sat Apr 25, 2009 6:00 pm

Dear Uwe,
ukoenig wrote:a working solution :

thank you,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Gradient and transparent say

Postby Armando » 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
User avatar
Armando
 
Posts: 3211
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Gradient and transparent say

Postby ukoenig » 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/

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

Re: Gradient and transparent say

Postby Armando » Sun Apr 26, 2009 3: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
User avatar
Armando
 
Posts: 3211
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México


Return to FiveWin for Harbour/xHarbour

Who is online

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