1. ## how to draw a gradient square?

Hi all
i need to draw a square and i need to fill it with radial color gradient. For that i have the ratios and corresponding colors.Is there any algorithms to do gradient fillng?

i dont know wether this question is related to this forum of not!
If any body have some idea on this issue,please guide me.

thanks

2. Originally Posted by lakshmikanth
Hi all
i need to draw a square and i need to fill it with radial color gradient. For that i have the ratios and corresponding colors.Is there any algorithms to do gradient fillng?

i dont know wether this question is related to this forum of not!
If any body have some idea on this issue,please guide me.

thanks
I'm just curious: What do you mean by "gradient filling"?

- Does that imply that the colour depends on the distance from the center of the square? (see attachment)

- Does that mean the colour depends on the slope of the line passing through the center of the square?

- Does that mean that I've misunderstood you completely?

what i mean for 'gradient filling' is to creat a gradient with the given colors and ratios.

i want to create a radial gradient squrare (just like in the attachment you sent) and want to apply transformations on it.for that i have some colors(rgba) and ratios(values between 0-255).

I am new to this subject and please guide me on this issue.
thank you.

4. Originally Posted by lakshmikanth

what i mean for 'gradient filling' is to creat a gradient with the given colors and ratios.

i want to create a radial gradient squrare (just like in the attachment you sent) and want to apply transformations on it.for that i have some colors(rgba) and ratios(values between 0-255).

I am new to this subject and please guide me on this issue.
thank you.
I assume that you know how colours are stored in one number.

This number can be used to define pen.color, brush.color or font.color (I program a little bit in Delphi and these are the commands to change the properties of pen, brush or font)

You can determine a straight line between 2 points [moveto(x1,y1); lineto(x2,y2)] and you can calculate the distance between 2 points.
According to the distance you can change the colour number:
$\displaystyle \$ \underbrace{00}_{palette}\underbrace{1A}_{blue} \underbrace{BC}_{green}\underbrace{13}_{red}\$

... but I still don't understand how this square should look like which you want to create with your computer