The SetRadialGradient
method is used to apply a radial gradient to a bitmap. This method allows you to specify the center point and radius of the gradient, as well as the gradient itself, which defines the color transitions.
The SetRadialGradient
method is used to apply a radial gradient to a bitmap. This method allows you to specify the center point and radius of the gradient, as well as the gradient itself, which defines the color transitions.
To use the SetRadialGradient
method, you need to provide the following parameters:
center
: A Vector2
representing the center point of the radial gradient.radius
: A float
value that specifies the radius of the gradient.gradient
: A Gradient
object that defines the color transitions for the gradient.Call this method on an instance of the Bitmap
class to apply the radial gradient to the bitmap.
// Create a new Bitmap instance Bitmap bitmap = new Bitmap(); // Define the center of the radial gradient Vector2 center = new Vector2(50, 50); // Set the radius of the gradient float radius = 100.0f; // Create a gradient with color stops Gradient gradient = new Gradient(); gradient.AddColorStop(0.0f, Color.Red); gradient.AddColorStop(1.0f, Color.Blue); // Apply the radial gradient to the bitmap bitmap.SetRadialGradient(center, radius, gradient);