Class ColorGradient
Inheritance
ColorGradient
Assembly: Artemis.Core.dll
Syntax
public class ColorGradient : IList<ColorGradientStop>, ICollection<ColorGradientStop>, IEnumerable<ColorGradientStop>, IList, ICollection, IEnumerable, INotifyCollectionChanged
Constructors
ColorGradient()
Declaration
ColorGradient(ColorGradient?)
Declaration
public ColorGradient(ColorGradient? colorGradient)
Parameters
Type |
Name |
Description |
ColorGradient |
colorGradient |
The color gradient to copy
|
ColorGradient(List<ColorGradientStop>)
Declaration
public ColorGradient(List<ColorGradientStop> stops)
Parameters
Properties
Colors
Gets an array containing the colors of the color gradient.
Note: Making changes to this array will not be reflected on the gradient, is is essentially read-only.
Declaration
public SKColor[] Colors { get; }
Property Value
Count
Declaration
public int Count { get; }
Property Value
IsFixedSize
Declaration
public bool IsFixedSize { get; }
Property Value
IsReadOnly
Declaration
public bool IsReadOnly { get; }
Property Value
IsSynchronized
Declaration
public bool IsSynchronized { get; }
Property Value
this[int]
Declaration
public ColorGradientStop this[int index] { get; set; }
Parameters
Type |
Name |
Description |
int |
index |
|
Property Value
Positions
Gets an array containing the positions of colors of the color gradient.
Note: Making changes to this array will not be reflected on the gradient, is is essentially read-only.
Declaration
public float[] Positions { get; }
Property Value
SyncRoot
Declaration
public object SyncRoot { get; }
Property Value
Methods
Add(ColorGradientStop)
Declaration
public void Add(ColorGradientStop item)
Parameters
Add(object?)
Declaration
public int Add(object? value)
Parameters
Type |
Name |
Description |
object |
value |
|
Returns
Clear()
Declaration
Contains(ColorGradientStop)
Declaration
public bool Contains(ColorGradientStop item)
Parameters
Returns
Contains(object?)
Declaration
public bool Contains(object? value)
Parameters
Type |
Name |
Description |
object |
value |
|
Returns
CopyTo(ColorGradientStop[], int)
Declaration
public void CopyTo(ColorGradientStop[] array, int arrayIndex)
Parameters
CopyTo(Array, int)
Declaration
public void CopyTo(Array array, int index)
Parameters
Type |
Name |
Description |
Array |
array |
|
int |
index |
|
Equals(ColorGradient)
Determines whether all the stops in this gradient are equal to the stops in the given other
gradient.
Declaration
protected bool Equals(ColorGradient other)
Parameters
Type |
Name |
Description |
ColorGradient |
other |
The other gradient to compare to
|
Returns
Equals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
Type |
Name |
Description |
object |
obj |
|
Returns
Overrides
FlipStops()
Flips the stops of the gradient.
Declaration
GetColor(float)
Gets a color at any position between 0.0 and 1.0 using interpolation
Declaration
public SKColor GetColor(float position)
Parameters
Type |
Name |
Description |
float |
position |
A position between 0.0 and 1.0
|
Returns
GetColor(float, int, bool)
Gets a color at any position between 0.0 and 1.0 using interpolation
Declaration
[Obsolete("Use GetColor(float position) instead.", true)]
public SKColor GetColor(float position, int timesToRepeat = 0, bool seamless = false)
Parameters
Type |
Name |
Description |
float |
position |
A position between 0.0 and 1.0
|
int |
timesToRepeat |
The amount of times to repeat the positions
|
bool |
seamless |
A boolean indicating whether to make the gradient seamless by adding the first color behind the
last color
|
Returns
GetColorsArray(int, bool)
Gets all the colors in the color gradient
Declaration
[Obsolete("Use the Colors property instead", true)]
public SKColor[] GetColorsArray(int timesToRepeat = 0, bool seamless = false)
Parameters
Type |
Name |
Description |
int |
timesToRepeat |
The amount of times to repeat the colors
|
bool |
seamless |
A boolean indicating whether to make the gradient seamless by adding the first color behind the
last color
|
Returns
Type |
Description |
SKColor[] |
An array containing each color in the gradient
|
GetEnumerator()
Declaration
public IEnumerator<ColorGradientStop> GetEnumerator()
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
GetPositionsArray(int, bool)
Gets all the positions in the color gradient
Declaration
[Obsolete("Use the Positions property instead", true)]
public float[] GetPositionsArray(int timesToRepeat = 0, bool seamless = false)
Parameters
Type |
Name |
Description |
int |
timesToRepeat |
The amount of times to repeat the positions
|
bool |
seamless |
A boolean indicating whether to make the gradient seamless by adding the first color behind the
last color
|
Returns
Type |
Description |
float[] |
An array containing a position for each color between 0.0 and 1.0
|
GetRandom(int)
Gets a new ColorGradient with random colors from the HSV-spectrum
Declaration
public static ColorGradient GetRandom(int stops)
Parameters
Type |
Name |
Description |
int |
stops |
The amount of stops to add
|
Returns
GetUnicornBarf()
Gets a new ColorGradient with colors looping through the HSV-spectrum
Declaration
public static ColorGradient GetUnicornBarf()
Returns
IndexOf(ColorGradientStop)
Declaration
public int IndexOf(ColorGradientStop item)
Parameters
Returns
IndexOf(object?)
Declaration
public int IndexOf(object? value)
Parameters
Type |
Name |
Description |
object |
value |
|
Returns
Insert(int, ColorGradientStop)
Declaration
public void Insert(int index, ColorGradientStop item)
Parameters
Insert(int, object?)
Declaration
public void Insert(int index, object? value)
Parameters
Interpolate(ColorGradient, float)
Interpolates a color gradient between the this gradient and the provided targetValue
.
Declaration
public ColorGradient Interpolate(ColorGradient targetValue, float progress)
Parameters
Type |
Name |
Description |
ColorGradient |
targetValue |
The second color gradient.
|
float |
progress |
A value between 0 and 1.
|
Returns
IsSeamless()
Determines whether the gradient is seamless
Declaration
Returns
Type |
Description |
bool |
true if the gradient is seamless; false otherwise
|
Randomize(int)
Randomizes the color gradient with the given amount of stops
.
Declaration
public void Randomize(int stops)
Parameters
Type |
Name |
Description |
int |
stops |
The amount of stops to put into the gradient.
|
Remove(ColorGradientStop)
Declaration
public bool Remove(ColorGradientStop item)
Parameters
Returns
Remove(object?)
Declaration
public void Remove(object? value)
Parameters
Type |
Name |
Description |
object |
value |
|
RemoveAt(int)
Declaration
public void RemoveAt(int index)
Parameters
Type |
Name |
Description |
int |
index |
|
RotateStops(bool)
Rotates the stops of the gradient shifting every stop over to the position of it's neighbor and wrapping around at
the end of the gradient.
Declaration
public void RotateStops(bool inverse)
Parameters
Type |
Name |
Description |
bool |
inverse |
A boolean indicating whether or not the invert the rotation.
|
SpreadStops()
Spreads the color stops equally across the gradient.
Declaration
public void SpreadStops()
ToggleSeamless()
If not already the case, makes the gradient seamless by adding the first color to the end of the gradient and
compressing the other stops.
If the gradient is already seamless, removes the last color and spreads the remaining stops to fill the freed
space.
Declaration
public void ToggleSeamless()
Events
CollectionChanged
Declaration
public event NotifyCollectionChangedEventHandler? CollectionChanged
Event Type
StopChanged
Occurs when any of the stops has changed in some way
Declaration
public event EventHandler? StopChanged
Event Type
Implements