FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Gradient
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM

Gradient

Posted: Wed Aug 06, 2014 07:43 AM

Hi,

What is the best option to create a gradient ?. For example a light red to a dark red, light green to dark green, know the values ​​... as easy way. Exist some tool?

Thanks

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: Gradient

Posted: Wed Aug 06, 2014 09:58 AM
Charles,

with the new RGB-tool, You can create a gradient from any colors You like.
1. select any button or color for the 1. gradient-color
2. select any button or color for the 2. gradient-color
the gradient will be painted
You can change the color-position inside the gradient and the direction.



Best 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: 1283
Joined: Fri Feb 10, 2006 02:34 PM

Re: Gradient

Posted: Wed Aug 06, 2014 10:01 AM

Uwe,

Can i download this tool ?

Thanks.

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: Gradient

Posted: Wed Aug 06, 2014 10:05 AM

Charles,

YES, I will add a extra downloadlink, as soon it is finished.
Just some small things to do.

Best 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.
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM

Re: Gradient

Posted: Wed Aug 06, 2014 10:11 AM

Uwe,

Perfect !. Im waiting news... :D

Thanks.

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Gradient

Posted: Wed Aug 06, 2014 10:59 AM
Carles wrote:Hi,

What is the best option to create a gradient ?. For example a light red to a dark red, light green to dark green, know the values ​​... as easy way. Exist some tool?

Thanks

Till then you can start defining and using gradients.
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oDlg, oFont, oBrush
   local aGrad

   // Stadard way to define gradients in FWH
   //
   aGrad    := {  { 0.55, CLR_HBLUE, CLR_WHITE  }, ;
                  { 0.45, CLR_WHITE, CLR_HGREEN }  }

   // 55% of the area transition from CLR_HBLUE to CLR_WHITE
   // Next 45% from CLR_WHITE to CRLR_HGREEN
   // Can have single step gradient or unlimited multiple step gradient


   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-16 BOLD

   // Simplest way to define gradiet for a dialog/ or window

   DEFINE DIALOG oDlg TRANSPARENT FONT oFont GRADIENT aGrad
   @ 40,40 SAY "Fivewin Gradients" SIZE 100,10 PIXEL OF oDlg
   ACTIVATE DIALOG oDlg CENTERED


   // Can also define Gradient Brush and use

   DEFINE BRUSH oBrush GRADIENT aGrad HORIZONTAL
   DEFINE DIALOG oDlg TRANSPARENT FONT oFont BRUSH oBrush
   @ 40,40 SAY "Five Win Gradients" SIZE 100,10 PIXEL OF oDlg
   ACTIVATE DIALOG oDlg CENTERED

   RELEASE BRUSH oBrush
   RELEASE FONT oFont

return nil


Outpur of the above program:




Mr Uwe's tools may help you to visually choose the colors for the gradients. But essentially this the code to be used inside the FWH program.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM

Re: Gradient

Posted: Wed Aug 06, 2014 11:05 AM

Mr. Rao,

Thanks a lot :D , maybe i need to know a easy way to know the color values...

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Gradient

Posted: Wed Aug 06, 2014 11:24 AM

You may use:

nSelectedColor := ChooseColor( [nStartColor] )

or just
nSelecedColor := ChooseColor()

This opens colors dialog. You can choose any color and shade and if you press ok, it returns numeric value of the colour.
You can use the numeric value as it is in the place of a color definition.


Still if you like to have a human readable form of the color number:
You can use

cClr := cClrToCode( nColorNumber )
cClr is a familiar character string like:
CLR_HRED
RGB( r, g, b ), etc/
You can paste this into your program

Regards



G. N. Rao.

Hyderabad, India
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM

Re: Gradient

Posted: Wed Aug 06, 2014 11:28 AM

Mr. Rao,

Eaaaasy !

Maybe a stupid question... :wink:

Thanks a lot !

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix

Continue the discussion