Game Development Reference
In-Depth Information
m_data[y * size + x] = c.ToU32();
}
}
}
private:
float m_angle;
};
5.13.2 Radial Gradient
A radial gradient creates a smooth circular pattern in which the edge is in a starting color
and it blends smoothly towards the center into a target color. Generating a radial gradient
is not very different from the linear gradient, the difference is that instead than calculating
the distance of each pixel to the origin and rotating the point, we calculate a radius from
the center of the image to the pixel, we again apply the Pythagorean theorem to calculate
the distance from each pixel to the center and normalize it by the radius.
The final color calculation is done the same as with linear gradients, we apply r amount of
the starting color and the inverse proportion of the ending color.
It is also possible to reverse the gradient, as we did with linear gradients.
Search WWH ::




Custom Search