csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.2 KiB
59 lines
2.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Avalonia.Media.Immutable
|
|
{
|
|
/// <summary>
|
|
/// A brush that draws with a radial gradient.
|
|
/// </summary>
|
|
public class ImmutableRadialGradientBrush : ImmutableGradientBrush, IRadialGradientBrush
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ImmutableRadialGradientBrush"/> class.
|
|
/// </summary>
|
|
/// <param name="gradientStops">The gradient stops.</param>
|
|
/// <param name="opacity">The opacity of the brush.</param>
|
|
/// <param name="spreadMethod">The spread method.</param>
|
|
/// <param name="center">The start point for the gradient.</param>
|
|
/// <param name="gradientOrigin">
|
|
/// The location of the two-dimensional focal point that defines the beginning of the gradient.
|
|
/// </param>
|
|
/// <param name="radius">
|
|
/// The horizontal and vertical radius of the outermost circle of the radial gradient.
|
|
/// </param>
|
|
public ImmutableRadialGradientBrush(
|
|
IList<GradientStop> gradientStops,
|
|
double opacity = 1,
|
|
GradientSpreadMethod spreadMethod = GradientSpreadMethod.Pad,
|
|
RelativePoint? center = null,
|
|
RelativePoint? gradientOrigin = null,
|
|
double radius = 0.5)
|
|
: base(gradientStops, opacity, spreadMethod)
|
|
{
|
|
Center = center ?? RelativePoint.Center;
|
|
GradientOrigin = gradientOrigin ?? RelativePoint.Center;
|
|
Radius = radius;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ImmutableRadialGradientBrush"/> class.
|
|
/// </summary>
|
|
/// <param name="source">The brush from which this brush's properties should be copied.</param>
|
|
public ImmutableRadialGradientBrush(IRadialGradientBrush source)
|
|
: base(source)
|
|
{
|
|
Center = source.Center;
|
|
GradientOrigin = source.GradientOrigin;
|
|
Radius = source.Radius;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public RelativePoint Center { get; }
|
|
|
|
/// <inheritdoc/>
|
|
public RelativePoint GradientOrigin { get; }
|
|
|
|
/// <inheritdoc/>
|
|
public double Radius { get; }
|
|
}
|
|
}
|
|
|