Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
[Solved] Gradient
Print
Pages: [
1
]
Author
Topic: [Solved] Gradient (Read 3453 times)
0 Members and 1 Guest are viewing this topic.
dabo
Sr. Member
Posts: 260
[Solved] Gradient
«
on:
June 22, 2008, 01:09:50 pm »
How do you draw a sf::Shape with a color gradient? Let's say I want a rectangle with a red top and a blue bottom. Would be interesting to know the math behind the color calculations.
Logged
Laurent
Administrator
Hero Member
Posts: 32498
[Solved] Gradient
«
Reply #1 on:
June 22, 2008, 01:12:15 pm »
Each point has its own color, then the shape is filled using a simple interpolation between all points.
In this case, you just have to assign a blue color to the 2 top points, and a red color to the 2 bottom points.
Logged
Laurent Gomila - SFML developer
dabo
Sr. Member
Posts: 260
[Solved] Gradient
«
Reply #2 on:
June 22, 2008, 01:38:03 pm »
That was easy, I almost thought you were lying
Thanks
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
[Solved] Gradient
anything