Method Create
Create(PresetColorRampType, uint)
Creates a color ramp with a predefined color ramp type.
Declaration
public static ColorRamp Create(PresetColorRampType type, uint size = 256)
Parameters
| Type | Name | Description |
|---|---|---|
| PresetColorRampType | type | The predefined color ramp type. |
| uint | size | The number of steps in the complete resulting gradient. A typical value is 256. |
Returns
| Type | Description |
|---|---|
| ColorRamp | A new color ramp object. |
Remarks
For the minimum number of steps, see PresetColorRampType.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The provided type is None. -OR- The provided number of steps is too small. |
Applies to
Platforms and versions
| Target | Versions |
|---|---|
| .NET Standard 2.0 | 100.3 - 200.8 |
| .NET | 100.13 - 300.0 |
| .NET Windows | 100.13 - 300.0 |
| .NET Android | 200.0 - 300.0 |
| .NET iOS | 200.0 - 300.0 |
| .NET Framework | 100.0 - 200.8 |
| Xamarin.Android | 100.0 - 100.15 |
| Xamarin.iOS | 100.0 - 100.15 |
| UWP | 100.0 - 200.8 |
Create(IEnumerable<Color>, uint)
Creates a custom color ramp with a linear gradient between the provided colors.
Declaration
public static ColorRamp Create(IEnumerable<Color> colors, uint size = 256)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Color> | colors | A list of two or more colors that the color ramp will blend between. |
| uint | size | The number of steps in the complete resulting gradient. A typical value is 256. |
Returns
| Type | Description |
|---|---|
| ColorRamp | A new color ramp object. |
Remarks
The alpha channel of each color is ignored, so every color is treated as if it were completely opaque.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Fewer than two colors are provided. -OR- The provided number of steps is less than 2 * (number_of_colors - 1). |
Applies to
Platforms and versions
| Target | Versions |
|---|---|
| .NET | 300 |
| .NET Windows | 300 |
| .NET Android | 300 |
| .NET iOS | 300 |
Create(IEnumerable<ColorStop>, uint)
Creates a custom color ramp with a linear gradient between the provided color stops.
Declaration
public static ColorRamp Create(IEnumerable<ColorStop> colorStops, uint size = 256)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ColorStop> | colorStops | A list of two or more color stops that the color ramp will blend between. |
| uint | size | The number of steps in the complete resulting gradient. A typical value is 256. |
Returns
| Type | Description |
|---|---|
| ColorRamp | A new color ramp object. |
Remarks
Any pixel values placed in a position before the minimum position provided or after the maximum position provided will be shaded with the color of the nearest color stop.
The alpha channel of each color is ignored, so every color is treated as if it were completely opaque.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Fewer than two color stops are provided. -OR- Any of the color stop positions are not in the interval [0.0, 1.0]. -OR- Fewer than two steps would separate the closest consecutive pair of color stops. |
Applies to
Platforms and versions
| Target | Versions |
|---|---|
| .NET | 300 |
| .NET Windows | 300 |
| .NET Android | 300 |
| .NET iOS | 300 |